Commit Graph

54 Commits (284e8182a402cfd545fc000fedaea071fed873b0)

Author SHA1 Message Date
David Eads 5432ef5c45 divide statically known typer from dynamically derive restmapper 2018-04-27 11:15:05 -04:00
juanvallejo 6d3652eded remove hardcoded list of resources 2018-04-26 09:31:58 -04:00
David Eads 8c1b687356 update more commands for iostreams 2018-04-25 08:45:15 -04:00
David Eads f01e16bb3e remove flags deprecated in 1.5 2018-04-19 08:08:44 -04:00
Kubernetes Submit Queue 263897a31c
Merge pull request #58420 from kragniz/valid-resource-printing
Automatic merge from submit-queue (batch tested with PRs 58420, 60483). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

kubectl: make error with resource list prettier

**What this PR does / why we need it**:

Previously, running commands like `kubectl get` with no further
arguments would print a list of valid resource types with an error
messages formatted like so:

    <snip>
      * serviceaccounts (aka 'sa')
      * services (aka 'svc')
      * statefulsets (aka 'sts')
      * storageclasses (aka 'sc')error: Required resource not specified.
    Use "kubectl explain <resource>" for a detailed description of that resource (e.g. kubectl explain pods).
    See 'kubectl get -h' for help and examples.

This commit adds extra spacing so it now looks pretty:

    <snip>
      * serviceaccounts (aka 'sa')
      * services (aka 'svc')
      * statefulsets (aka 'sts')
      * storageclasses (aka 'sc')

    error: Required resource not specified.
    Use "kubectl explain <resource>" for a detailed description of that resource (e.g. kubectl explain pods).
    See 'kubectl get -h' for help and examples.





**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-04-04 05:03:05 -07:00
Maciej Szulik c7efab40b6 Fix kubectl explain for cronjobs 2018-01-25 16:10:31 +01:00
Louis Taylor b0f8a541fa
kubectl: make error with resource list prettier
Previously, running commands like `kubectl get` with no further
arguments would print a list of valid resource types with an error
messages formatted like so:

    <snip>
      * serviceaccounts (aka 'sa')
      * services (aka 'svc')
      * statefulsets (aka 'sts')
      * storageclasses (aka 'sc')error: Required resource not specified.
    Use "kubectl explain <resource>" for a detailed description of that resource (e.g. kubectl explain pods).
    See 'kubectl get -h' for help and examples.

This commit adds extra spacing so it now looks pretty:

    <snip>
      * serviceaccounts (aka 'sa')
      * services (aka 'svc')
      * statefulsets (aka 'sts')
      * storageclasses (aka 'sc')

    error: Required resource not specified.
    Use "kubectl explain <resource>" for a detailed description of that resource (e.g. kubectl explain pods).
    See 'kubectl get -h' for help and examples.
2018-01-18 22:19:44 +00:00
Di Xu 1c715d51c4 some code change
fix wrong required flags

disable the addition of [flags] to the usage, use customized useline

fix function rename
2017-12-25 16:23:38 +08:00
Marko Luksa c77d5d0f90 Kubectl explain now also prints the Kind and APIVersion of the resource 2017-11-14 11:05:19 +01:00
Clayton Coleman 93fed120fb
Move printing the valid resource types to a function
Should be calculated from discovery in the future. Also improve
descriptions on the affected commands.
2017-10-30 23:45:45 -04:00
ymqytw 4487cc5e15 switch some commands to use its own scheme 2017-10-27 18:31:42 -07:00
Dr. Stefan Schimanski 7773a30f67 pkg/api/legacyscheme: fixup imports 2017-10-18 17:23:55 +02:00
Antoine Pelisse 249caa95b5 Rewrite `kubectl explain` to use openapi
This removes all dependencies on swagger 1.2 for explain.
2017-10-03 09:44:11 -07:00
Kubernetes Submit Queue 443f7e2af4 Merge pull request #50247 from tcharding/kubectl-explain
Automatic merge from submit-queue (batch tested with PRs 50257, 50247, 50665, 50554, 51077)

Add whitespace to improve error msg clarity

**What this PR does / why we need it**:

Currently when `kubectl explain` is called without a resource the error message is tacked onto the end of the list of valid resources. The error is clearer if there is a new line after the valid resource list, this also causes the error to be left aligned instead of indented level with the valid resource list.

```release-note
NONE
```

/sig cli
/kind cleanup
2017-08-23 02:35:06 -07:00
ymqytw b776df8a20 move i18n to kubectl/util 2017-08-16 12:27:36 -07:00
tcharding 2070b3848e Add whitespace to improve error msg clarity 2017-08-07 17:05:21 +10:00
Alexander Campbell 6fd36c10ad kubectl/cmd: many small refactors
* Rename variables and functions to match Go convention.
   For example, UsageError --> UsageErrorf.
 * Remove redundant or unreachable code.
 * Simplify some utility functions (no functionality changes).
 * Fix hanging 'if { return } else { return }' constructs.
 * Fix several incorrect printf verbs.
2017-06-27 16:25:20 -07:00
xilabao e0b4f3f73c remove --api-version 2017-05-19 10:56:35 +08:00
deads2k edd2d973a3 stop setting bad defaults that are indistinguishable from real values for clients 2017-05-17 07:18:34 -04:00
bruceauyeung ab4029c85b Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn>
rename variables to make sure that they conform to golang variable name convention
2017-04-25 15:07:01 +08:00
Brendan Burns 79f51923d3 Extract a bunch more strings from kubectl 2017-04-06 20:12:50 -07:00
Brendan Burns d9c4a289a6 Extract strings for translation. 2017-02-06 22:32:01 -08:00
deads2k f1176d9c5c mechanical repercussions 2017-01-13 08:27:14 -05:00
deads2k 6a4d5cd7cc start the apimachinery repo 2017-01-11 09:09:48 -05:00
Clayton Coleman 35a6bfbcee
generated: refactor 2016-11-23 22:30:47 -06:00
Fabiano Franz f6d1ac72a0 Use our own normalizers for cmd examples and descriptions 2016-10-17 11:49:55 -02:00
AdoHe b2280a646a update various commands to adapt the new Factory interface 2016-10-13 21:01:14 +08:00
deads2k 862415aaa2 make --include-extended-apis deprecated and remove plumbing 2016-09-16 16:05:52 -04:00
lojies f5b7a6e2a3 add valid resources when args is nil 2016-08-23 09:40:57 +08:00
Kubernetes Submit Queue 5b5a4145da Merge pull request #30821 from ardnaxelarak/21076_change_isEmpty_to_Empty
Automatic merge from submit-queue

Rename IsEmpty to Empty

addresses #21076
2016-08-22 00:54:28 -07:00
Kara Alexandra d12a66a422 Rename IsEmpty to Empty
Signed-off-by: Kara Alexandra <kalexandra@us.ibm.com>
2016-08-19 14:19:19 -07:00
lojies f81fef1f04 use valid_resources to replace kubectl.PossibleResourceTypes 2016-08-19 09:42:46 +08:00
k8s-merge-robot 2da247ffbc Merge pull request #26977 from joe2far/fix-help-strings
Automatic merge from submit-queue

Make kubectl help strings consistent
2016-07-07 00:12:22 -07:00
David McMahon ef0c9f0c5b Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
joe2far 25b4341dc7 Make kubectl help strings consistent 2016-06-29 12:50:24 +01:00
Michael Rubin 760b04e294 Use dedent for the kubectl commands
The one side effect is that for the "kubectl help" commands a newline
is prepended to output, which will alter the yaml output.

Here we use dedent to format the code to match the output.

hack/update-generated-docs.sh has been run and the affected files have
been added.

Note: for describe.go we added a period to the end of an output message.
2016-06-26 22:51:14 -07:00
Brendan Burns be6c5b332b Add third party support to kubectl 2016-03-31 10:53:32 -07:00
Janet Kuo e93b855242 Update kubectl help for 1.2 resources 2016-03-22 14:14:35 -07:00
deads2k 5bd161a9cc allow resource.version.group in kubectl 2016-03-11 10:21:50 -05:00
AdoHe 9cc668f7c6 update commented examples just remove $ 2016-02-29 09:41:09 -05:00
deads2k 9c42d219bc allow disambiguation of resouces 2016-02-25 07:35:23 -05:00
Clayton Coleman 664d25ba5a Take GVK in SwaggerSchema()
This is needed for the legacy OpenShift API group (oapi) which is also
group: "", version: "v1", but needs to return a different swagger
schema.  Will in the future be replaced by group defaulting.
2016-02-06 21:24:33 -05:00
nikhiljindal 2ad642d370 Merge registered and latest and move to apimachinery 2016-01-21 14:42:21 -08:00
deads2k 20f9c2c545 find partial resource matches 2015-12-21 09:26:06 -05:00
Clayton Coleman 151b4e5958 Tweak explain messages and abstract client 2015-12-18 00:27:22 -05:00
Abhishek Shah 6f63875165 Reverting 18442 2015-12-17 16:57:29 -08:00
deads2k 41b78ad2b6 find partial resource matches 2015-12-16 10:19:31 -05:00
deads2k 66eecb963a update more kubectl bits for groupversion 2015-12-07 09:01:44 -05:00
Chao Xu 6e192760e3 refactoring latest.go GroupVersion;
clean up latest.go GroupVersions;
remove latest.GroupMeta.Group;
remove latest.GroupMeta.Version.
2015-11-30 11:30:21 -08:00
deads2k 5c4fb5bcbe make RESTMapper.KindFor 2015-11-25 14:02:37 -05:00