Skip to content

Commit

Permalink
Update k8s CLI messages (#314)
Browse files Browse the repository at this point in the history
  • Loading branch information
neoaggelos authored Apr 12, 2024
1 parent 27e3606 commit ffb4949
Show file tree
Hide file tree
Showing 31 changed files with 183 additions and 260 deletions.
7 changes: 2 additions & 5 deletions docs/src/_parts/commands/k8s.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,16 @@ Canonical Kubernetes CLI
### Options

```
-h, --help help for k8s
--output-format string set the output format to one of plain, json or yaml (default "plain")
--timeout duration the max time to wait for the command to execute (default 1m30s)
-h, --help help for k8s
```

### SEE ALSO

* [k8s bootstrap](k8s_bootstrap.md) - Bootstrap a new Kubernetes cluster
* [k8s completion](k8s_completion.md) - Generate the autocompletion script for the specified shell
* [k8s config](k8s_config.md) - Generate a kubeconfig that can be used to access the Kubernetes cluster
* [k8s disable](k8s_disable.md) - Disable core cluster features
* [k8s enable](k8s_enable.md) - Enable core cluster features
* [k8s get](k8s_get.md) - get cluster configuration
* [k8s get](k8s_get.md) - Get cluster configuration
* [k8s get-join-token](k8s_get-join-token.md) - Create a token for a node to join the cluster
* [k8s join-cluster](k8s_join-cluster.md) - Join a cluster using the provided token
* [k8s kubectl](k8s_kubectl.md) - Integrated Kubernetes kubectl client
Expand Down
16 changes: 5 additions & 11 deletions docs/src/_parts/commands/k8s_bootstrap.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,12 @@ k8s bootstrap [flags]
### Options

```
--address string microcluster address, defaults to the node IP address
--file string path to the YAML file containing your custom cluster bootstrap configuration.
-h, --help help for bootstrap
--interactive interactively configure the most important cluster options
--name string node name, defaults to hostname
```

### Options inherited from parent commands

```
--address string microcluster address, defaults to the node IP address
--file string path to the YAML file containing your custom cluster bootstrap configuration.
-h, --help help for bootstrap
--interactive interactively configure the most important cluster options
--name string node name, defaults to hostname
--output-format string set the output format to one of plain, json or yaml (default "plain")
--timeout duration the max time to wait for the command to execute (default 1m30s)
```

### SEE ALSO
Expand Down
7 changes: 0 additions & 7 deletions docs/src/_parts/commands/k8s_completion.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,6 @@ See each sub-command's help for details on how to use the generated script.
-h, --help help for completion
```

### Options inherited from parent commands

```
--output-format string set the output format to one of plain, json or yaml (default "plain")
--timeout duration the max time to wait for the command to execute (default 1m30s)
```

### SEE ALSO

* [k8s](k8s.md) - Canonical Kubernetes CLI
Expand Down
7 changes: 0 additions & 7 deletions docs/src/_parts/commands/k8s_completion_bash.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,6 @@ k8s completion bash
--no-descriptions disable completion descriptions
```

### Options inherited from parent commands

```
--output-format string set the output format to one of plain, json or yaml (default "plain")
--timeout duration the max time to wait for the command to execute (default 1m30s)
```

### SEE ALSO

* [k8s completion](k8s_completion.md) - Generate the autocompletion script for the specified shell
Expand Down
7 changes: 0 additions & 7 deletions docs/src/_parts/commands/k8s_completion_fish.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,6 @@ k8s completion fish [flags]
--no-descriptions disable completion descriptions
```

### Options inherited from parent commands

```
--output-format string set the output format to one of plain, json or yaml (default "plain")
--timeout duration the max time to wait for the command to execute (default 1m30s)
```

### SEE ALSO

* [k8s completion](k8s_completion.md) - Generate the autocompletion script for the specified shell
Expand Down
7 changes: 0 additions & 7 deletions docs/src/_parts/commands/k8s_completion_powershell.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,6 @@ k8s completion powershell [flags]
--no-descriptions disable completion descriptions
```

### Options inherited from parent commands

```
--output-format string set the output format to one of plain, json or yaml (default "plain")
--timeout duration the max time to wait for the command to execute (default 1m30s)
```

### SEE ALSO

* [k8s completion](k8s_completion.md) - Generate the autocompletion script for the specified shell
Expand Down
7 changes: 0 additions & 7 deletions docs/src/_parts/commands/k8s_completion_zsh.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,6 @@ k8s completion zsh [flags]
--no-descriptions disable completion descriptions
```

### Options inherited from parent commands

```
--output-format string set the output format to one of plain, json or yaml (default "plain")
--timeout duration the max time to wait for the command to execute (default 1m30s)
```

### SEE ALSO

* [k8s completion](k8s_completion.md) - Generate the autocompletion script for the specified shell
Expand Down
2 changes: 1 addition & 1 deletion docs/src/_parts/commands/k8s_config.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## k8s config

Generate a kubeconfig that can be used to access the Kubernetes cluster
Generate an admin kubeconfig that can be used to access the Kubernetes cluster

```
k8s config [flags]
Expand Down
8 changes: 1 addition & 7 deletions docs/src/_parts/commands/k8s_disable.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,8 @@ k8s disable <feature> ... [flags]
### Options

```
-h, --help help for disable
```

### Options inherited from parent commands

```
-h, --help help for disable
--output-format string set the output format to one of plain, json or yaml (default "plain")
--timeout duration the max time to wait for the command to execute (default 1m30s)
```

### SEE ALSO
Expand Down
8 changes: 1 addition & 7 deletions docs/src/_parts/commands/k8s_enable.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,8 @@ k8s enable <feature> ... [flags]
### Options

```
-h, --help help for enable
```

### Options inherited from parent commands

```
-h, --help help for enable
--output-format string set the output format to one of plain, json or yaml (default "plain")
--timeout duration the max time to wait for the command to execute (default 1m30s)
```

### SEE ALSO
Expand Down
10 changes: 2 additions & 8 deletions docs/src/_parts/commands/k8s_get-join-token.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,9 @@ k8s get-join-token <node-name> [flags]
### Options

```
-h, --help help for get-join-token
--worker generate a join token for a worker node
```

### Options inherited from parent commands

```
-h, --help help for get-join-token
--output-format string set the output format to one of plain, json or yaml (default "plain")
--timeout duration the max time to wait for the command to execute (default 1m30s)
--worker generate a join token for a worker node
```

### SEE ALSO
Expand Down
10 changes: 2 additions & 8 deletions docs/src/_parts/commands/k8s_get.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## k8s get

get cluster configuration
Get cluster configuration

### Synopsis

Expand All @@ -13,14 +13,8 @@ k8s get <feature.key> [flags]
### Options

```
-h, --help help for get
```

### Options inherited from parent commands

```
-h, --help help for get
--output-format string set the output format to one of plain, json or yaml (default "plain")
--timeout duration the max time to wait for the command to execute (default 1m30s)
```

### SEE ALSO
Expand Down
14 changes: 4 additions & 10 deletions docs/src/_parts/commands/k8s_join-cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,11 @@ k8s join-cluster <join-token> [flags]
### Options

```
--address string microcluster address, defaults to the node IP address
--file string path to the YAML file containing your custom cluster join configuration
-h, --help help for join-cluster
--name string node name, defaults to hostname
```

### Options inherited from parent commands

```
--address string microcluster address, defaults to the node IP address
--file string path to the YAML file containing your custom cluster join configuration
-h, --help help for join-cluster
--name string node name, defaults to hostname
--output-format string set the output format to one of plain, json or yaml (default "plain")
--timeout duration the max time to wait for the command to execute (default 1m30s)
```

### SEE ALSO
Expand Down
7 changes: 0 additions & 7 deletions docs/src/_parts/commands/k8s_kubectl.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@ k8s kubectl [flags]
-h, --help help for kubectl
```

### Options inherited from parent commands

```
--output-format string set the output format to one of plain, json or yaml (default "plain")
--timeout duration the max time to wait for the command to execute (default 1m30s)
```

### SEE ALSO

* [k8s](k8s.md) - Canonical Kubernetes CLI
Expand Down
10 changes: 2 additions & 8 deletions docs/src/_parts/commands/k8s_remove-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,9 @@ k8s remove-node <node-name> [flags]
### Options

```
--force forcibly remove the cluster member
-h, --help help for remove-node
```

### Options inherited from parent commands

```
--force forcibly remove the cluster member
-h, --help help for remove-node
--output-format string set the output format to one of plain, json or yaml (default "plain")
--timeout duration the max time to wait for the command to execute (default 1m30s)
```

### SEE ALSO
Expand Down
8 changes: 1 addition & 7 deletions docs/src/_parts/commands/k8s_set.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,8 @@ k8s set <feature.key=value> ... [flags]
### Options

```
-h, --help help for set
```

### Options inherited from parent commands

```
-h, --help help for set
--output-format string set the output format to one of plain, json or yaml (default "plain")
--timeout duration the max time to wait for the command to execute (default 1m30s)
```

### SEE ALSO
Expand Down
10 changes: 2 additions & 8 deletions docs/src/_parts/commands/k8s_status.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,9 @@ k8s status [flags]
### Options

```
-h, --help help for status
--wait-ready wait until at least one cluster node is ready
```

### Options inherited from parent commands

```
-h, --help help for status
--output-format string set the output format to one of plain, json or yaml (default "plain")
--timeout duration the max time to wait for the command to execute (default 1m30s)
--wait-ready wait until at least one cluster node is ready
```

### SEE ALSO
Expand Down
13 changes: 13 additions & 0 deletions src/k8s/cmd/k8s/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,16 @@ func hookRequireRoot(env cmdutil.ExecutionEnvironment) func(*cobra.Command, []st
}
}
}

func hookInitializeFormatter(env cmdutil.ExecutionEnvironment, format *string) func(*cobra.Command, []string) {
return func(cmd *cobra.Command, args []string) {
// initialize formatter
var err error
outputFormatter, err = cmdutil.NewFormatter(*format, cmd.OutOrStdout())
if err != nil {
cmd.PrintErrf("Error: Unknown --output-format %q. It must be one of %q (default), %q or %q.", *format, "plain", "json", "yaml")
env.Exit(1)
return
}
}
}
Loading

0 comments on commit ffb4949

Please sign in to comment.