command
module
Version:
v0.0.0-...-838b099
Opens a new window with list of versions in this module.
Published: Oct 3, 2023
License: MIT
Opens a new window with license information.
Imports: 5
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
Configurations Loading using Viper and PFlag
An example of using the viper and cobra packages to build a cli program.
The program takes in environment variables, command, command arguments, and pflags with the following pattern.
ENV_NAME=ENV_VALUE APPNAME COMMAND ARG --PFLAG
Setup
-
Build the program.
$ make
-
Run the program
$ bin/cobra
$ # Run the program with help subcommand, we get a help screen with the short descriptor of all commands and pflags.
$ bin/cobra help
-
Try out different arguments.
$ bin/cobra -a localhost:7000 list -lr bucket/folder
list args: bucket/folder
Config: &{localhost:7000 admin password false true true}
$ CY_ADDR=example.com:1234 bin/cobra list -lr bucket/folder
list args: bucket/folder
Config: &{example.com:1234 admin password false true true}
$ CY_ADDR=example.com:1234 bin/cobra -a localhost:7000 list -lr bucket/folder
list args: bucket/folder
Config: &{localhost:7000 admin password false true true}
Reference and Credits
Documentation
¶
There is no documentation for this package.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.