Add shorthands for --url, --user, --password and --insecure flags

This commit is contained in:
Juan Carlos Mejías Rodríguez 2019-07-23 20:42:23 -04:00
parent 44319f3655
commit 35a0d089cb
2 changed files with 5 additions and 8 deletions

View File

@ -40,10 +40,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed ### Changed
- Single executable binary instead of a bash script. Project has been rewritten in Go language. - Single executable binary instead of a bash script. Project has been rewritten in Go language.
- No external programs (bash, httpie, jq) dependency. The new executable binary is self-sufficient. - No external programs (bash, httpie, jq) dependency. The new executable binary is self-sufficient.
- `-u` global flag renamed to `--user`. - `-s` global flag renamed to `-i`. It does not receive a value anymore, it is a boolean flag.
- `-p` global flag renamed to `--password`.
- `-l` global flag renamed to `--url`.
- `-s` global flag renamed to `--insecure`. It does not receive a value anymore, it is a boolean flag.
- `-v` global flag renamed to `-v, --verbose`. It does not receive a value anymore, it is a boolean flag. - `-v` global flag renamed to `-v, --verbose`. It does not receive a value anymore, it is a boolean flag.
- `-d` global flag renamed to `-d, --debug`. It does not receive a value anymore, it is a boolean flag. - `-d` global flag renamed to `-d, --debug`. It does not receive a value anymore, it is a boolean flag.
- `-n` global flag moved as a parameter to the `stack deploy` command. - `-n` global flag moved as a parameter to the `stack deploy` command.

View File

@ -40,10 +40,10 @@ func init() {
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.psu.yaml)") rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.psu.yaml)")
rootCmd.PersistentFlags().BoolP("verbose", "v", false, "verbose mode") rootCmd.PersistentFlags().BoolP("verbose", "v", false, "verbose mode")
rootCmd.PersistentFlags().BoolP("debug", "d", false, "debug mode") rootCmd.PersistentFlags().BoolP("debug", "d", false, "debug mode")
rootCmd.PersistentFlags().Bool("insecure", false, "skip Portainer SSL certificate verification") rootCmd.PersistentFlags().BoolP("insecure", "i", false, "skip Portainer SSL certificate verification")
rootCmd.PersistentFlags().String("url", "", "Portainer url") rootCmd.PersistentFlags().StringP("url", "l", "", "Portainer url")
rootCmd.PersistentFlags().String("user", "", "Portainer user") rootCmd.PersistentFlags().StringP("user", "u", "", "Portainer user")
rootCmd.PersistentFlags().String("password", "", "Portainer password") rootCmd.PersistentFlags().StringP("password", "p", "", "Portainer password")
rootCmd.PersistentFlags().DurationP("timeout", "t", 0, "waiting time before aborting (like 100ms, 30s, 1h20m)") rootCmd.PersistentFlags().DurationP("timeout", "t", 0, "waiting time before aborting (like 100ms, 30s, 1h20m)")
viper.BindPFlag("config", rootCmd.PersistentFlags().Lookup("config")) viper.BindPFlag("config", rootCmd.PersistentFlags().Lookup("config"))
viper.BindPFlag("verbose", rootCmd.PersistentFlags().Lookup("verbose")) viper.BindPFlag("verbose", rootCmd.PersistentFlags().Lookup("verbose"))