Exemplo n.º 1
0
func init() {
	cobra.OnInitialize(initConfig)

	RootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default $HOME/.lateral/config.yaml)")
	RootCmd.PersistentFlags().StringP("socket", "s", "", "UNIX domain socket path (default $HOME/.lateral/socket.$SESSIONID)")
	Viper.BindPFlag("socket", RootCmd.PersistentFlags().Lookup("socket"))
}
Exemplo n.º 2
0
func init() {
	cobra.OnInitialize(initConfig)

	// Setting flags here so they can be used by both the root behavior as well as
	// by the indidual behaviors of icarus and daedalus
	RootCmd.PersistentFlags().StringVar(&CfgFile, "config", "", "config file (default is $CWD/config.yaml)")
	RootCmd.PersistentFlags().IntP("port", "p", 8013, "Port run on")
	RootCmd.PersistentFlags().IntP("width", "x", 15, "width of the laybrinth")
	RootCmd.PersistentFlags().IntP("height", "y", 10, "height of the laybrinth") // 'h' is used for help already
	RootCmd.PersistentFlags().IntP("times", "t", 1, "times to solve the laybrinth")
	RootCmd.PersistentFlags().IntP("max-steps", "m", 500, "Maximum steps before giving up")

	RootCmd.PersistentFlags().Bool("mouse", false, "Use random mouse solver")
	RootCmd.PersistentFlags().String("bias", "O", "Bias for maze generator. H,V,X,O or D")

	// Bind viper to these flags so viper can read flag values along with config, env, etc.
	viper.BindPFlag("width", RootCmd.PersistentFlags().Lookup("width"))
	viper.BindPFlag("height", RootCmd.PersistentFlags().Lookup("height"))
	viper.BindPFlag("port", RootCmd.PersistentFlags().Lookup("port"))
	viper.BindPFlag("times", RootCmd.PersistentFlags().Lookup("times"))
	viper.BindPFlag("max-steps", RootCmd.PersistentFlags().Lookup("max-steps"))

	viper.BindPFlag("mouse", RootCmd.PersistentFlags().Lookup("mouse"))
	viper.BindPFlag("bias", RootCmd.PersistentFlags().Lookup("bias"))
}
Exemplo n.º 3
0
func init() {
	cobra.OnInitialize(initConfig)

	// Here you will define your flags and configuration settings.
	// Cobra supports Persistent Flags, which, if defined here,
	// will be global for your application.

	RootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.alea.yaml)")
	RootCmd.PersistentFlags().StringVar(&cfg.controller, "controller", "", "alea controller URL, set it manually if it can't be resolved from the deis git remote, defaults to services.<deis.domain>")
	RootCmd.Flags().StringVarP(&cfg.app, "app", "a", "", "deis app name, set it manually if it can't be resolved from the deis git remote")

	// Cobra also supports local flags, which will only run
	// when this action is called directly.
	// RootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")

	if cfg.app == "" {
		app, err := git.GetAppFromRemote()

		if err != nil {
			fmt.Println("Could not get App from git remote\n\nRun this command from the root of your Deis app for best results or pass in -a <app-name>\n\n")
		}

		cfg.app = app
	}
}
Exemplo n.º 4
0
func init() {
	cobra.OnInitialize(initConfig)

	// Command flags
	RootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.goigc.yaml)")

}
Exemplo n.º 5
0
func init() {
	cobra.OnInitialize(initConfig)

	// Setup logging for the package. Doing it here is much eaiser than in each
	// binary. If you want to overwrite it in a specific binary then feel free.
	hook, err := logrus_syslog.NewSyslogHook("", "", syslog.LOG_INFO, "")
	if err != nil {
		panic(err)
	}
	syslogLog.Hooks.Add(hook)
	syslogLog.Formatter = new(logrus.JSONFormatter)

	// Set the hostname for use in logging within the package. Doing it here is
	// cleaner than in each binary but if you want to use some other method just
	// override the variable in the specific binary.
	host, err = os.Hostname()
	if err != nil {
		syslogLog.WithFields(logrus.Fields{
			"check":   "sensupluginses",
			"client":  "unknown",
			"version": version.AppVersion(),
			"error":   err,
		}).Error(`Could not determine the hostname of this machine as reported by the kernel.`)
		sensuutil.Exit("GENERALGOLANGERROR")
	}

	RootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.sensupluginses.yaml)")
	RootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
}
Exemplo n.º 6
0
Arquivo: root.go Projeto: romana/core
func init() {
	credential = common.NewCredentialCobra(RootCmd)

	cli.OnInitialize(initConfig)
	RootCmd.AddCommand(hostCmd)
	RootCmd.AddCommand(tenantCmd)
	RootCmd.AddCommand(segmentCmd)
	RootCmd.AddCommand(policyCmd)

	RootCmd.Flags().BoolVarP(&version, "version", "",
		false, "Build and Versioning Information.")

	RootCmd.PersistentFlags().StringVarP(&cfgFile, "config",
		"c", "", "config file (default is $HOME/.romana.yaml)")
	RootCmd.PersistentFlags().StringVarP(&rootURL, "rootURL",
		"r", "", "root service url, e.g. http://192.168.0.1")
	RootCmd.PersistentFlags().StringVarP(&rootPort, "rootPort",
		"p", "", "root service port, e.g. 9600")
	RootCmd.PersistentFlags().StringVarP(&format, "format",
		"f", "", "enable formatting options like [json|table], etc.")
	RootCmd.PersistentFlags().StringVarP(&platform, "platform",
		"P", "", "Use platforms like [openstack|kubernetes], etc.")
	RootCmd.PersistentFlags().BoolVarP(&verbose, "verbose",
		"v", false, "Verbose output.")

	RootCmd.PersistentPreRun = preConfig
	RootCmd.Run = versionInfo
}
Exemplo n.º 7
0
Arquivo: cmd.go Projeto: adriamb/gopad
func init() {
	cobra.OnInitialize(initConfig)

	RootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.runes.yaml)")
	RootCmd.AddCommand(createCmd)
	RootCmd.AddCommand(runCmd)
}
Exemplo n.º 8
0
func init() {
	RootCmd.PersistentFlags().Bool(showLibmachineLogs, false, "Whether or not to show logs from libmachine.")
	RootCmd.AddCommand(configCmd.ConfigCmd)
	pflag.CommandLine.AddGoFlagSet(goflag.CommandLine)
	viper.BindPFlags(RootCmd.PersistentFlags())
	cobra.OnInitialize(initConfig)
}
Exemplo n.º 9
0
func init() {
	cobra.OnInitialize(initConfig)

	// Here you will define your flags and configuration settings.
	// Cobra supports Persistent Flags, which, if defined here,
	// will be global for your application.

	RootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.gopixabay.yaml)")
	// Cobra also supports local flags, which will only run
	// when this action is called directly.
	RootCmd.PersistentFlags().StringVarP(&arguments.request.Key, "key", "k", "", "Your pixabay API key")
	RootCmd.Flags().StringVarP(&arguments.request.ResponseGroup, "response-group", "g", "image_details", "Select the information returned: image details or URLs of high resolution images. High resolution image URLs and details cannot be obtained in a single request. (image_details, high_resolution)")
	RootCmd.Flags().StringVar(&arguments.request.ID, "id", "", "ID, ID hash, or a comma separated list of values for fetching or updating specific images. In a comma separated list, IDs and ID hashs cannot be used together.")
	RootCmd.Flags().StringVarP(&arguments.request.Query, "query", "q", "", "A text query to use when searching for images")
	RootCmd.Flags().StringVarP(&arguments.request.Lang, "lang", "l", "en", "Language code of the language to be searched in. ")
	RootCmd.Flags().StringVarP(&arguments.request.ImageType, "image-type", "t", "all", "A media type to search within. (all, photo, illustration, vector)")
	RootCmd.Flags().StringVarP(&arguments.request.Orientation, "orientation", "o", "all", "Whether an image is wider than it is tall, or taller than it is wide. (all, horizontal, vertical)")
	RootCmd.Flags().StringVarP(&arguments.request.Category, "category", "c", "", "Filter images by category. (fashion, nature, backgrounds, science, education, people, feelings, religion, health, places, animals, industry, food, computer, sports, transportation, travel, buildings, business, music)")
	RootCmd.Flags().IntVar(&arguments.request.MinWidth, "min-width", 0, "Minimum image width. ")
	RootCmd.Flags().IntVar(&arguments.request.MinWidth, "min-height", 0, "Minimum image height. ")
	RootCmd.Flags().BoolVarP(&arguments.request.EditorsChoice, "editors-choice", "e", false, "Select images that have received an Editor's Choice award. ")
	RootCmd.Flags().BoolVarP(&arguments.request.SafeSearch, "safesearch", "s", false, "A flag indicating that only images suitable for all ages should be returned. ")
	RootCmd.Flags().StringVarP(&arguments.request.Order, "order", "r", "popular", "How the results should be ordered. (popular, latest)")
	RootCmd.Flags().IntVarP(&arguments.request.Page, "page", "p", 1, "Returned search results are paginated. Use this parameter to select the page number. ")
	RootCmd.Flags().IntVar(&arguments.request.PerPage, "per-page", 20, "Determine the number of results per page.")
	RootCmd.Flags().StringVar(&arguments.request.Callback, "callback", "", "JSONP callback function name")
	RootCmd.Flags().BoolVar(&arguments.request.Pretty, "pretty", false, "Prettify and indent JSON output. This option is for development puposes only and should not be used in production. ")

	RootCmd.Flags().StringVar(&arguments.size, "size", "og", "Image size to download (og, lg, md, sm, xs) ")
	RootCmd.Flags().IntVar(&arguments.simultaneous, "num", 4, "Number of images to download in paralell")

}
Exemplo n.º 10
0
func init() {
	cobra.OnInitialize(initConfig)
	RootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.cobra.yaml)")
	RootCmd.PersistentFlags().StringVarP(&projectBase, "projectbase", "b", "", "base project directory, e.g. github.com/spf13/")
	RootCmd.PersistentFlags().StringP("author", "a", "YOUR NAME", "Author name for copyright attribution")
	RootCmd.PersistentFlags().StringVarP(&userLicense, "license", "l", "", "Name of license for the project (can provide `licensetext` in config)")
	RootCmd.PersistentFlags().Bool("viper", true, "Use Viper for configuration")
	viper.BindPFlag("author", RootCmd.PersistentFlags().Lookup("author"))
	viper.BindPFlag("projectbase", RootCmd.PersistentFlags().Lookup("projectbase"))
	viper.BindPFlag("useViper", RootCmd.PersistentFlags().Lookup("viper"))
	viper.SetDefault("author", "NAME HERE <EMAIL ADDRESS>")
	viper.SetDefault("license", "apache")
	viper.SetDefault("licenseText", `
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
`)
}
Exemplo n.º 11
0
func init() {
	cobra.OnInitialize(initConfig)

	// Setting flags here so they can be used by both the root behavior as well as
	// by the indidual behaviors of icarus and daedalus
	RootCmd.PersistentFlags().StringVar(&CfgFile, "config", "", "config file (default is $CWD/config.yaml)")
	RootCmd.PersistentFlags().IntP("port", "p", 8013, "Port run on")
	RootCmd.PersistentFlags().IntP("width", "x", 15, "width of the laybrinth")
	RootCmd.PersistentFlags().IntP("height", "y", 10, "height of the laybrinth") // 'h' is used for help already
	RootCmd.PersistentFlags().IntP("times", "t", 1, "times to solve the laybrinth")
	RootCmd.PersistentFlags().IntP("max-steps", "m", 500, "Maximum steps before giving up")
	RootCmd.PersistentFlags().BoolP("interactive", "i", false, "runs in interactive mode")
	RootCmd.PersistentFlags().BoolP("debug", "d", false, "prints debug messages")
	RootCmd.PersistentFlags().Float64P("braid", "b", 1.0, "probability to rearrange an dead end to a braid")

	// Bind viper to these flags so viper can read flag values along with config, env, etc.
	_ = viper.BindPFlag("width", RootCmd.PersistentFlags().Lookup("width"))
	_ = viper.BindPFlag("height", RootCmd.PersistentFlags().Lookup("height"))
	_ = viper.BindPFlag("port", RootCmd.PersistentFlags().Lookup("port"))
	_ = viper.BindPFlag("times", RootCmd.PersistentFlags().Lookup("times"))
	_ = viper.BindPFlag("max-steps", RootCmd.PersistentFlags().Lookup("max-steps"))
	_ = viper.BindPFlag("interactive", RootCmd.PersistentFlags().Lookup("interactive"))
	_ = viper.BindPFlag("debug", RootCmd.PersistentFlags().Lookup("debug"))
	_ = viper.BindPFlag("braid", RootCmd.PersistentFlags().Lookup("braid"))
}
Exemplo n.º 12
0
func init() {
	initFlags(cliContext)

	cobra.OnInitialize(func() {
		cliContext.Addr = net.JoinHostPort(connHost, connPort)
	})
}
Exemplo n.º 13
0
func init() {
	cobra.OnInitialize(initConfig)
	RootCmd.PersistentFlags().StringVar(&cfgFile, "config", "",
		"config file path.")
	RootCmd.PersistentFlags().BoolVarP(&log.ShowDebug, "debug", "d", false,
		"Print debug information")
}
Exemplo n.º 14
0
func init() {
	cobra.OnInitialize(initConfig)

	// Here you will define your flags and configuration settings.
	// Cobra supports Persistent Flags, which, if defined here,
	// will be global for your application.

	RootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.nessusControl.yaml)")
	// Cobra also supports local flags, which will only run
	// when this action is called directly.
	RootCmd.PersistentFlags().StringP("username", "u", "admin", "The username to log into Nessus.")
	RootCmd.PersistentFlags().StringP("password", "a", "Th1sSh0u1dB3AStr0ngP422w0rd", "The password to use to log into Nessus.")
	RootCmd.PersistentFlags().StringP("hostname", "o", "127.0.0.1", "The host where Nessus is located.")
	RootCmd.PersistentFlags().StringP("port", "p", "8834", "The port number used to connect to Nessus.")
	RootCmd.PersistentFlags().BoolP("debug", "d", false, "Use this flag to enable debug mode")

	viper.BindPFlag("auth.username", RootCmd.PersistentFlags().Lookup("username"))
	viper.SetDefault("auth.username", "admin")
	viper.BindPFlag("auth.password", RootCmd.PersistentFlags().Lookup("password"))
	viper.SetDefault("auth.password", "Th1sSh0u1dB3AStr0ngP422w0rd")
	viper.BindPFlag("nessusLocation.hostname", RootCmd.PersistentFlags().Lookup("hostname"))
	viper.SetDefault("nessusLocation.hostname", "127.0.0.1")
	viper.BindPFlag("nessusLocation.port", RootCmd.PersistentFlags().Lookup("port"))
	viper.SetDefault("nessusLocation.port", "8834")
	viper.BindPFlag("debug", RootCmd.PersistentFlags().Lookup("debug"))
	viper.SetDefault("debug", "8834")
}
Exemplo n.º 15
0
func init() {
	flags := app.PersistentFlags()
	flags.BoolVarP(&boolVerbose, "verbose", "V", false, "Print verbose messages")
	flags.BoolVarP(&boolDebug, "debug", "D", false, "Print debug messages")

	cobra.OnInitialize(Initialize)
}
Exemplo n.º 16
0
func init() {
	initFlags(context)

	cobra.OnInitialize(func() {
		if context.EphemeralSingleNode {
			context.Insecure = true
			if len(context.JoinUsing) != 0 {
				log.Errorf("--join cannot be specified when running a node in dev mode (--dev)")
				os.Exit(1)
			}
			fmt.Printf(`
****
**
** This node is being run in DEVELOPMENT mode.
**
** All data is ephemeral, and there is no security.
**
****

`)
		}
		context.Addr = net.JoinHostPort(connHost, connPort)
		context.PGAddr = net.JoinHostPort(connHost, connPGPort)
	})
}
Exemplo n.º 17
0
Arquivo: root.go Projeto: yukimemi/gfi
func init() {
	cobra.OnInitialize(initConfig)

	// Here you will define your flags and configuration settings.
	// Cobra supports Persistent Flags, which, if defined here,
	// will be global for your application.
	RootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.gfi.yaml)")

	// Get command info.
	ci, err = core.GetCmdInfo(os.Args[0])
	if err != nil {
		log.Fatalln(err)
	}

	// Output csv path.
	csvPath := filepath.Join(ci.Cwd, time.Now().Format("20060102-150405.000")+".csv")
	RootCmd.PersistentFlags().StringVarP(&out, "out", "o", csvPath, "Csv output path")
	// Verbose flag.
	RootCmd.PersistentFlags().BoolVarP(&silent, "silent", "S", false, "Print no count")
	// File only flag.
	RootCmd.PersistentFlags().BoolVarP(&fileOnly, "file", "f", false, "Get information file only")
	// Directory only flag.
	RootCmd.PersistentFlags().BoolVarP(&dirOnly, "dir", "d", false, "Get information directory only")
	// Whether output csv in ShiftJIS encoding.
	RootCmd.PersistentFlags().BoolVarP(&sjisOut, "sjisout", "j", false, "Output csv in ShiftJIS encoding")
	// Matches list.
	RootCmd.PersistentFlags().StringArrayVarP(&matches, "match", "m", nil, "Match list (Regexp)")
	// Ignores list.
	RootCmd.PersistentFlags().StringArrayVarP(&ignores, "ignore", "i", nil, "Ignore list (Regexp)")

	// log setting.
	log.SetFlags(log.Lshortfile)
}
Exemplo n.º 18
0
func init() {
	cobra.OnInitialize(initConfig)
	// Default configuration can be overrided
	RootCmd.PersistentFlags().StringVar(&config.ConfigFile, "config", "", "Config file (default is $HOME/.subify.json). Build a file like this to change default behaviour")
	RootCmd.PersistentFlags().BoolVarP(&config.Verbose, "verbose", "v", false, "Print more information while executing")
	RootCmd.PersistentFlags().BoolVarP(&config.Dev, "dev", "", false, "Instanciate development sandbox instead of production variables")

}
Exemplo n.º 19
0
Arquivo: root.go Projeto: pzurek/stalk
func init() {
	cobra.OnInitialize(initConfig)

	RootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.stalk/config.yaml)")
	RootCmd.PersistentFlags().StringVar(&clearbitKey, "key", "", "ClearBit API key")

	RootCmd.Flags().StringP("email", "e", "*****@*****.**", "Email of the person to find")
}
Exemplo n.º 20
0
Arquivo: rex.go Projeto: beanworks/rex
func init() {
	cobra.OnInitialize(initConfig)

	RexCmd.PersistentFlags().StringVarP(&CfgFile, "config", "c", "", "config file (default is $HOME/.rex.yml)")
	RexCmd.Flags().BoolVarP(&Version, "version", "v", false, "Show rex version")

	RexCmd.Flags().SetAnnotation("config", cobra.BashCompFilenameExt, []string{"yaml", "yml"})
}
Exemplo n.º 21
0
func init() {
	cobra.OnInitialize(initConfig)

	RootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.dingo-hunter.yaml)")
	RootCmd.PersistentFlags().StringVar(&logFile, "log", "", "path to log file (default is stdout)")
	RootCmd.PersistentFlags().BoolVar(&noLogging, "no-logging", false, "disable logging")
	RootCmd.PersistentFlags().BoolVar(&noColour, "no-colour", false, "disable colour output")
}
Exemplo n.º 22
0
func init() {
	cobra.OnInitialize(judgeVerbose)

	// Here you will define your flags and configuration settings.
	// Cobra supports Persistent Flags, which, if defined here,
	// will be global for your application.
	RootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Set verbose mode")
}
Exemplo n.º 23
0
func init() {
	cobra.OnInitialize(initConfig)

	viper.SetDefault("subject", "Feeds powered by feedmailer")
	viper.SetDefault("feeds", []string{"http://spf13.com/index.xml"})
	viper.SetDefault("data_dir", defaultDataDir)

	RootCmd.PersistentFlags().StringVar(&CfgFile, "config", "", "config file (default is "+defaultDataDir+"/config.yml)")
}
Exemplo n.º 24
0
func init() {
	initFlags(context)

	cobra.OnInitialize(func() {
		if context.EphemeralSingleNode {
			context.Insecure = true
		}
	})
}
Exemplo n.º 25
0
func init() {
	cobra.OnInitialize(initConfig)

	// Here you will define your flags and configuration settings.
	// Cobra supports Persistent Flags, which, if defined here,
	// will be global for your application.

	RootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.recipe.yaml)")
}
Exemplo n.º 26
0
func init() {
	cobra.OnInitialize(initConfig)
	RootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.conduit.yaml)")
	RootCmd.PersistentFlags().Bool("slave", false, "run in slave mode")
	RootCmd.PersistentFlags().Int("port", 3111,
		"the port to use for master/save operations")
	RootCmd.PersistentFlags().String("key", "", "AWS Access ID.")
	RootCmd.PersistentFlags().String("secret", "", "AWS secret token")
}
Exemplo n.º 27
0
// init prepares cobra flags
func init() {
	cobra.OnInitialize(initConfig)

	Promu.PersistentFlags().StringVar(&cfgFile, "config", "", "Config file (default is ./.promu.yml)")
	Promu.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Verbose output")
	Promu.PersistentFlags().BoolVar(&useViper, "viper", true, "Use Viper for configuration")

	viper.BindPFlag("useViper", Promu.PersistentFlags().Lookup("viper"))
	viper.BindPFlag("verbose", Promu.PersistentFlags().Lookup("verbose"))
}
Exemplo n.º 28
0
Arquivo: root.go Projeto: garthk/nag
func init() {
	cobra.OnInitialize(initConfig)

	RootCmd.PersistentFlags().StringVarP(&cfgFile, "config", "", "", "config file (default is $HOME/.nag.yaml)")
	RootCmd.PersistentFlags().StringVarP(&nrpeCfgFile, "nrpe-cfg", "c", defaultNrpeCfgFile(), "NRPE config file")
	RootCmd.PersistentFlags().BoolP("critical-warnings", "W", false, "Upgrade WARNING to CRITICAL")
	RootCmd.PersistentFlags().BoolP("critical-unknowns", "U", false, "Upgrade UNKNOWN to CRITICAL")
	RootCmd.PersistentFlags().BoolP("critical-excess", "X", false, "Upgrade excess (>3) exit status to CRITICAL")
	RootCmd.PersistentFlags().BoolP("tolerant", "x", false, "Pass excess (>3) exit status as-is, not as UNKNOWN")
}
Exemplo n.º 29
0
Arquivo: root.go Projeto: Luit/rcp
func init() {
	cobra.OnInitialize(initConfig)
	rootCmd.PersistentFlags().StringVarP(&cfgFile, "config", "c", "", "config file (default is $HOME/.rcp.yaml)")

	rootCmd.PersistentFlags().IPP("bind", "b", net.IPv4(127, 0, 0, 1), "IP address to bind to")
	viper.BindPFlag("bind", rootCmd.PersistentFlags().Lookup("bind"))

	rootCmd.PersistentFlags().IntP("port", "p", 6379, "Port to listen on")
	viper.BindPFlag("port", rootCmd.PersistentFlags().Lookup("port"))
}
Exemplo n.º 30
0
func init() {
	cobra.OnInitialize(initConfig)

	RootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.ata.yaml)")

	// add flags for debug & verbose modes
	RootCmd.PersistentFlags().BoolVarP(&DebugMode, "debug", "d", false, "activate debug mode")
	RootCmd.PersistentFlags().BoolVarP(&VerboseMode, "verbose", "v", false, "prints more output")
	RootCmd.PersistentFlags().StringVarP(&WorkDirectory, "work-directory", "w", ".", "defines work directory")
}