Skip to content

Commit

Permalink
Improve get/stat/tap help text by way of examples (#401)
Browse files Browse the repository at this point in the history
Signed-off-by: Kevin Lingerfelt <[email protected]>
  • Loading branch information
klingerf authored Feb 21, 2018
1 parent 236f71f commit c579a8f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
7 changes: 4 additions & 3 deletions cli/cmd/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ import (
)

var getCmd = &cobra.Command{
Use: "get [flags] RESOURCE",
Use: "get [flags] pods",
Short: "Display one or many mesh resources",
Long: `Display one or many mesh resources.
Valid resource types include:
* pods (aka pod, po)`,
Only pod resources (aka pods, po) are supported.`,
Example: ` # get all pods
conduit get pods`,
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) < 1 {
return errors.New("please specify a resource type")
Expand Down
14 changes: 9 additions & 5 deletions cli/cmd/stat.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,18 @@ var target string
var timeWindow string

var statCmd = &cobra.Command{
Use: "stat [flags] RESOURCE [TARGET]",
Use: "stat [flags] deployment [TARGET]",
Short: "Display runtime statistics about mesh resources",
Long: `Display runtime statistics about mesh resources.
Valid resource types include:
* deployments (aka deployment, deploy)
Only deployment resources (aka deployments, deploy) are supported.
The optional [TARGET] option can be a name for a deployment.`,
The optional [TARGET] argument can be used to target a specific deployment.`,
Example: ` # get stats for all deployments
conduit stat deployments
# get stats for the web deployment in the default namespace
conduit stat deploy default/web`,
RunE: func(cmd *cobra.Command, args []string) error {
var friendlyNameForResourceType string

Expand All @@ -39,7 +43,7 @@ The optional [TARGET] option can be a name for a deployment.`,
friendlyNameForResourceType = args[0]
target = args[1]
default:
return errors.New("please specify a resource type: deployments")
return errors.New("please specify a resource type")
}

validatedResourceType, err := k8s.CanonicalKubernetesNameFromFriendlyName(friendlyNameForResourceType)
Expand Down
12 changes: 9 additions & 3 deletions cli/cmd/tap.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,15 @@ var tapCmd = &cobra.Command{
Short: "Listen to a traffic stream",
Long: `Listen to a traffic stream.
Valid targets include:
* Pods (default/hello-world-h4fb2)
* Deployments (default/hello-world)`,
Only deployment resources (aka deployments, deploy) and pod resources
(aka pods, po) are supported.
The TARGET argument is used to specify the pod or deployment to tap.`,
Example: ` # tap the web deployment in the default namespace
conduit tap deploy default/web
# tap the web-dlbvj pod in the default namespace
conduit tap pod default/web-dlbvj`,
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) != 2 {
return errors.New("please specify a resource type and target")
Expand Down

0 comments on commit c579a8f

Please sign in to comment.