go.ligato.io/vpp-agent/v3@v3.5.0/cmd/agentctl/main.go (about)

     1  //  Copyright (c) 2019 Cisco and/or its affiliates.
     2  //
     3  //  Licensed under the Apache License, Version 2.0 (the "License");
     4  //  you may not use this file except in compliance with the License.
     5  //  You may obtain a copy of the License at:
     6  //
     7  //      http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  //  Unless required by applicable law or agreed to in writing, software
    10  //  distributed under the License is distributed on an "AS IS" BASIS,
    11  //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  //  See the License for the specific language governing permissions and
    13  //  limitations under the License.
    14  
    15  package main
    16  
    17  import (
    18  	"fmt"
    19  	"os"
    20  
    21  	agentcli "go.ligato.io/vpp-agent/v3/cmd/agentctl/cli"
    22  	"go.ligato.io/vpp-agent/v3/cmd/agentctl/commands"
    23  	"go.ligato.io/vpp-agent/v3/pkg/version"
    24  )
    25  
    26  const logo = `
    27                        __      __  __
    28    ___ ____ ____ ___  / /_____/ /_/ /
    29   / _ '/ _ '/ -_) _ \/ __/ __/ __/ / 
    30   \_,_/\_, /\__/_//_/\__/\__/\__/_/  
    31       /___/
    32  `
    33  
    34  func runAgentctl(cli *agentcli.AgentCli) error {
    35  	cmd, err := commands.NewRootCommand(cli)
    36  	if err != nil {
    37  		return err
    38  	}
    39  	cmd.Long = logo
    40  	cmd.Version = version.Version()
    41  	return cmd.Execute()
    42  }
    43  
    44  func main() {
    45  	cli := commands.NewAgentCli()
    46  
    47  	if err := runAgentctl(cli); err != nil {
    48  		fmt.Fprintf(cli.Err(), "\nERROR: %v\n", err)
    49  		os.Exit(commands.ExitCode(err))
    50  	}
    51  }