From 7a6e33776f1c2251eb3bc86b90d8d2f87e8c1694 Mon Sep 17 00:00:00 2001 From: Roland Schilter <roli@weave.works> Date: Wed, 14 Feb 2018 10:44:38 -0800 Subject: [PATCH 1/3] Update CLI help for new namespace:kind/name format --- cmd/fluxctl/automate_cmd.go | 2 +- cmd/fluxctl/deautomate_cmd.go | 2 +- cmd/fluxctl/lock_cmd.go | 2 +- cmd/fluxctl/policy_cmd.go | 8 ++++---- cmd/fluxctl/release_cmd.go | 4 ++-- cmd/fluxctl/root_cmd.go | 6 +++--- cmd/fluxctl/unlock_cmd.go | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/cmd/fluxctl/automate_cmd.go b/cmd/fluxctl/automate_cmd.go index 2142974fe..573322720 100644 --- a/cmd/fluxctl/automate_cmd.go +++ b/cmd/fluxctl/automate_cmd.go @@ -26,7 +26,7 @@ func (opts *controllerAutomateOpts) Command() *cobra.Command { Use: "automate", Short: "Turn on automatic deployment for a controller.", Example: makeExample( - "fluxctl automate --controller=deployment/helloworld", + "fluxctl automate --controller=default:deployment/helloworld", ), RunE: opts.RunE, } diff --git a/cmd/fluxctl/deautomate_cmd.go b/cmd/fluxctl/deautomate_cmd.go index 64e4b0d25..65b048c72 100644 --- a/cmd/fluxctl/deautomate_cmd.go +++ b/cmd/fluxctl/deautomate_cmd.go @@ -26,7 +26,7 @@ func (opts *controllerDeautomateOpts) Command() *cobra.Command { Use: "deautomate", Short: "Turn off automatic deployment for a controller.", Example: makeExample( - "fluxctl deautomate --controller=deployment/helloworld", + "fluxctl deautomate --controller=default:deployment/helloworld", ), RunE: opts.RunE, } diff --git a/cmd/fluxctl/lock_cmd.go b/cmd/fluxctl/lock_cmd.go index 37ed58fe9..8482ffd36 100644 --- a/cmd/fluxctl/lock_cmd.go +++ b/cmd/fluxctl/lock_cmd.go @@ -26,7 +26,7 @@ func (opts *controllerLockOpts) Command() *cobra.Command { Use: "lock", Short: "Lock a controller, so it cannot be deployed.", Example: makeExample( - "fluxctl lock --controller=deployment/helloworld", + "fluxctl lock --controller=default:deployment/helloworld", ), RunE: opts.RunE, } diff --git a/cmd/fluxctl/policy_cmd.go b/cmd/fluxctl/policy_cmd.go index c9741ceb2..894ea2ac1 100644 --- a/cmd/fluxctl/policy_cmd.go +++ b/cmd/fluxctl/policy_cmd.go @@ -48,10 +48,10 @@ If both --tag-all and --tag are specified, --tag-all will apply to all containers which aren't explicitly named. `, Example: makeExample( - "fluxctl policy --controller=deployment/foo --automate", - "fluxctl policy --controller=deployment/foo --lock", - "fluxctl policy --controller=deployment/foo --tag='bar=1.*' --tag='baz=2.*'", - "fluxctl policy --controller=deployment/foo --tag-all='master-*' --tag='bar=1.*'", + "fluxctl policy --controller=default:deployment/foo --automate", + "fluxctl policy --controller=default:deployment/foo --lock", + "fluxctl policy --controller=default:deployment/foo --tag='bar=1.*' --tag='baz=2.*'", + "fluxctl policy --controller=default:deployment/foo --tag-all='master-*' --tag='bar=1.*'", ), RunE: opts.RunE, } diff --git a/cmd/fluxctl/release_cmd.go b/cmd/fluxctl/release_cmd.go index b8c945960..f10092b63 100644 --- a/cmd/fluxctl/release_cmd.go +++ b/cmd/fluxctl/release_cmd.go @@ -45,11 +45,11 @@ func (opts *controllerReleaseOpts) Command() *cobra.Command { AddOutputFlags(cmd, &opts.outputOpts) AddCauseFlags(cmd, &opts.cause) cmd.Flags().StringVarP(&opts.namespace, "namespace", "n", "default", "controller namespace") - cmd.Flags().StringSliceVarP(&opts.controllers, "controller", "c", []string{}, "list of controllers to release <kind>/<name>") + cmd.Flags().StringSliceVarP(&opts.controllers, "controller", "c", []string{}, "list of controllers to release <namespace>:<kind>/<name>") cmd.Flags().BoolVar(&opts.allControllers, "all", false, "release all controllers") cmd.Flags().StringVarP(&opts.image, "update-image", "i", "", "update a specific image") cmd.Flags().BoolVar(&opts.allImages, "update-all-images", false, "update all images to latest versions") - cmd.Flags().StringSliceVar(&opts.exclude, "exclude", []string{}, "exclude a controller") + cmd.Flags().StringSliceVar(&opts.exclude, "exclude", []string{}, "list of controllers to exclude <namespace>:<kind>/<name>") cmd.Flags().BoolVar(&opts.dryRun, "dry-run", false, "do not release anything; just report back what would have been done") // Deprecated diff --git a/cmd/fluxctl/root_cmd.go b/cmd/fluxctl/root_cmd.go index f53cc18c7..cbb6bdbb3 100644 --- a/cmd/fluxctl/root_cmd.go +++ b/cmd/fluxctl/root_cmd.go @@ -31,9 +31,9 @@ var rootLongHelp = strings.TrimSpace(` fluxctl helps you deploy your code. Workflow: - fluxctl list-controllers # Which controllers are running? - fluxctl list-images --controller=deployment/foo # Which images are running/available? - fluxctl release --controller=deployment/foo --update-image=bar:v2 # Release new version. + fluxctl list-controllers # Which controllers are running? + fluxctl list-images --controller=default:deployment/foo # Which images are running/available? + fluxctl release --controller=default:deployment/foo --update-image=bar:v2 # Release new version. `) const ( diff --git a/cmd/fluxctl/unlock_cmd.go b/cmd/fluxctl/unlock_cmd.go index 36ac7fa1d..497862abd 100644 --- a/cmd/fluxctl/unlock_cmd.go +++ b/cmd/fluxctl/unlock_cmd.go @@ -26,7 +26,7 @@ func (opts *controllerUnlockOpts) Command() *cobra.Command { Use: "unlock", Short: "Unlock a controller, so it can be deployed.", Example: makeExample( - "fluxctl unlock --controller=deployment/helloworld", + "fluxctl unlock --controller=default:deployment/helloworld", ), RunE: opts.RunE, } From 23f498d5e8ee5dbe8b5a7669bdfcbb10fa38fb94 Mon Sep 17 00:00:00 2001 From: Roland Schilter <roli@weave.works> Date: Wed, 14 Feb 2018 14:38:23 -0800 Subject: [PATCH 2/3] ReleaseKindExecute should be a ReleaseKind and not a string I presume? --- update/release.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update/release.go b/update/release.go index 354f9518b..b7c30043a 100644 --- a/update/release.go +++ b/update/release.go @@ -29,7 +29,7 @@ type ReleaseType string const ( ReleaseKindPlan ReleaseKind = "plan" - ReleaseKindExecute = "execute" + ReleaseKindExecute ReleaseKind = "execute" ) func ParseReleaseKind(s string) (ReleaseKind, error) { From f6627cdcfc1f3d175a2b787fdcaa0cd5fe37fb26 Mon Sep 17 00:00:00 2001 From: Roland Schilter <roli@weave.works> Date: Wed, 14 Feb 2018 14:48:01 -0800 Subject: [PATCH 3/3] Consistently uppercase descriptions --- cmd/fluxctl/release_cmd.go | 16 ++++++++-------- cmd/fluxctl/root_cmd.go | 2 +- cmd/fluxctl/save_cmd.go | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cmd/fluxctl/release_cmd.go b/cmd/fluxctl/release_cmd.go index f10092b63..60ac932ee 100644 --- a/cmd/fluxctl/release_cmd.go +++ b/cmd/fluxctl/release_cmd.go @@ -44,16 +44,16 @@ func (opts *controllerReleaseOpts) Command() *cobra.Command { AddOutputFlags(cmd, &opts.outputOpts) AddCauseFlags(cmd, &opts.cause) - cmd.Flags().StringVarP(&opts.namespace, "namespace", "n", "default", "controller namespace") - cmd.Flags().StringSliceVarP(&opts.controllers, "controller", "c", []string{}, "list of controllers to release <namespace>:<kind>/<name>") - cmd.Flags().BoolVar(&opts.allControllers, "all", false, "release all controllers") - cmd.Flags().StringVarP(&opts.image, "update-image", "i", "", "update a specific image") - cmd.Flags().BoolVar(&opts.allImages, "update-all-images", false, "update all images to latest versions") - cmd.Flags().StringSliceVar(&opts.exclude, "exclude", []string{}, "list of controllers to exclude <namespace>:<kind>/<name>") - cmd.Flags().BoolVar(&opts.dryRun, "dry-run", false, "do not release anything; just report back what would have been done") + cmd.Flags().StringVarP(&opts.namespace, "namespace", "n", "default", "Controller namespace") + cmd.Flags().StringSliceVarP(&opts.controllers, "controller", "c", []string{}, "List of controllers to release <namespace>:<kind>/<name>") + cmd.Flags().BoolVar(&opts.allControllers, "all", false, "Release all controllers") + cmd.Flags().StringVarP(&opts.image, "update-image", "i", "", "Update a specific image") + cmd.Flags().BoolVar(&opts.allImages, "update-all-images", false, "Update all images to latest versions") + cmd.Flags().StringSliceVar(&opts.exclude, "exclude", []string{}, "List of controllers to exclude") + cmd.Flags().BoolVar(&opts.dryRun, "dry-run", false, "Do not release anything; just report back what would have been done") // Deprecated - cmd.Flags().StringSliceVarP(&opts.services, "service", "s", []string{}, "service to release") + cmd.Flags().StringSliceVarP(&opts.services, "service", "s", []string{}, "Service to release") cmd.Flags().MarkHidden("service") return cmd diff --git a/cmd/fluxctl/root_cmd.go b/cmd/fluxctl/root_cmd.go index cbb6bdbb3..a96aeb8dd 100644 --- a/cmd/fluxctl/root_cmd.go +++ b/cmd/fluxctl/root_cmd.go @@ -51,7 +51,7 @@ func (opts *rootOpts) Command() *cobra.Command { PersistentPreRunE: opts.PersistentPreRunE, } cmd.PersistentFlags().StringVarP(&opts.URL, "url", "u", "https://cloud.weave.works/api/flux", - fmt.Sprintf("base URL of the flux service; you can also set the environment variable %s", envVariableURL)) + fmt.Sprintf("Base URL of the flux service; you can also set the environment variable %s", envVariableURL)) cmd.PersistentFlags().StringVarP(&opts.Token, "token", "t", "", fmt.Sprintf("Weave Cloud service token; you can also set the environment variable %s or %s", envVariableCloudToken, envVariableToken)) diff --git a/cmd/fluxctl/save_cmd.go b/cmd/fluxctl/save_cmd.go index c1a7cc790..2b451d056 100644 --- a/cmd/fluxctl/save_cmd.go +++ b/cmd/fluxctl/save_cmd.go @@ -32,7 +32,7 @@ func (opts *saveOpts) Command() *cobra.Command { ), RunE: opts.RunE, } - cmd.Flags().StringVarP(&opts.path, "out", "o", "-", "output path for exported config; the default. '-' indicates stdout; if a directory is given, each item will be saved in a file under the directory") + cmd.Flags().StringVarP(&opts.path, "out", "o", "-", "Output path for exported config; the default. '-' indicates stdout; if a directory is given, each item will be saved in a file under the directory") return cmd }