From 632ada7cb19cf2b5b82ebfc976f24c64e89c4961 Mon Sep 17 00:00:00 2001 From: Naomi Seyfer Date: Thu, 8 Aug 2019 15:42:11 -0700 Subject: [PATCH] Polsh, remove unused flags, generate helptext, add better helptext --- docs/cmd/kn_service_create.md | 2 +- docs/cmd/kn_service_update.md | 3 +-- pkg/kn/commands/service/configuration_edit_flags.go | 5 ++++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/cmd/kn_service_create.md b/docs/cmd/kn_service_create.md index cda13b4b68..d405b15d04 100644 --- a/docs/cmd/kn_service_create.md +++ b/docs/cmd/kn_service_create.md @@ -54,7 +54,7 @@ kn service create NAME --image IMAGE [flags] -p, --port int32 The port where application listens on. --requests-cpu string The requested CPU (e.g., 250m). --requests-memory string The requested memory (e.g., 64Mi). - --revision-name string The revision name to set. If you don't add the service name as a prefix, it'll be added for you. + --revision-name string The revision name to set. Must start with the service name and a dash as a prefix. Accepts golang templates, allowing {{.Service}} for the service name, {{.Generation}} for the generation, and {{.Random [n]}} for n random consonants. (default "{{.Service}}-{{.Random 5}}-{{.Generation}}") --wait-timeout int Seconds to wait before giving up on waiting for service to be ready. (default 60) ``` diff --git a/docs/cmd/kn_service_update.md b/docs/cmd/kn_service_update.md index b819d1fd7f..9ad414c130 100644 --- a/docs/cmd/kn_service_update.md +++ b/docs/cmd/kn_service_update.md @@ -31,7 +31,6 @@ kn service update NAME [flags] --concurrency-limit int Hard Limit of concurrent requests to be processed by a single replica. --concurrency-target int Recommendation for when to scale up based on the concurrent number of incoming request. Defaults to --concurrency-limit when given. -e, --env stringArray Environment variable to set. NAME=value; you may provide this flag any number of times to set multiple environment variables. - --generate-revision-name Automatically generate a revision name client-side. If false, the revision name is cleared. (default true) -h, --help help for update --image string Image to run. --limits-cpu string The limits on the requested CPU (e.g., 1000m). @@ -42,7 +41,7 @@ kn service update NAME [flags] -p, --port int32 The port where application listens on. --requests-cpu string The requested CPU (e.g., 250m). --requests-memory string The requested memory (e.g., 64Mi). - --revision-name string The revision name to set. If you don't add the service name as a prefix, it'll be added for you. + --revision-name string The revision name to set. Must start with the service name and a dash as a prefix. Accepts golang templates, allowing {{.Service}} for the service name, {{.Generation}} for the generation, and {{.Random [n]}} for n random consonants. (default "{{.Service}}-{{.Random 5}}-{{.Generation}}") --wait-timeout int Seconds to wait before giving up on waiting for service to be ready. (default 60) ``` diff --git a/pkg/kn/commands/service/configuration_edit_flags.go b/pkg/kn/commands/service/configuration_edit_flags.go index 9df77ebe89..b64c3e6a67 100644 --- a/pkg/kn/commands/service/configuration_edit_flags.go +++ b/pkg/kn/commands/service/configuration_edit_flags.go @@ -55,6 +55,7 @@ func (p *ConfigurationEditFlags) markFlagMakesRevision(f string) { p.flags = append(p.flags, f) } +// addSharedFlags adds the flags common between create & update. func (p *ConfigurationEditFlags) addSharedFlags(command *cobra.Command) { command.Flags().StringVar(&p.Image, "image", "", "Image to run.") p.markFlagMakesRevision("image") @@ -85,7 +86,9 @@ func (p *ConfigurationEditFlags) addSharedFlags(command *cobra.Command) { command.Flags().Int32VarP(&p.Port, "port", "p", 0, "The port where application listens on.") p.markFlagMakesRevision("port") command.Flags().StringVar(&p.RevisionName, "revision-name", "{{.Service}}-{{.Random 5}}-{{.Generation}}", - "The revision name to set. If you don't add the service name as a prefix, it'll be added for you.") + "The revision name to set. Must start with the service name and a dash as a prefix. "+ + "Accepts golang templates, allowing {{.Service}} for the service name, "+ + "{{.Generation}} for the generation, and {{.Random [n]}} for n random consonants.") p.markFlagMakesRevision("revision-name") }