mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-04 18:52:38 +00:00
Merge pull request #46598 from xiangpengzhao/fix-kubectl-version
Automatic merge from submit-queue (batch tested with PRs 46210, 48607, 46874, 46598, 49240) Make "kubectl version" json format output more readable. **What this PR does / why we need it**: ##39858 adds a flag --output to `kubectl version`, but the json format output is displayed in one line. It's not so readable. This PR fixes it. and - adds a shorthand for `output` - ~~refactors that: if `--short` is specified, `--output` will be ignored~~ **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #43750 **Special notes for your reviewer**: /cc @php-coder @alejandroEsc **Release note**: ```release-note NONE ```
This commit is contained in:
@@ -327,7 +327,7 @@ kube::test::version::object_to_file() {
|
||||
kube::test::version::json_object_to_file() {
|
||||
flags=$1
|
||||
file=$2
|
||||
kubectl version $flags --output json | sed -e s/'\"'/''/g -e s/'}'/''/g -e s/'{'/''/g -e s/'clientVersion:'/'clientVersion:,'/ -e s/'serverVersion:'/'serverVersion:,'/ | tr , '\n' > "${file}"
|
||||
kubectl version $flags --output json | sed -e s/' '/''/g -e s/'\"'/''/g -e s/'}'/''/g -e s/'{'/''/g -e s/'clientVersion:'/'clientVersion:,'/ -e s/'serverVersion:'/'serverVersion:,'/ | tr , '\n' > "${file}"
|
||||
}
|
||||
|
||||
kube::test::version::json_client_server_object_to_file() {
|
||||
|
Reference in New Issue
Block a user