Commit Graph

31 Commits

Author SHA1 Message Date
Ritikaa96 24a31a929b correcting description as per review
Signed-off-by: Ritikaa96 <ritika@india.nec.com>

Kubernetes-commit: b9ec8b3c4643c36491ba94e48e6b957828c850cb
2024-05-30 11:53:02 +05:30
Ritikaa96 6c2c451048 adding suggested changes
Signed-off-by: Ritikaa96 <ritika@india.nec.com>

Kubernetes-commit: 6f4e60a6b7ce56a5e083330f2b8c2277f4a659f0
2024-02-26 11:05:01 +05:30
Ritikaa96 2f762a69a2 Improving kubectl get output
Adding namespace flag & examples
Signed-off-by: Ritikaa96 <ritika@india.nec.com>

Kubernetes-commit: 22186fafaf79d6eae8375b3d018e181a645a3d31
2024-02-22 14:56:45 +05:30
Brian Pursley 8d8b5a6120 Use ptr.To instead of deprecated pointer functions
Kubernetes-commit: 288d132cf62efe029b6359c600565f8c7b12647d
2024-05-20 16:14:54 -04:00
Eduard Voiculescu f8b298459c show warning message only when running kubectl get --watch-only
Kubernetes-commit: a0aa7bf6d18bbeccc48447bb859ffb8fe28da3dc
2024-02-29 13:53:11 -05:00
Andrea Hoffer b676723184 Update CLI help text for grammar and consistency
Kubernetes-commit: a86380c7813a6d0cfa248c9165c878038730526a
2023-06-12 15:55:59 -04:00
Arda Güçlü 3f05cfcd78 Migrate genericclioptions.IOStreams usage to genericiooptions
Kubernetes-commit: 00c30941260a27e6929aef84c7fdbc8f1508518c
2023-04-05 14:07:46 +03:00
Brian Pursley a2ae001d8e cmd/get: Remove cmd argument from Run()
Removes the need to pass cmd as an argument to Run(). This change required reading the --sort-by flag in Complete() in a way similar to other flags.

This change allows the cobra.Command not to need to be passed throughout the completion code, which I updated as part of this commit.

It also is a step in the direction of the TODO comment requesting the removal of arguments passed to Run() and watch().

Kubernetes-commit: aa7a828f20b479a8a943d897224e8e76c3bb6cff
2022-12-23 14:56:59 -05:00
Sean Sullivan 072ad05626 Removes deprecated kubectl openapi column printing
Kubernetes-commit: 2f184814b89a4bfa482b8572e98e969681e2f64c
2023-01-10 15:30:04 -08:00
Arda Güçlü 81a25f37b5 Set validate functions requiring no parameters for all commands
Validate function is used to validate command options and should not get
any additional parameter. To preserve compatibility across all
kubectl commands, this PR removes all parameters in validate functions.

Kubernetes-commit: 8fb423bfabe0d53934cc94c154c7da2dc3ce1332
2022-05-17 11:38:20 +03:00
Marc Khouzam cd5b039b42 Refactor completion code into its own package
Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>

Kubernetes-commit: c4f8c57b43843abd13bae677b73c622e1c30b46f
2022-03-24 09:06:05 -04:00
Marc Khouzam cd245d2e22 Support completion for the <type>/<name> form
This commit teaches the shell completion logic how to handle the
<type>/<name> form for resource specification.

It also teaches the 'exec' command how to complete its '--container/-c'
flag using container names.

Also, for commands that work on pods, kubectl will now also suggest
completion choices of the form <type>/<name> for resource types that
contain pods (see below for more details).

The following commands can now have completion of the <type>/<name>
form. Commands that accept any resource type:

annotate
apply edit-last-applied
apply view-last-applied
delete
describe
edit
get
label
patch

Commands that accept a subset of resource types:

autoscale
expose
rollout history
rollout pause
rollout restart
rollout resume
rollout status
rollout undo
scale
taint

Commands that apply to resource types that contain pods:

attach
exec
logs
port-foward

For these last four commands, the possible resource types are now
included in the completion choices.  For example:
    kubectl exec d<TAB>
will suggest
    daemonsets/   deployments/

Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>

Kubernetes-commit: cf66f5c3cbd0a0e2f223af438ee4c6bc7e4a907c
2022-03-01 10:45:59 -05:00
Yuvaraj Kakaraparthi 38487e770c kubectl: add --support to get, patch, edit and replace commands
Co-authored-by: Nikhita Raghunath <nikitaraghunath@gmail.com>

Kubernetes-commit: a5aa858d44651ba48bdce634a39b55be91216614
2021-07-07 08:30:59 -07:00
Wojciech Tyczyński 3f11f31017 Stop setting selfLink in kubectl
Kubernetes-commit: 9015f27e6d8295d7dcdbf5915024f28cc00d4d2f
2022-02-16 17:13:54 +01:00
Aram Peres 8e80d8fd7e Cleanup kubectl label selectors with 'cmdutil.AddLabelSelectorFlagVar'
Kubernetes-commit: 8f8138bc35f59ef04b77a3520d8d1065603ccdb7
2022-01-06 23:28:44 -05:00
Marc Khouzam b111bee570 Complete multiple resource names
This commit teaches the completion function to repeat resource names
when supported by the command. The logic checks if a resource name
has already been specified by the user and does not include it again
when repeating the completion.

For example, the get command can receive multiple pods names, therefore
with this commit we have:
  kubectl get pod pod1 [tab]
will provide completion of pod names again, but not show 'pod1' since
it is already part of the command-line.

The improvement affects the following commands:
- annotate
- apply edit-last-applied
- apply view-last-applied
- autoscale
- delete
- describe
- edit
- expose
- get
- label
- patch
- rollout history
- rollout pause
- rollout restart
- rollout resume
- rollout undo
- scale
- taint

Note that "rollout status" only accepts a single resource name, unlike
the other "rollout ..." commands; this required the creation of a
special completion function that did not repeat just for that case.

Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>

Kubernetes-commit: 7aa5cb40316dbeb970250ee0835fbd597fd19a20
2021-10-15 15:36:09 -04:00
Di Xu f106a734e3 cleanup description on deprecated include-uninitialized flag
Kubernetes-commit: ae7b9787ee7b46bb83b05d3769ed54374c0337a7
2021-07-26 11:14:55 +08:00
Andrea Hoffer 09ed00ef49 Minor adjustments to descriptions and example text
Kubernetes-commit: 6b736f348483bb6b20d4633319305960f4d9e4c1
2021-07-06 15:05:26 -04:00
Marc Khouzam 1946af5761 Move all completion bash code to Go code
Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>

Kubernetes-commit: 879cdc5fa9e518ce76b9e1dc7e795132457966f3
2021-03-05 15:43:31 -05:00
Katrina Verey 086cadbf87 Create helper for adding chunk-size flag to commands
Kubernetes-commit: f8097c6ceeb16461861c74d4fc5dd0bcd36ebeaf
2021-03-19 08:30:49 -07:00
Katrina Verey 9348b0acca Extract DefaultChunkSize constant
Kubernetes-commit: 222e2c5ef897f4d47831b8d822cab09c000037c2
2021-03-10 12:21:25 -08:00
Hidetatsu Yaginuma ea99c2e0e8 use AllowedFormat in kubectl get help to avoid code duplication (#99983)
Kubernetes-commit: 0486f1a728c964f643c70d1f3aea59243a4fedf8
2021-04-09 09:10:22 +09:00
Karl 'NaN' Wikström 38408eaa8c cleanup: use i18n.T on all command descriptions
cleanup: use i18n.T only on string literals

cleanup: sort imports

Add i18n dependency for wait.go

Remove translation on envResource

cleanup: translate string instead of variable

cleanup: sort imports

cleanup: translate string literal only

Kubernetes-commit: cc8428566ea7160c5b20410a1bee53ca7ddb998e
2020-10-09 13:16:13 +02:00
Gaurav Singh 66f1998dda kubectl: Use Fprintf
Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>

Fix typo

Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>

Change Fprintf to Fprintln

Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>

Use %q instead of %s

Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>

Change %q to %s

Kubernetes-commit: b326948a9a317dbc17c6f32dfeea26e090bde3b0
2020-05-25 18:19:27 -04:00
Sally O'Malley ecd37ea662 get: -o yaml, json set ServerPrint false
Kubernetes-commit: 01e344feb6368647dc1a48c7a3a27b5852f9b89d
2020-08-12 12:23:23 -04:00
Naoki Oketani 404318cdbc Remove --export flag from kubectl get command.
Kubernetes-commit: c0562815fada455daf4826f59df895942dad8df0
2020-02-28 17:41:00 +09:00
Riccardo Piccoli 9fae31af80 Change not found output when getting non namespaced resources
Signed-off-by: Riccardo Piccoli <riccardo.piccoli@gmail.com>

Kubernetes-commit: 818f011a2e7e1a05923f06c57ef6089e3a048fba
2020-02-13 17:28:06 +01:00
danielqsj 4b914450ab unify alias of api errors under pkg and staging
Kubernetes-commit: 5bc0e26c1902e7e28abfc828de19a2dbb3e492c2
2019-11-12 16:26:59 +08:00
Jordan Liggitt 74e4737411 Switch TableGenerator/TableConvertor interfaces to metav1
Kubernetes-commit: 36eb250cbb441984260ded6f7abeb796974031c3
2019-11-26 13:13:25 -05:00
Maciej Szulik 89d9f2ef29 Set TypeSetter in get print flags, like we do everywhere else
Kubernetes-commit: 626b9081fbee1eeae3f96a99f40da6c665d5753f
2019-10-31 18:25:46 +01:00
Sean Sullivan 7965551001 Moves kubectl get subcommand to staging
Kubernetes-commit: 2a3f28863baa804a05d35c3958a107f9210b4c9e
2019-10-29 15:51:00 -07:00