Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kubectl should print usage at the bottom #25640

Merged
merged 1 commit into from
Jul 7, 2016

Conversation

dims
Copy link
Member

@dims dims commented May 16, 2016

Override the Usage: output using SetUsageTemplate. Just moved
the strings in the template to make sure we print Usage: at
the bottom of the output and not at the top.

Fixes issue #7496

@k8s-bot
Copy link

k8s-bot commented May 16, 2016

Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test".
(Note: "add to whitelist" is no longer supported. Please update configurations in kubernetes/test-infra/jenkins/job-configs/kubernetes-jenkins-pull instead.)

This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry.

Otherwise, if this message is too spammy, please complain to ixdy.

2 similar comments
@k8s-bot
Copy link

k8s-bot commented May 16, 2016

Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test".
(Note: "add to whitelist" is no longer supported. Please update configurations in kubernetes/test-infra/jenkins/job-configs/kubernetes-jenkins-pull instead.)

This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry.

Otherwise, if this message is too spammy, please complain to ixdy.

@k8s-bot
Copy link

k8s-bot commented May 16, 2016

Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test".
(Note: "add to whitelist" is no longer supported. Please update configurations in kubernetes/test-infra/jenkins/job-configs/kubernetes-jenkins-pull instead.)

This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry.

Otherwise, if this message is too spammy, please complain to ixdy.

@k8s-github-robot k8s-github-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. release-note-label-needed labels May 16, 2016
@janetkuo
Copy link
Member

@kubernetes/kubectl

@janetkuo
Copy link
Member

ok to test

@dims
Copy link
Member Author

dims commented May 17, 2016

@janetkuo thanks for helping with this. looks like it's ready to merge.

@janetkuo janetkuo added ok-to-merge release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed needs-ok-to-merge labels May 18, 2016
@janetkuo
Copy link
Member

janetkuo commented May 18, 2016

There are redundant newlines between command description and aliases. Would you fix the template to show only one newline?

$ kubectl clusterinfo -h 
Display addresses of the master and services with label kubernetes.io/cluster-service=true



Aliases:
  cluster-info, clusterinfo

@dims dims force-pushed the fix-issue-7496 branch from 9a10b28 to 3ad0854 Compare May 18, 2016 20:40
@dims
Copy link
Member Author

dims commented May 18, 2016

@janetkuo Done. thanks!

@janetkuo
Copy link
Member

There are redundant newlines when aliases aren't shown. Fix them and then this LGTM.

$ kubectl get -h 
Display one or many resources.

Possible resource types include (case insensitive): pods (po), services (svc), deployments,
replicasets (rs), replicationcontrollers (rc), nodes (no), events (ev), limitranges (limits),
persistentvolumes (pv), persistentvolumeclaims (pvc), resourcequotas (quota), namespaces (ns),
serviceaccounts (sa), ingresses (ing), horizontalpodautoscalers (hpa), daemonsets (ds), configmaps,
componentstatuses (cs), endpoints (ep), and secrets.

By specifying the output as 'template' and providing a Go template as the value
of the --template flag, you can filter the attributes of the fetched resource(s).



Examples:
...

@dims dims force-pushed the fix-issue-7496 branch from 3ad0854 to 30054ee Compare May 20, 2016 11:53
@dims
Copy link
Member Author

dims commented May 20, 2016

Thanks @janetkuo hopefully fixed :)

@janetkuo
Copy link
Member

Sub-commands are missing:

$ kubectl set -h 
Configure application resources

These commands help you make changes to existing application resources.



Global Flags:
...

should be

$ kubectl set -h 
Configure application resources

These commands help you make changes to existing application resources.

Usage:
  kubectl set SUBCOMMAND [flags]
  kubectl set [command]

Available Commands:
  image       Update image of a pod template

Global Flags:
...

@dims dims force-pushed the fix-issue-7496 branch from 30054ee to aba778e Compare May 21, 2016 00:57
@dims
Copy link
Member Author

dims commented May 21, 2016

@janetkuo thanks for your patience, here's the output from 4 commands

kubectl clusterinfo -h > out.txt 2>&1
kubectl get -h >> out.txt 2>&1
kubectl set -h >> out.txt 2>&1
kubectl create -h >> out.txt 2>&1

Output from Master : http://paste.openstack.org/show/497959/
Output after applying fix : http://paste.openstack.org/show/497960/

@janetkuo
Copy link
Member

janetkuo commented May 26, 2016

Sorry for the late reply. I found that we missed 2 newlines between Exampes and Available Commands:

$ kubectl create -h 
Create a resource by filename or stdin.

JSON and YAML formats are accepted.

Examples:
# Create a pod using the data in pod.json.
kubectl create -f ./pod.json

# Create a pod based on the JSON passed into stdin.
cat pod.json | kubectl create -f -Available Commands:
  namespace      Create a namespace with the specified name.
  secret         Create a secret using specified subcommand.
  configmap      Create a configMap from a local file, directory or literal value.
  serviceaccount Create a service account with the specified name.

Flags:
   ...
Global Flags:
   ...

Usage:
  kubectl create -f FILENAME [flags]
  kubectl create [command]

Use "kubectl create [command] --help" for more information about a command.

But it makes me think that maybe we should put Available commands right after Usage, since Usage tells you to use sub-commands. cc @kubernetes/kubectl @davidopp

@dims dims force-pushed the fix-issue-7496 branch from aba778e to 9117106 Compare June 3, 2016 19:48
@dims
Copy link
Member Author

dims commented Jun 3, 2016

@janetkuo - tested the following 5 commands. I had to tweak the help template too!

kubectl create -h
kubectl clusterinfo -h
kubectl get -h
kubectl set -h
kubectl create -h

@k8s-github-robot k8s-github-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 3, 2016
@k8s-bot
Copy link

k8s-bot commented Jun 3, 2016

GCE e2e build/test passed for commit 911710687283dcb5375c1884a39ec1094a50c15e.

@k8s-bot
Copy link

k8s-bot commented Jun 10, 2016

Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test".
(Note: "add to whitelist" is no longer supported. Please update configurations in kubernetes/test-infra/jenkins/job-configs/kubernetes-jenkins-pull instead.)

This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry.

Otherwise, if this message is too spammy, please complain to ixdy.

1 similar comment
@k8s-bot
Copy link

k8s-bot commented Jun 15, 2016

Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test".
(Note: "add to whitelist" is no longer supported. Please update configurations in kubernetes/test-infra/jenkins/job-configs/kubernetes-jenkins-pull instead.)

This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry.

Otherwise, if this message is too spammy, please complain to ixdy.

@janetkuo
Copy link
Member

@dims thanks; I want to let you know that this needs to wait until after the 1.3 code freeze ends

@dims
Copy link
Member Author

dims commented Jun 15, 2016

@janetkuo of course. Thanks for all your guidance with this.

@dims dims force-pushed the fix-issue-7496 branch from 9117106 to 4de3f31 Compare June 24, 2016 20:07
@k8s-bot
Copy link

k8s-bot commented Jun 24, 2016

GCE e2e build/test passed for commit 4de3f312309d722bb5a5c573ba834d01fba557c4.

@dims
Copy link
Member Author

dims commented Jun 29, 2016

@janetkuo can you please lgtm this please? (if appropriate)

@k8s-github-robot
Copy link

@dims
You must link to the test flake issue which caused you to request this manual re-test.
Re-test requests should be in the form of: k8s-bot test this issue: #<number>
Here is the list of open test flakes.

1 similar comment
@k8s-github-robot
Copy link

@dims
You must link to the test flake issue which caused you to request this manual re-test.
Re-test requests should be in the form of: k8s-bot test this issue: #<number>
Here is the list of open test flakes.

@k8s-bot
Copy link

k8s-bot commented Jun 29, 2016

GCE e2e build/test passed for commit 4de3f312309d722bb5a5c573ba834d01fba557c4.

Override the Usage: output using SetUsageTemplate. Just moved
the strings in the template to make sure we print Usage: at
the bottom of the output and not at the top.

Fixes issue 7496
@dims dims force-pushed the fix-issue-7496 branch from 4de3f31 to 91f1636 Compare July 5, 2016 14:08
@k8s-bot
Copy link

k8s-bot commented Jul 5, 2016

GCE e2e build/test passed for commit 91f1636.

@dims
Copy link
Member Author

dims commented Jul 6, 2016

@janetkuo ping. this PR is ready again (had slipped 1.3). Thanks in advance!

@janetkuo
Copy link
Member

janetkuo commented Jul 7, 2016

So sorry for the late reply.

There's a redundant newline below Aliases:

$ kubectl cluster-info -h 
Display addresses of the master and services with label kubernetes.io/cluster-service=true
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.

Aliases:
  cluster-info, clusterinfo


Available Commands:

but this problem existed in the old code so fixing it is optional.

Also how do you feel about renaming Available Commands: to something like Available Sub-commands:? It's up to you.

Otherwise this LGTM. Thanks much!

@dims
Copy link
Member Author

dims commented Jul 7, 2016

@janetkuo funny i see that extra line in the current output as well (without my patch)
http://paste.openstack.org/show/526637/

@janetkuo janetkuo added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 7, 2016
@janetkuo
Copy link
Member

janetkuo commented Jul 7, 2016

LGTM as discussed in Slack channel.

@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-bot
Copy link

k8s-bot commented Jul 7, 2016

GCE e2e build/test passed for commit 91f1636.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit 5fe54ac into kubernetes:master Jul 7, 2016
k8s-github-robot pushed a commit that referenced this pull request Jul 8, 2016
Automatic merge from submit-queue

Follow up to PR 25640 - Cleanup newline and tweak help text

Follow up to PR #25640

* Remove redundant newline below Aliases:
* Renaming "Available Commands:" to "Available Sub-commands:"
@dims dims deleted the fix-issue-7496 branch November 16, 2017 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants