Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add shorthand flags to CLI #2479

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ $ yopass --help
Yopass - Secure sharing for secrets, passwords and files

Flags:
--api string Yopass API server location (default "https://api.yopass.se")
--decrypt string Decrypt secret URL
--expiration string Duration after which secret will be deleted [1h, 1d, 1w] (default "1h")
--file string Read secret from file instead of stdin
--key string Manual encryption/decryption key
--one-time One-time download (default true)
--url string Yopass public URL (default "https://yopass.se")
-a, --api string Yopass API server location (default "https://api.yopass.se")
-d, --decrypt string Decrypt secret URL
-e, --expiration string Duration after which secret will be deleted [1h, 1d, 1w] (default "1h")
-f, --file string Read secret from file instead of stdin
-k, --key string Manual encryption/decryption key
-1, --one-time One-time download (default true)
-u, --url string Yopass public URL (default "https://yopass.se")

Settings are read from flags, environment variables, or a config file located at
~/.config/yopass/defaults.<json,toml,yml,hcl,ini,...> in this order. Environment
Expand Down
14 changes: 7 additions & 7 deletions cmd/yopass/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ func init() {

// Command-line flags
pflag.CommandLine = pflag.NewFlagSet(os.Args[0], pflag.ContinueOnError)
pflag.String("api", viper.GetString("api"), "Yopass API server location")
pflag.String("decrypt", viper.GetString("decrypt"), "Decrypt secret URL")
pflag.String("expiration", viper.GetString("expiration"), "Duration after which secret will be deleted [1h, 1d, 1w]")
pflag.String("file", viper.GetString("file"), "Read secret from file instead of stdin")
pflag.String("key", viper.GetString("key"), "Manual encryption/decryption key")
pflag.Bool("one-time", viper.GetBool("one-time"), "One-time download")
pflag.String("url", viper.GetString("url"), "Yopass public URL")
pflag.StringP("api", "a", viper.GetString("api"), "Yopass API server location")
pflag.StringP("decrypt", "d", viper.GetString("decrypt"), "Decrypt secret URL")
pflag.StringP("expiration", "e", viper.GetString("expiration"), "Duration after which secret will be deleted [1h, 1d, 1w]")
pflag.StringP("file", "f", viper.GetString("file"), "Read secret from file instead of stdin")
pflag.StringP("key", "k", viper.GetString("key"), "Manual encryption/decryption key")
pflag.BoolP("one-time", "1", viper.GetBool("one-time"), "One-time download")
pflag.StringP("url", "u", viper.GetString("url"), "Yopass public URL")
viper.BindPFlags(pflag.CommandLine)
}

Expand Down