mirror of
https://github.com/semaphoreui/semaphore.git
synced 2025-01-20 15:29:28 +01:00
feat(cli): add default value for config option
This commit is contained in:
parent
01e56302f8
commit
4b024af095
@ -27,24 +27,13 @@ var rootCmd = &cobra.Command{
|
||||
Source code is available at https://github.com/ansible-semaphore/semaphore.
|
||||
Complete documentation is available at https://ansible-semaphore.com.`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
if len(args) == 0 && configPath == "" {
|
||||
_ = cmd.Help()
|
||||
os.Exit(0)
|
||||
} else {
|
||||
serviceCmd.Run(cmd, args)
|
||||
}
|
||||
_ = cmd.Help()
|
||||
os.Exit(0)
|
||||
},
|
||||
}
|
||||
|
||||
func Execute() {
|
||||
args := os.Args[1:]
|
||||
if len(args) == 2 && args[0] == "-config" {
|
||||
configPath = args[1]
|
||||
runService()
|
||||
return
|
||||
}
|
||||
|
||||
rootCmd.PersistentFlags().StringVar(&configPath, "config", "", "Configuration file path")
|
||||
rootCmd.PersistentFlags().StringVar(&configPath, "config", "/usr/local/etc/semaphore/config.json", "Configuration file path")
|
||||
if err := rootCmd.Execute(); err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
os.Exit(1)
|
||||
|
Loading…
Reference in New Issue
Block a user