refactor: move flagFiles to global scope

This commit is contained in:
franklin 2021-03-25 12:30:59 +01:00
parent a1ca047c9a
commit d63de3e65e
3 changed files with 6 additions and 9 deletions

View File

@ -6,10 +6,6 @@ import (
"github.com/spf13/cobra"
)
func init() {
generateCmd.Flags().StringSliceVarP(&flagFiles, "file", "f", []string{}, "Configuration file to merge")
}
var (
generateCmd = &cobra.Command{
Use: "generate [UNIT...]",

View File

@ -33,7 +33,9 @@ var (
)
func init() {
rootCmd.PersistentFlags().BoolVarP(&flagVerbose, "verbose", "v", false, "Show more ouput")
rootCmd.PersistentFlags().BoolVarP(&flagVerbose, "verbose", "v", false, "show more output")
rootCmd.PersistentFlags().StringSliceVarP(&flagFiles, "file", "f", []string{"squadron.yaml"}, "specify alternative squadron files")
rootCmd.AddCommand(upCmd, downCmd, buildCmd, generateCmd, configCmd, versionCmd, completionCmd)
}

View File

@ -7,10 +7,9 @@ import (
)
func init() {
upCmd.Flags().StringVarP(&flagNamespace, "namespace", "n", "default", "Specifies the namespace")
upCmd.Flags().StringSliceVarP(&flagFiles, "file", "f", []string{}, "Configuration file to merge")
upCmd.Flags().BoolVarP(&flagBuild, "build", "b", false, "Build service squadron before publishing")
upCmd.Flags().BoolVarP(&flagPush, "push", "p", false, "Pushes the built service to the registry")
upCmd.Flags().StringVarP(&flagNamespace, "namespace", "n", "default", "specifies the namespace")
upCmd.Flags().BoolVarP(&flagBuild, "build", "b", false, "builds or rebuilds units")
upCmd.Flags().BoolVarP(&flagPush, "push", "p", false, "pushes units to the registry")
}
var (