Add version command
This commit is contained in:
@@ -19,18 +19,24 @@ var (
|
||||
disableColor bool
|
||||
)
|
||||
|
||||
var mainCommand = &cobra.Command{
|
||||
Use: "sing-box",
|
||||
PersistentPreRun: preRun,
|
||||
}
|
||||
|
||||
func init() {
|
||||
mainCommand.PersistentFlags().StringVarP(&configPath, "config", "c", "config.json", "set configuration file path")
|
||||
mainCommand.PersistentFlags().StringVarP(&workingDir, "directory", "D", "", "set working directory")
|
||||
mainCommand.PersistentFlags().BoolVarP(&disableColor, "disable-color", "", false, "disable color output")
|
||||
|
||||
mainCommand.AddCommand(commandRun)
|
||||
mainCommand.AddCommand(commandCheck)
|
||||
mainCommand.AddCommand(commandFormat)
|
||||
mainCommand.AddCommand(commandVersion)
|
||||
}
|
||||
|
||||
func main() {
|
||||
command := &cobra.Command{
|
||||
Use: "sing-box",
|
||||
PersistentPreRun: preRun,
|
||||
}
|
||||
command.PersistentFlags().StringVarP(&configPath, "config", "c", "config.json", "set configuration file path")
|
||||
command.PersistentFlags().StringVarP(&workingDir, "directory", "D", "", "set working directory")
|
||||
command.PersistentFlags().BoolVarP(&disableColor, "disable-color", "", false, "disable color output")
|
||||
command.AddCommand(commandRun)
|
||||
command.AddCommand(commandCheck)
|
||||
command.AddCommand(commandFormat)
|
||||
if err := command.Execute(); err != nil {
|
||||
if err := mainCommand.Execute(); err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user