30 lines
445 B
Go
30 lines
445 B
Go
|
package cmd
|
||
|
|
||
|
import (
|
||
|
"os"
|
||
|
|
||
|
"github.com/spf13/cobra"
|
||
|
)
|
||
|
|
||
|
var (
|
||
|
RootCmd = &cobra.Command{
|
||
|
Use: "acli",
|
||
|
Short: "Интерфейс командной строки",
|
||
|
CompletionOptions: cobra.CompletionOptions{
|
||
|
HiddenDefaultCmd: true,
|
||
|
},
|
||
|
Run: func(cmd *cobra.Command, args []string) {
|
||
|
if len(args) == 0 {
|
||
|
cmd.Help()
|
||
|
os.Exit(0)
|
||
|
}
|
||
|
},
|
||
|
}
|
||
|
)
|
||
|
|
||
|
func Execute() {
|
||
|
if err := RootCmd.Execute(); err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
}
|