Code review comments
parent
4de1197927
commit
ff65422562
|
@ -59,11 +59,13 @@ func DocForCommand(command *cobra.Command) (string, error) {
|
||||||
if err := generateTitle(command, buf); err != nil {
|
if err := generateTitle(command, buf); err != nil {
|
||||||
return "", errors.Wrap(err, "generating title")
|
return "", errors.Wrap(err, "generating title")
|
||||||
}
|
}
|
||||||
|
if err := rewriteFlags(command); err != nil {
|
||||||
|
return "", errors.Wrap(err, "rewriting flags")
|
||||||
|
}
|
||||||
if err := writeSubcommands(command, buf); err != nil {
|
if err := writeSubcommands(command, buf); err != nil {
|
||||||
return "", errors.Wrap(err, "writing subcommands")
|
return "", errors.Wrap(err, "writing subcommands")
|
||||||
}
|
}
|
||||||
edited := removeHelpText(buf)
|
return removeHelpText(buf), nil
|
||||||
return rewriteFlags(command, edited), nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// after every command, cobra automatically appends
|
// after every command, cobra automatically appends
|
||||||
|
|
|
@ -18,9 +18,6 @@ package generate
|
||||||
|
|
||||||
var title = `---
|
var title = `---
|
||||||
title: "{{.Command}}"
|
title: "{{.Command}}"
|
||||||
linkTitle: "{{.Command}}"
|
|
||||||
weight: 1
|
|
||||||
date: {{.Date}}
|
|
||||||
description: >
|
description: >
|
||||||
{{.Description}}
|
{{.Description}}
|
||||||
---
|
---
|
||||||
|
|
|
@ -17,7 +17,7 @@ limitations under the License.
|
||||||
package generate
|
package generate
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
"fmt"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
@ -30,42 +30,26 @@ type rewrite struct {
|
||||||
// rewriteFlags rewrites flags that are dependent on operating system
|
// rewriteFlags rewrites flags that are dependent on operating system
|
||||||
// for example, for `minikube start`, the description of --driver
|
// for example, for `minikube start`, the description of --driver
|
||||||
// outputs possible drivers for the operating system
|
// outputs possible drivers for the operating system
|
||||||
func rewriteFlags(command *cobra.Command, contents string) string {
|
func rewriteFlags(command *cobra.Command) error {
|
||||||
rewrites := map[string][]rewrite{
|
rewrites := map[string][]rewrite{
|
||||||
"start": []rewrite{{
|
"start": []rewrite{{
|
||||||
flag: "--driver",
|
flag: "driver",
|
||||||
description: "Used to specify the driver to run kubernetes in. The list of available drivers depends on operating system.",
|
description: "Used to specify the driver to run kubernetes in. The list of available drivers depends on operating system.",
|
||||||
}, {
|
}, {
|
||||||
flag: "--mount-string",
|
flag: "mount-string",
|
||||||
description: "The argument to pass the minikube mount command on start.",
|
description: "The argument to pass the minikube mount command on start.",
|
||||||
}},
|
}},
|
||||||
}
|
}
|
||||||
rws, ok := rewrites[command.Name()]
|
rws, ok := rewrites[command.Name()]
|
||||||
if !ok {
|
if !ok {
|
||||||
return contents
|
return nil
|
||||||
}
|
}
|
||||||
for _, r := range rws {
|
for _, r := range rws {
|
||||||
contents = rewriteFlag(contents, r.flag, r.description)
|
flag := command.Flag(r.flag)
|
||||||
}
|
if flag == nil {
|
||||||
return contents
|
return fmt.Errorf("--%s is not a valid flag for %s", r.flag, command.Name())
|
||||||
}
|
|
||||||
|
|
||||||
func rewriteFlag(contents, flag, description string) string {
|
|
||||||
lines := strings.Split(contents, "\n")
|
|
||||||
for i, l := range lines {
|
|
||||||
if strings.Contains(l, flag) {
|
|
||||||
// docs start with a prefix of 6 spaces
|
|
||||||
replacement := " "
|
|
||||||
replacement += flag
|
|
||||||
// there are 36 spaces between the start of the flag name
|
|
||||||
// and the description
|
|
||||||
spacesBetween := 36 - len(flag)
|
|
||||||
for i := 0; i < spacesBetween; i++ {
|
|
||||||
replacement += " "
|
|
||||||
}
|
|
||||||
replacement += description
|
|
||||||
lines[i] = replacement
|
|
||||||
}
|
}
|
||||||
|
flag.Usage = r.description
|
||||||
}
|
}
|
||||||
return strings.Join(lines, "\n")
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
---
|
---
|
||||||
title: "addons"
|
title: "addons"
|
||||||
linkTitle: "addons"
|
|
||||||
weight: 1
|
|
||||||
date: 2020-04-02
|
|
||||||
description: >
|
description: >
|
||||||
Modify minikube's kubernetes addons
|
Modify minikube's kubernetes addons
|
||||||
---
|
---
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
---
|
---
|
||||||
title: "cache"
|
title: "cache"
|
||||||
linkTitle: "cache"
|
|
||||||
weight: 1
|
|
||||||
date: 2020-04-02
|
|
||||||
description: >
|
description: >
|
||||||
Add or delete an image from the local cache.
|
Add or delete an image from the local cache.
|
||||||
---
|
---
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
---
|
---
|
||||||
title: "completion"
|
title: "completion"
|
||||||
linkTitle: "completion"
|
|
||||||
weight: 1
|
|
||||||
date: 2020-04-02
|
|
||||||
description: >
|
description: >
|
||||||
Outputs minikube shell completion for the given shell (bash or zsh)
|
Outputs minikube shell completion for the given shell (bash or zsh)
|
||||||
---
|
---
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
---
|
---
|
||||||
title: "config"
|
title: "config"
|
||||||
linkTitle: "config"
|
|
||||||
weight: 1
|
|
||||||
date: 2020-04-02
|
|
||||||
description: >
|
description: >
|
||||||
Modify minikube config
|
Modify minikube config
|
||||||
---
|
---
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
---
|
---
|
||||||
title: "dashboard"
|
title: "dashboard"
|
||||||
linkTitle: "dashboard"
|
|
||||||
weight: 1
|
|
||||||
date: 2020-04-02
|
|
||||||
description: >
|
description: >
|
||||||
Access the kubernetes dashboard running within the minikube cluster
|
Access the kubernetes dashboard running within the minikube cluster
|
||||||
---
|
---
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
---
|
---
|
||||||
title: "delete"
|
title: "delete"
|
||||||
linkTitle: "delete"
|
|
||||||
weight: 1
|
|
||||||
date: 2020-04-02
|
|
||||||
description: >
|
description: >
|
||||||
Deletes a local kubernetes cluster
|
Deletes a local kubernetes cluster
|
||||||
---
|
---
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
---
|
---
|
||||||
title: "docker-env"
|
title: "docker-env"
|
||||||
linkTitle: "docker-env"
|
|
||||||
weight: 1
|
|
||||||
date: 2020-04-02
|
|
||||||
description: >
|
description: >
|
||||||
Sets up docker env variables; similar to '$(docker-machine env)'
|
Sets up docker env variables; similar to '$(docker-machine env)'
|
||||||
---
|
---
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
---
|
---
|
||||||
title: "help"
|
title: "help"
|
||||||
linkTitle: "help"
|
|
||||||
weight: 1
|
|
||||||
date: 2020-04-02
|
|
||||||
description: >
|
description: >
|
||||||
Help about any command
|
Help about any command
|
||||||
---
|
---
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
---
|
---
|
||||||
title: "ip"
|
title: "ip"
|
||||||
linkTitle: "ip"
|
|
||||||
weight: 1
|
|
||||||
date: 2020-04-02
|
|
||||||
description: >
|
description: >
|
||||||
Retrieves the IP address of the running cluster
|
Retrieves the IP address of the running cluster
|
||||||
---
|
---
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
---
|
---
|
||||||
title: "kubectl"
|
title: "kubectl"
|
||||||
linkTitle: "kubectl"
|
|
||||||
weight: 1
|
|
||||||
date: 2020-04-02
|
|
||||||
description: >
|
description: >
|
||||||
Run kubectl
|
Run kubectl
|
||||||
---
|
---
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
---
|
---
|
||||||
title: "logs"
|
title: "logs"
|
||||||
linkTitle: "logs"
|
|
||||||
weight: 1
|
|
||||||
date: 2020-04-02
|
|
||||||
description: >
|
description: >
|
||||||
Gets the logs of the running instance, used for debugging minikube, not user code.
|
Gets the logs of the running instance, used for debugging minikube, not user code.
|
||||||
---
|
---
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
---
|
---
|
||||||
title: "mount"
|
title: "mount"
|
||||||
linkTitle: "mount"
|
|
||||||
weight: 1
|
|
||||||
date: 2020-04-02
|
|
||||||
description: >
|
description: >
|
||||||
Mounts the specified directory into minikube
|
Mounts the specified directory into minikube
|
||||||
---
|
---
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
---
|
---
|
||||||
title: "node"
|
title: "node"
|
||||||
linkTitle: "node"
|
|
||||||
weight: 1
|
|
||||||
date: 2020-04-02
|
|
||||||
description: >
|
description: >
|
||||||
Node operations
|
Node operations
|
||||||
---
|
---
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
---
|
---
|
||||||
title: "options"
|
title: "options"
|
||||||
linkTitle: "options"
|
|
||||||
weight: 1
|
|
||||||
date: 2020-04-02
|
|
||||||
description: >
|
description: >
|
||||||
Show a list of global command-line options (applies to all commands).
|
Show a list of global command-line options (applies to all commands).
|
||||||
---
|
---
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
---
|
---
|
||||||
title: "pause"
|
title: "pause"
|
||||||
linkTitle: "pause"
|
|
||||||
weight: 1
|
|
||||||
date: 2020-04-02
|
|
||||||
description: >
|
description: >
|
||||||
pause containers
|
pause containers
|
||||||
---
|
---
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
---
|
---
|
||||||
title: "podman-env"
|
title: "podman-env"
|
||||||
linkTitle: "podman-env"
|
|
||||||
weight: 1
|
|
||||||
date: 2020-04-02
|
|
||||||
description: >
|
description: >
|
||||||
Sets up podman env variables; similar to '$(podman-machine env)'
|
Sets up podman env variables; similar to '$(podman-machine env)'
|
||||||
---
|
---
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
---
|
---
|
||||||
title: "profile"
|
title: "profile"
|
||||||
linkTitle: "profile"
|
|
||||||
weight: 1
|
|
||||||
date: 2020-04-02
|
|
||||||
description: >
|
description: >
|
||||||
Profile gets or sets the current minikube profile
|
Profile gets or sets the current minikube profile
|
||||||
---
|
---
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
---
|
---
|
||||||
title: "service"
|
title: "service"
|
||||||
linkTitle: "service"
|
|
||||||
weight: 1
|
|
||||||
date: 2020-04-02
|
|
||||||
description: >
|
description: >
|
||||||
Gets the kubernetes URL(s) for the specified service in your local cluster
|
Gets the kubernetes URL(s) for the specified service in your local cluster
|
||||||
---
|
---
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
---
|
---
|
||||||
title: "ssh-key"
|
title: "ssh-key"
|
||||||
linkTitle: "ssh-key"
|
|
||||||
weight: 1
|
|
||||||
date: 2020-04-02
|
|
||||||
description: >
|
description: >
|
||||||
Retrieve the ssh identity key path of the specified cluster
|
Retrieve the ssh identity key path of the specified cluster
|
||||||
---
|
---
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
---
|
---
|
||||||
title: "ssh"
|
title: "ssh"
|
||||||
linkTitle: "ssh"
|
|
||||||
weight: 1
|
|
||||||
date: 2020-04-02
|
|
||||||
description: >
|
description: >
|
||||||
Log into or run a command on a machine with SSH; similar to 'docker-machine ssh'
|
Log into or run a command on a machine with SSH; similar to 'docker-machine ssh'
|
||||||
---
|
---
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
---
|
---
|
||||||
title: "start"
|
title: "start"
|
||||||
linkTitle: "start"
|
|
||||||
weight: 1
|
|
||||||
date: 2020-04-02
|
|
||||||
description: >
|
description: >
|
||||||
Starts a local kubernetes cluster
|
Starts a local kubernetes cluster
|
||||||
---
|
---
|
||||||
|
@ -30,7 +27,7 @@ minikube start [flags]
|
||||||
--apiserver-names stringArray A set of apiserver names which are used in the generated certificate for kubernetes. This can be used if you want to make the apiserver available from outside the machine
|
--apiserver-names stringArray A set of apiserver names which are used in the generated certificate for kubernetes. This can be used if you want to make the apiserver available from outside the machine
|
||||||
--apiserver-port int The apiserver listening port (default 8443)
|
--apiserver-port int The apiserver listening port (default 8443)
|
||||||
--auto-update-drivers If set, automatically updates drivers to the latest version. Defaults to true. (default true)
|
--auto-update-drivers If set, automatically updates drivers to the latest version. Defaults to true. (default true)
|
||||||
--driver Used to specify the driver to run kubernetes in. The list of available drivers depends on operating system.
|
--cache-images If true, cache docker images for the current bootstrapper and load them into the machine. Always false with --driver=none. (default true)
|
||||||
--container-runtime string The container runtime to be used (docker, crio, containerd). (default "docker")
|
--container-runtime string The container runtime to be used (docker, crio, containerd). (default "docker")
|
||||||
--cpus int Number of CPUs allocated to Kubernetes. (default 2)
|
--cpus int Number of CPUs allocated to Kubernetes. (default 2)
|
||||||
--cri-socket string The cri socket path to be used.
|
--cri-socket string The cri socket path to be used.
|
||||||
|
@ -42,7 +39,7 @@ minikube start [flags]
|
||||||
--docker-env stringArray Environment variables to pass to the Docker daemon. (format: key=value)
|
--docker-env stringArray Environment variables to pass to the Docker daemon. (format: key=value)
|
||||||
--docker-opt stringArray Specify arbitrary flags to pass to the Docker daemon. (format: key=value)
|
--docker-opt stringArray Specify arbitrary flags to pass to the Docker daemon. (format: key=value)
|
||||||
--download-only If true, only download and cache files for later use - don't install or start anything.
|
--download-only If true, only download and cache files for later use - don't install or start anything.
|
||||||
--driver Used to specify the driver to run kubernetes in. The list of available drivers depends on operating system.
|
--driver string Used to specify the driver to run kubernetes in. The list of available drivers depends on operating system.
|
||||||
--dry-run dry-run mode. Validates configuration, but does not mutate system state
|
--dry-run dry-run mode. Validates configuration, but does not mutate system state
|
||||||
--embed-certs if true, will embed the certs in kubeconfig.
|
--embed-certs if true, will embed the certs in kubeconfig.
|
||||||
--enable-default-cni Enable the default CNI plugin (/etc/cni/net.d/k8s.conf). Used in conjunction with "--network-plugin=cni".
|
--enable-default-cni Enable the default CNI plugin (/etc/cni/net.d/k8s.conf). Used in conjunction with "--network-plugin=cni".
|
||||||
|
@ -75,7 +72,7 @@ minikube start [flags]
|
||||||
--kvm-qemu-uri string The KVM QEMU connection URI. (kvm2 driver only) (default "qemu:///system")
|
--kvm-qemu-uri string The KVM QEMU connection URI. (kvm2 driver only) (default "qemu:///system")
|
||||||
--memory string Amount of RAM to allocate to Kubernetes (format: <number>[<unit>], where unit = b, k, m or g).
|
--memory string Amount of RAM to allocate to Kubernetes (format: <number>[<unit>], where unit = b, k, m or g).
|
||||||
--mount This will start the mount daemon and automatically mount files into minikube.
|
--mount This will start the mount daemon and automatically mount files into minikube.
|
||||||
--mount-string The argument to pass the minikube mount command on start.
|
--mount-string string The argument to pass the minikube mount command on start. (default "/Users:/minikube-host")
|
||||||
--nat-nic-type string NIC Type used for host only network. One of Am79C970A, Am79C973, 82540EM, 82543GC, 82545EM, or virtio (virtualbox driver only) (default "virtio")
|
--nat-nic-type string NIC Type used for host only network. One of Am79C970A, Am79C973, 82540EM, 82543GC, 82545EM, or virtio (virtualbox driver only) (default "virtio")
|
||||||
--native-ssh Use native Golang SSH client (default true). Set to 'false' to use the command line 'ssh' command when accessing the docker machine. Useful for the machine drivers when they will not start with 'Waiting for SSH'. (default true)
|
--native-ssh Use native Golang SSH client (default true). Set to 'false' to use the command line 'ssh' command when accessing the docker machine. Useful for the machine drivers when they will not start with 'Waiting for SSH'. (default true)
|
||||||
--network-plugin string The name of the network plugin.
|
--network-plugin string The name of the network plugin.
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
---
|
---
|
||||||
title: "status"
|
title: "status"
|
||||||
linkTitle: "status"
|
|
||||||
weight: 1
|
|
||||||
date: 2020-04-02
|
|
||||||
description: >
|
description: >
|
||||||
Gets the status of a local kubernetes cluster
|
Gets the status of a local kubernetes cluster
|
||||||
---
|
---
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
---
|
---
|
||||||
title: "stop"
|
title: "stop"
|
||||||
linkTitle: "stop"
|
|
||||||
weight: 1
|
|
||||||
date: 2020-04-02
|
|
||||||
description: >
|
description: >
|
||||||
Stops a running local kubernetes cluster
|
Stops a running local kubernetes cluster
|
||||||
---
|
---
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
---
|
---
|
||||||
title: "tunnel"
|
title: "tunnel"
|
||||||
linkTitle: "tunnel"
|
|
||||||
weight: 1
|
|
||||||
date: 2020-04-02
|
|
||||||
description: >
|
description: >
|
||||||
tunnel makes services of type LoadBalancer accessible on localhost
|
tunnel makes services of type LoadBalancer accessible on localhost
|
||||||
---
|
---
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
---
|
---
|
||||||
title: "unpause"
|
title: "unpause"
|
||||||
linkTitle: "unpause"
|
|
||||||
weight: 1
|
|
||||||
date: 2020-04-02
|
|
||||||
description: >
|
description: >
|
||||||
unpause Kubernetes
|
unpause Kubernetes
|
||||||
---
|
---
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
---
|
---
|
||||||
title: "update-check"
|
title: "update-check"
|
||||||
linkTitle: "update-check"
|
|
||||||
weight: 1
|
|
||||||
date: 2020-04-02
|
|
||||||
description: >
|
description: >
|
||||||
Print current and latest version number
|
Print current and latest version number
|
||||||
---
|
---
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
---
|
---
|
||||||
title: "update-context"
|
title: "update-context"
|
||||||
linkTitle: "update-context"
|
|
||||||
weight: 1
|
|
||||||
date: 2020-04-02
|
|
||||||
description: >
|
description: >
|
||||||
Verify the IP address of the running cluster in kubeconfig.
|
Verify the IP address of the running cluster in kubeconfig.
|
||||||
---
|
---
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
---
|
---
|
||||||
title: "version"
|
title: "version"
|
||||||
linkTitle: "version"
|
|
||||||
weight: 1
|
|
||||||
date: 2020-04-02
|
|
||||||
description: >
|
description: >
|
||||||
Print the version of minikube
|
Print the version of minikube
|
||||||
---
|
---
|
||||||
|
|
Loading…
Reference in New Issue