From 35a0d089cba041d89b4fc7dc58d84a9dc44ee002 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Carlos=20Mej=C3=ADas=20Rodr=C3=ADguez?= Date: Tue, 23 Jul 2019 20:42:23 -0400 Subject: [PATCH] Add shorthands for --url, --user, --password and --insecure flags --- CHANGELOG.md | 5 +---- cmd/root.go | 8 ++++---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d2f5d1..0097d0f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,10 +40,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - 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. -- `-u` global flag renamed to `--user`. -- `-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. +- `-s` global flag renamed to `-i`. 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. - `-n` global flag moved as a parameter to the `stack deploy` command. diff --git a/cmd/root.go b/cmd/root.go index d92e04f..c1b7912 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -40,10 +40,10 @@ func init() { rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.psu.yaml)") rootCmd.PersistentFlags().BoolP("verbose", "v", false, "verbose mode") rootCmd.PersistentFlags().BoolP("debug", "d", false, "debug mode") - rootCmd.PersistentFlags().Bool("insecure", false, "skip Portainer SSL certificate verification") - rootCmd.PersistentFlags().String("url", "", "Portainer url") - rootCmd.PersistentFlags().String("user", "", "Portainer user") - rootCmd.PersistentFlags().String("password", "", "Portainer password") + rootCmd.PersistentFlags().BoolP("insecure", "i", false, "skip Portainer SSL certificate verification") + rootCmd.PersistentFlags().StringP("url", "l", "", "Portainer url") + rootCmd.PersistentFlags().StringP("user", "u", "", "Portainer user") + rootCmd.PersistentFlags().StringP("password", "p", "", "Portainer password") rootCmd.PersistentFlags().DurationP("timeout", "t", 0, "waiting time before aborting (like 100ms, 30s, 1h20m)") viper.BindPFlag("config", rootCmd.PersistentFlags().Lookup("config")) viper.BindPFlag("verbose", rootCmd.PersistentFlags().Lookup("verbose"))