From 8736395bcc887266efc10d22a7361153bb4fdfc8 Mon Sep 17 00:00:00 2001 From: Navid Shaikh Date: Mon, 8 Apr 2019 23:21:03 +0530 Subject: [PATCH] Adds example usage in service create command (#62) * Adds example usage in service create command Fixes #61 Adds two examples to service create command as below ``` Examples: kn service create mysvc --image dev.local/ns/image:latest kn service create mysvc --env KEY1=VALUE1 --env KEY2=VALUE2 --image dev.local/ns/image:latest ``` * Adds double spaces in the example text Adding double spaces to properly aligns the example text while displaying help. --- pkg/kn/commands/service_create.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/kn/commands/service_create.go b/pkg/kn/commands/service_create.go index 16ef9a096..3069fc293 100644 --- a/pkg/kn/commands/service_create.go +++ b/pkg/kn/commands/service_create.go @@ -31,6 +31,13 @@ func NewServiceCreateCommand(p *KnParams) *cobra.Command { serviceCreateCommand := &cobra.Command{ Use: "create NAME --image IMAGE", Short: "Create a service.", + Example: ` + # Create a service 'mysvc' using image at dev.local/ns/image:latest + kn service create mysvc --image dev.local/ns/image:latest + + # Create a service with multiple environment variables + kn service create mysvc --env KEY1=VALUE1 --env KEY2=VALUE2 --image dev.local/ns/image:latest`, + RunE: func(cmd *cobra.Command, args []string) (err error) { if len(args) != 1 { return errors.New("requires the service name.")