Auto generation of markdown docs!
An example from the kubernetes project, for the `kubectl config`
command, which as subcommands, and flags, and all sorts of stuff, it
will generate markdown like so:
config modifies .kubeconfig files
config modifies .kubeconfig files using subcommands like "kubectl config set current-context my-context"
```
kubectl config SUBCOMMAND
```
```
--envvar=false: use the .kubeconfig from $KUBECONFIG
--global=false: use the .kubeconfig from /home/username
-h, --help=false: help for config
--kubeconfig="": use a particular .kubeconfig file
--local=false: use the .kubeconfig in the current directory
```
```
--alsologtostderr=false: log to standard error as well as files
--api-version="": The API version to use when talking to the server
-a, --auth-path="": Path to the auth info file. If missing, prompt the user. Only used if using https.
--certificate-authority="": Path to a cert. file for the certificate authority.
--client-certificate="": Path to a client key file for TLS.
--client-key="": Path to a client key file for TLS.
--cluster="": The name of the kubeconfig cluster to use
--context="": The name of the kubeconfig context to use
--insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
--log_backtrace_at=:0: when logging hits line file:N, emit a stack trace
--log_dir=: If non-empty, write log files in this directory
--log_flush_frequency=5s: Maximum number of seconds between log flushes
--logtostderr=true: log to standard error instead of files
--match-server-version=false: Require server version to match client version
--namespace="": If present, the namespace scope for this CLI request.
--password="": Password for basic authentication to the API server.
-s, --server="": The address and port of the Kubernetes API server
--stderrthreshold=2: logs at or above this threshold go to stderr
--token="": Bearer token for authentication to the API server.
--user="": The name of the kubeconfig user to use
--username="": Username for basic authentication to the API server.
--v=0: log level for V logs
--validate=false: If true, use a schema to validate the input before sending it
--vmodule=: comma-separated list of pattern=N settings for file-filtered logging
```
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
* [kubectl config set](kubectl_config_set.md) - Sets an individual value in a .kubeconfig file
* [kubectl config set-cluster](kubectl_config_set-cluster.md) - Sets a cluster entry in .kubeconfig
* [kubectl config set-context](kubectl_config_set-context.md) - Sets a context entry in .kubeconfig
* [kubectl config set-credentials](kubectl_config_set-credentials.md) - Sets a user entry in .kubeconfig
* [kubectl config unset](kubectl_config_unset.md) - Unsets an individual value in a .kubeconfig file
* [kubectl config use-context](kubectl_config_use-context.md) - Sets the current-context in a .kubeconfig file
* [kubectl config view](kubectl_config_view.md) - displays merged .kubeconfig settings or a specified .kubeconfig file.
2015-04-07 03:38:51 +00:00
|
|
|
//Copyright 2015 Red Hat Inc. All rights reserved.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
2015-11-23 23:19:16 +00:00
|
|
|
package doc
|
Auto generation of markdown docs!
An example from the kubernetes project, for the `kubectl config`
command, which as subcommands, and flags, and all sorts of stuff, it
will generate markdown like so:
config modifies .kubeconfig files
config modifies .kubeconfig files using subcommands like "kubectl config set current-context my-context"
```
kubectl config SUBCOMMAND
```
```
--envvar=false: use the .kubeconfig from $KUBECONFIG
--global=false: use the .kubeconfig from /home/username
-h, --help=false: help for config
--kubeconfig="": use a particular .kubeconfig file
--local=false: use the .kubeconfig in the current directory
```
```
--alsologtostderr=false: log to standard error as well as files
--api-version="": The API version to use when talking to the server
-a, --auth-path="": Path to the auth info file. If missing, prompt the user. Only used if using https.
--certificate-authority="": Path to a cert. file for the certificate authority.
--client-certificate="": Path to a client key file for TLS.
--client-key="": Path to a client key file for TLS.
--cluster="": The name of the kubeconfig cluster to use
--context="": The name of the kubeconfig context to use
--insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
--log_backtrace_at=:0: when logging hits line file:N, emit a stack trace
--log_dir=: If non-empty, write log files in this directory
--log_flush_frequency=5s: Maximum number of seconds between log flushes
--logtostderr=true: log to standard error instead of files
--match-server-version=false: Require server version to match client version
--namespace="": If present, the namespace scope for this CLI request.
--password="": Password for basic authentication to the API server.
-s, --server="": The address and port of the Kubernetes API server
--stderrthreshold=2: logs at or above this threshold go to stderr
--token="": Bearer token for authentication to the API server.
--user="": The name of the kubeconfig user to use
--username="": Username for basic authentication to the API server.
--v=0: log level for V logs
--validate=false: If true, use a schema to validate the input before sending it
--vmodule=: comma-separated list of pattern=N settings for file-filtered logging
```
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
* [kubectl config set](kubectl_config_set.md) - Sets an individual value in a .kubeconfig file
* [kubectl config set-cluster](kubectl_config_set-cluster.md) - Sets a cluster entry in .kubeconfig
* [kubectl config set-context](kubectl_config_set-context.md) - Sets a context entry in .kubeconfig
* [kubectl config set-credentials](kubectl_config_set-credentials.md) - Sets a user entry in .kubeconfig
* [kubectl config unset](kubectl_config_unset.md) - Unsets an individual value in a .kubeconfig file
* [kubectl config use-context](kubectl_config_use-context.md) - Sets the current-context in a .kubeconfig file
* [kubectl config view](kubectl_config_view.md) - displays merged .kubeconfig settings or a specified .kubeconfig file.
2015-04-07 03:38:51 +00:00
|
|
|
|
|
|
|
import (
|
2017-04-24 18:42:49 +00:00
|
|
|
"bytes"
|
Auto generation of markdown docs!
An example from the kubernetes project, for the `kubectl config`
command, which as subcommands, and flags, and all sorts of stuff, it
will generate markdown like so:
config modifies .kubeconfig files
config modifies .kubeconfig files using subcommands like "kubectl config set current-context my-context"
```
kubectl config SUBCOMMAND
```
```
--envvar=false: use the .kubeconfig from $KUBECONFIG
--global=false: use the .kubeconfig from /home/username
-h, --help=false: help for config
--kubeconfig="": use a particular .kubeconfig file
--local=false: use the .kubeconfig in the current directory
```
```
--alsologtostderr=false: log to standard error as well as files
--api-version="": The API version to use when talking to the server
-a, --auth-path="": Path to the auth info file. If missing, prompt the user. Only used if using https.
--certificate-authority="": Path to a cert. file for the certificate authority.
--client-certificate="": Path to a client key file for TLS.
--client-key="": Path to a client key file for TLS.
--cluster="": The name of the kubeconfig cluster to use
--context="": The name of the kubeconfig context to use
--insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
--log_backtrace_at=:0: when logging hits line file:N, emit a stack trace
--log_dir=: If non-empty, write log files in this directory
--log_flush_frequency=5s: Maximum number of seconds between log flushes
--logtostderr=true: log to standard error instead of files
--match-server-version=false: Require server version to match client version
--namespace="": If present, the namespace scope for this CLI request.
--password="": Password for basic authentication to the API server.
-s, --server="": The address and port of the Kubernetes API server
--stderrthreshold=2: logs at or above this threshold go to stderr
--token="": Bearer token for authentication to the API server.
--user="": The name of the kubeconfig user to use
--username="": Username for basic authentication to the API server.
--v=0: log level for V logs
--validate=false: If true, use a schema to validate the input before sending it
--vmodule=: comma-separated list of pattern=N settings for file-filtered logging
```
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
* [kubectl config set](kubectl_config_set.md) - Sets an individual value in a .kubeconfig file
* [kubectl config set-cluster](kubectl_config_set-cluster.md) - Sets a cluster entry in .kubeconfig
* [kubectl config set-context](kubectl_config_set-context.md) - Sets a context entry in .kubeconfig
* [kubectl config set-credentials](kubectl_config_set-credentials.md) - Sets a user entry in .kubeconfig
* [kubectl config unset](kubectl_config_unset.md) - Unsets an individual value in a .kubeconfig file
* [kubectl config use-context](kubectl_config_use-context.md) - Sets the current-context in a .kubeconfig file
* [kubectl config view](kubectl_config_view.md) - displays merged .kubeconfig settings or a specified .kubeconfig file.
2015-04-07 03:38:51 +00:00
|
|
|
"fmt"
|
2015-11-23 23:19:16 +00:00
|
|
|
"io"
|
Auto generation of markdown docs!
An example from the kubernetes project, for the `kubectl config`
command, which as subcommands, and flags, and all sorts of stuff, it
will generate markdown like so:
config modifies .kubeconfig files
config modifies .kubeconfig files using subcommands like "kubectl config set current-context my-context"
```
kubectl config SUBCOMMAND
```
```
--envvar=false: use the .kubeconfig from $KUBECONFIG
--global=false: use the .kubeconfig from /home/username
-h, --help=false: help for config
--kubeconfig="": use a particular .kubeconfig file
--local=false: use the .kubeconfig in the current directory
```
```
--alsologtostderr=false: log to standard error as well as files
--api-version="": The API version to use when talking to the server
-a, --auth-path="": Path to the auth info file. If missing, prompt the user. Only used if using https.
--certificate-authority="": Path to a cert. file for the certificate authority.
--client-certificate="": Path to a client key file for TLS.
--client-key="": Path to a client key file for TLS.
--cluster="": The name of the kubeconfig cluster to use
--context="": The name of the kubeconfig context to use
--insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
--log_backtrace_at=:0: when logging hits line file:N, emit a stack trace
--log_dir=: If non-empty, write log files in this directory
--log_flush_frequency=5s: Maximum number of seconds between log flushes
--logtostderr=true: log to standard error instead of files
--match-server-version=false: Require server version to match client version
--namespace="": If present, the namespace scope for this CLI request.
--password="": Password for basic authentication to the API server.
-s, --server="": The address and port of the Kubernetes API server
--stderrthreshold=2: logs at or above this threshold go to stderr
--token="": Bearer token for authentication to the API server.
--user="": The name of the kubeconfig user to use
--username="": Username for basic authentication to the API server.
--v=0: log level for V logs
--validate=false: If true, use a schema to validate the input before sending it
--vmodule=: comma-separated list of pattern=N settings for file-filtered logging
```
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
* [kubectl config set](kubectl_config_set.md) - Sets an individual value in a .kubeconfig file
* [kubectl config set-cluster](kubectl_config_set-cluster.md) - Sets a cluster entry in .kubeconfig
* [kubectl config set-context](kubectl_config_set-context.md) - Sets a context entry in .kubeconfig
* [kubectl config set-credentials](kubectl_config_set-credentials.md) - Sets a user entry in .kubeconfig
* [kubectl config unset](kubectl_config_unset.md) - Unsets an individual value in a .kubeconfig file
* [kubectl config use-context](kubectl_config_use-context.md) - Sets the current-context in a .kubeconfig file
* [kubectl config view](kubectl_config_view.md) - displays merged .kubeconfig settings or a specified .kubeconfig file.
2015-04-07 03:38:51 +00:00
|
|
|
"os"
|
2016-01-17 00:24:54 +00:00
|
|
|
"path/filepath"
|
Auto generation of markdown docs!
An example from the kubernetes project, for the `kubectl config`
command, which as subcommands, and flags, and all sorts of stuff, it
will generate markdown like so:
config modifies .kubeconfig files
config modifies .kubeconfig files using subcommands like "kubectl config set current-context my-context"
```
kubectl config SUBCOMMAND
```
```
--envvar=false: use the .kubeconfig from $KUBECONFIG
--global=false: use the .kubeconfig from /home/username
-h, --help=false: help for config
--kubeconfig="": use a particular .kubeconfig file
--local=false: use the .kubeconfig in the current directory
```
```
--alsologtostderr=false: log to standard error as well as files
--api-version="": The API version to use when talking to the server
-a, --auth-path="": Path to the auth info file. If missing, prompt the user. Only used if using https.
--certificate-authority="": Path to a cert. file for the certificate authority.
--client-certificate="": Path to a client key file for TLS.
--client-key="": Path to a client key file for TLS.
--cluster="": The name of the kubeconfig cluster to use
--context="": The name of the kubeconfig context to use
--insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
--log_backtrace_at=:0: when logging hits line file:N, emit a stack trace
--log_dir=: If non-empty, write log files in this directory
--log_flush_frequency=5s: Maximum number of seconds between log flushes
--logtostderr=true: log to standard error instead of files
--match-server-version=false: Require server version to match client version
--namespace="": If present, the namespace scope for this CLI request.
--password="": Password for basic authentication to the API server.
-s, --server="": The address and port of the Kubernetes API server
--stderrthreshold=2: logs at or above this threshold go to stderr
--token="": Bearer token for authentication to the API server.
--user="": The name of the kubeconfig user to use
--username="": Username for basic authentication to the API server.
--v=0: log level for V logs
--validate=false: If true, use a schema to validate the input before sending it
--vmodule=: comma-separated list of pattern=N settings for file-filtered logging
```
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
* [kubectl config set](kubectl_config_set.md) - Sets an individual value in a .kubeconfig file
* [kubectl config set-cluster](kubectl_config_set-cluster.md) - Sets a cluster entry in .kubeconfig
* [kubectl config set-context](kubectl_config_set-context.md) - Sets a context entry in .kubeconfig
* [kubectl config set-credentials](kubectl_config_set-credentials.md) - Sets a user entry in .kubeconfig
* [kubectl config unset](kubectl_config_unset.md) - Unsets an individual value in a .kubeconfig file
* [kubectl config use-context](kubectl_config_use-context.md) - Sets the current-context in a .kubeconfig file
* [kubectl config view](kubectl_config_view.md) - displays merged .kubeconfig settings or a specified .kubeconfig file.
2015-04-07 03:38:51 +00:00
|
|
|
"sort"
|
|
|
|
"strings"
|
|
|
|
"time"
|
2015-11-23 23:19:16 +00:00
|
|
|
|
|
|
|
"github.com/spf13/cobra"
|
Auto generation of markdown docs!
An example from the kubernetes project, for the `kubectl config`
command, which as subcommands, and flags, and all sorts of stuff, it
will generate markdown like so:
config modifies .kubeconfig files
config modifies .kubeconfig files using subcommands like "kubectl config set current-context my-context"
```
kubectl config SUBCOMMAND
```
```
--envvar=false: use the .kubeconfig from $KUBECONFIG
--global=false: use the .kubeconfig from /home/username
-h, --help=false: help for config
--kubeconfig="": use a particular .kubeconfig file
--local=false: use the .kubeconfig in the current directory
```
```
--alsologtostderr=false: log to standard error as well as files
--api-version="": The API version to use when talking to the server
-a, --auth-path="": Path to the auth info file. If missing, prompt the user. Only used if using https.
--certificate-authority="": Path to a cert. file for the certificate authority.
--client-certificate="": Path to a client key file for TLS.
--client-key="": Path to a client key file for TLS.
--cluster="": The name of the kubeconfig cluster to use
--context="": The name of the kubeconfig context to use
--insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
--log_backtrace_at=:0: when logging hits line file:N, emit a stack trace
--log_dir=: If non-empty, write log files in this directory
--log_flush_frequency=5s: Maximum number of seconds between log flushes
--logtostderr=true: log to standard error instead of files
--match-server-version=false: Require server version to match client version
--namespace="": If present, the namespace scope for this CLI request.
--password="": Password for basic authentication to the API server.
-s, --server="": The address and port of the Kubernetes API server
--stderrthreshold=2: logs at or above this threshold go to stderr
--token="": Bearer token for authentication to the API server.
--user="": The name of the kubeconfig user to use
--username="": Username for basic authentication to the API server.
--v=0: log level for V logs
--validate=false: If true, use a schema to validate the input before sending it
--vmodule=: comma-separated list of pattern=N settings for file-filtered logging
```
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
* [kubectl config set](kubectl_config_set.md) - Sets an individual value in a .kubeconfig file
* [kubectl config set-cluster](kubectl_config_set-cluster.md) - Sets a cluster entry in .kubeconfig
* [kubectl config set-context](kubectl_config_set-context.md) - Sets a context entry in .kubeconfig
* [kubectl config set-credentials](kubectl_config_set-credentials.md) - Sets a user entry in .kubeconfig
* [kubectl config unset](kubectl_config_unset.md) - Unsets an individual value in a .kubeconfig file
* [kubectl config use-context](kubectl_config_use-context.md) - Sets the current-context in a .kubeconfig file
* [kubectl config view](kubectl_config_view.md) - displays merged .kubeconfig settings or a specified .kubeconfig file.
2015-04-07 03:38:51 +00:00
|
|
|
)
|
|
|
|
|
2017-04-24 18:42:49 +00:00
|
|
|
func printOptions(buf *bytes.Buffer, cmd *cobra.Command, name string) error {
|
Auto generation of markdown docs!
An example from the kubernetes project, for the `kubectl config`
command, which as subcommands, and flags, and all sorts of stuff, it
will generate markdown like so:
config modifies .kubeconfig files
config modifies .kubeconfig files using subcommands like "kubectl config set current-context my-context"
```
kubectl config SUBCOMMAND
```
```
--envvar=false: use the .kubeconfig from $KUBECONFIG
--global=false: use the .kubeconfig from /home/username
-h, --help=false: help for config
--kubeconfig="": use a particular .kubeconfig file
--local=false: use the .kubeconfig in the current directory
```
```
--alsologtostderr=false: log to standard error as well as files
--api-version="": The API version to use when talking to the server
-a, --auth-path="": Path to the auth info file. If missing, prompt the user. Only used if using https.
--certificate-authority="": Path to a cert. file for the certificate authority.
--client-certificate="": Path to a client key file for TLS.
--client-key="": Path to a client key file for TLS.
--cluster="": The name of the kubeconfig cluster to use
--context="": The name of the kubeconfig context to use
--insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
--log_backtrace_at=:0: when logging hits line file:N, emit a stack trace
--log_dir=: If non-empty, write log files in this directory
--log_flush_frequency=5s: Maximum number of seconds between log flushes
--logtostderr=true: log to standard error instead of files
--match-server-version=false: Require server version to match client version
--namespace="": If present, the namespace scope for this CLI request.
--password="": Password for basic authentication to the API server.
-s, --server="": The address and port of the Kubernetes API server
--stderrthreshold=2: logs at or above this threshold go to stderr
--token="": Bearer token for authentication to the API server.
--user="": The name of the kubeconfig user to use
--username="": Username for basic authentication to the API server.
--v=0: log level for V logs
--validate=false: If true, use a schema to validate the input before sending it
--vmodule=: comma-separated list of pattern=N settings for file-filtered logging
```
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
* [kubectl config set](kubectl_config_set.md) - Sets an individual value in a .kubeconfig file
* [kubectl config set-cluster](kubectl_config_set-cluster.md) - Sets a cluster entry in .kubeconfig
* [kubectl config set-context](kubectl_config_set-context.md) - Sets a context entry in .kubeconfig
* [kubectl config set-credentials](kubectl_config_set-credentials.md) - Sets a user entry in .kubeconfig
* [kubectl config unset](kubectl_config_unset.md) - Unsets an individual value in a .kubeconfig file
* [kubectl config use-context](kubectl_config_use-context.md) - Sets the current-context in a .kubeconfig file
* [kubectl config view](kubectl_config_view.md) - displays merged .kubeconfig settings or a specified .kubeconfig file.
2015-04-07 03:38:51 +00:00
|
|
|
flags := cmd.NonInheritedFlags()
|
2017-04-24 18:42:49 +00:00
|
|
|
flags.SetOutput(buf)
|
2018-04-24 16:15:12 +00:00
|
|
|
if flags.HasAvailableFlags() {
|
2017-04-24 18:42:49 +00:00
|
|
|
buf.WriteString("### Options\n\n```\n")
|
Auto generation of markdown docs!
An example from the kubernetes project, for the `kubectl config`
command, which as subcommands, and flags, and all sorts of stuff, it
will generate markdown like so:
config modifies .kubeconfig files
config modifies .kubeconfig files using subcommands like "kubectl config set current-context my-context"
```
kubectl config SUBCOMMAND
```
```
--envvar=false: use the .kubeconfig from $KUBECONFIG
--global=false: use the .kubeconfig from /home/username
-h, --help=false: help for config
--kubeconfig="": use a particular .kubeconfig file
--local=false: use the .kubeconfig in the current directory
```
```
--alsologtostderr=false: log to standard error as well as files
--api-version="": The API version to use when talking to the server
-a, --auth-path="": Path to the auth info file. If missing, prompt the user. Only used if using https.
--certificate-authority="": Path to a cert. file for the certificate authority.
--client-certificate="": Path to a client key file for TLS.
--client-key="": Path to a client key file for TLS.
--cluster="": The name of the kubeconfig cluster to use
--context="": The name of the kubeconfig context to use
--insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
--log_backtrace_at=:0: when logging hits line file:N, emit a stack trace
--log_dir=: If non-empty, write log files in this directory
--log_flush_frequency=5s: Maximum number of seconds between log flushes
--logtostderr=true: log to standard error instead of files
--match-server-version=false: Require server version to match client version
--namespace="": If present, the namespace scope for this CLI request.
--password="": Password for basic authentication to the API server.
-s, --server="": The address and port of the Kubernetes API server
--stderrthreshold=2: logs at or above this threshold go to stderr
--token="": Bearer token for authentication to the API server.
--user="": The name of the kubeconfig user to use
--username="": Username for basic authentication to the API server.
--v=0: log level for V logs
--validate=false: If true, use a schema to validate the input before sending it
--vmodule=: comma-separated list of pattern=N settings for file-filtered logging
```
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
* [kubectl config set](kubectl_config_set.md) - Sets an individual value in a .kubeconfig file
* [kubectl config set-cluster](kubectl_config_set-cluster.md) - Sets a cluster entry in .kubeconfig
* [kubectl config set-context](kubectl_config_set-context.md) - Sets a context entry in .kubeconfig
* [kubectl config set-credentials](kubectl_config_set-credentials.md) - Sets a user entry in .kubeconfig
* [kubectl config unset](kubectl_config_unset.md) - Unsets an individual value in a .kubeconfig file
* [kubectl config use-context](kubectl_config_use-context.md) - Sets the current-context in a .kubeconfig file
* [kubectl config view](kubectl_config_view.md) - displays merged .kubeconfig settings or a specified .kubeconfig file.
2015-04-07 03:38:51 +00:00
|
|
|
flags.PrintDefaults()
|
2017-04-24 18:42:49 +00:00
|
|
|
buf.WriteString("```\n\n")
|
Auto generation of markdown docs!
An example from the kubernetes project, for the `kubectl config`
command, which as subcommands, and flags, and all sorts of stuff, it
will generate markdown like so:
config modifies .kubeconfig files
config modifies .kubeconfig files using subcommands like "kubectl config set current-context my-context"
```
kubectl config SUBCOMMAND
```
```
--envvar=false: use the .kubeconfig from $KUBECONFIG
--global=false: use the .kubeconfig from /home/username
-h, --help=false: help for config
--kubeconfig="": use a particular .kubeconfig file
--local=false: use the .kubeconfig in the current directory
```
```
--alsologtostderr=false: log to standard error as well as files
--api-version="": The API version to use when talking to the server
-a, --auth-path="": Path to the auth info file. If missing, prompt the user. Only used if using https.
--certificate-authority="": Path to a cert. file for the certificate authority.
--client-certificate="": Path to a client key file for TLS.
--client-key="": Path to a client key file for TLS.
--cluster="": The name of the kubeconfig cluster to use
--context="": The name of the kubeconfig context to use
--insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
--log_backtrace_at=:0: when logging hits line file:N, emit a stack trace
--log_dir=: If non-empty, write log files in this directory
--log_flush_frequency=5s: Maximum number of seconds between log flushes
--logtostderr=true: log to standard error instead of files
--match-server-version=false: Require server version to match client version
--namespace="": If present, the namespace scope for this CLI request.
--password="": Password for basic authentication to the API server.
-s, --server="": The address and port of the Kubernetes API server
--stderrthreshold=2: logs at or above this threshold go to stderr
--token="": Bearer token for authentication to the API server.
--user="": The name of the kubeconfig user to use
--username="": Username for basic authentication to the API server.
--v=0: log level for V logs
--validate=false: If true, use a schema to validate the input before sending it
--vmodule=: comma-separated list of pattern=N settings for file-filtered logging
```
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
* [kubectl config set](kubectl_config_set.md) - Sets an individual value in a .kubeconfig file
* [kubectl config set-cluster](kubectl_config_set-cluster.md) - Sets a cluster entry in .kubeconfig
* [kubectl config set-context](kubectl_config_set-context.md) - Sets a context entry in .kubeconfig
* [kubectl config set-credentials](kubectl_config_set-credentials.md) - Sets a user entry in .kubeconfig
* [kubectl config unset](kubectl_config_unset.md) - Unsets an individual value in a .kubeconfig file
* [kubectl config use-context](kubectl_config_use-context.md) - Sets the current-context in a .kubeconfig file
* [kubectl config view](kubectl_config_view.md) - displays merged .kubeconfig settings or a specified .kubeconfig file.
2015-04-07 03:38:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
parentFlags := cmd.InheritedFlags()
|
2017-04-24 18:42:49 +00:00
|
|
|
parentFlags.SetOutput(buf)
|
2018-04-24 16:15:12 +00:00
|
|
|
if parentFlags.HasAvailableFlags() {
|
2017-04-24 18:42:49 +00:00
|
|
|
buf.WriteString("### Options inherited from parent commands\n\n```\n")
|
Auto generation of markdown docs!
An example from the kubernetes project, for the `kubectl config`
command, which as subcommands, and flags, and all sorts of stuff, it
will generate markdown like so:
config modifies .kubeconfig files
config modifies .kubeconfig files using subcommands like "kubectl config set current-context my-context"
```
kubectl config SUBCOMMAND
```
```
--envvar=false: use the .kubeconfig from $KUBECONFIG
--global=false: use the .kubeconfig from /home/username
-h, --help=false: help for config
--kubeconfig="": use a particular .kubeconfig file
--local=false: use the .kubeconfig in the current directory
```
```
--alsologtostderr=false: log to standard error as well as files
--api-version="": The API version to use when talking to the server
-a, --auth-path="": Path to the auth info file. If missing, prompt the user. Only used if using https.
--certificate-authority="": Path to a cert. file for the certificate authority.
--client-certificate="": Path to a client key file for TLS.
--client-key="": Path to a client key file for TLS.
--cluster="": The name of the kubeconfig cluster to use
--context="": The name of the kubeconfig context to use
--insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
--log_backtrace_at=:0: when logging hits line file:N, emit a stack trace
--log_dir=: If non-empty, write log files in this directory
--log_flush_frequency=5s: Maximum number of seconds between log flushes
--logtostderr=true: log to standard error instead of files
--match-server-version=false: Require server version to match client version
--namespace="": If present, the namespace scope for this CLI request.
--password="": Password for basic authentication to the API server.
-s, --server="": The address and port of the Kubernetes API server
--stderrthreshold=2: logs at or above this threshold go to stderr
--token="": Bearer token for authentication to the API server.
--user="": The name of the kubeconfig user to use
--username="": Username for basic authentication to the API server.
--v=0: log level for V logs
--validate=false: If true, use a schema to validate the input before sending it
--vmodule=: comma-separated list of pattern=N settings for file-filtered logging
```
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
* [kubectl config set](kubectl_config_set.md) - Sets an individual value in a .kubeconfig file
* [kubectl config set-cluster](kubectl_config_set-cluster.md) - Sets a cluster entry in .kubeconfig
* [kubectl config set-context](kubectl_config_set-context.md) - Sets a context entry in .kubeconfig
* [kubectl config set-credentials](kubectl_config_set-credentials.md) - Sets a user entry in .kubeconfig
* [kubectl config unset](kubectl_config_unset.md) - Unsets an individual value in a .kubeconfig file
* [kubectl config use-context](kubectl_config_use-context.md) - Sets the current-context in a .kubeconfig file
* [kubectl config view](kubectl_config_view.md) - displays merged .kubeconfig settings or a specified .kubeconfig file.
2015-04-07 03:38:51 +00:00
|
|
|
parentFlags.PrintDefaults()
|
2017-04-24 18:42:49 +00:00
|
|
|
buf.WriteString("```\n\n")
|
Auto generation of markdown docs!
An example from the kubernetes project, for the `kubectl config`
command, which as subcommands, and flags, and all sorts of stuff, it
will generate markdown like so:
config modifies .kubeconfig files
config modifies .kubeconfig files using subcommands like "kubectl config set current-context my-context"
```
kubectl config SUBCOMMAND
```
```
--envvar=false: use the .kubeconfig from $KUBECONFIG
--global=false: use the .kubeconfig from /home/username
-h, --help=false: help for config
--kubeconfig="": use a particular .kubeconfig file
--local=false: use the .kubeconfig in the current directory
```
```
--alsologtostderr=false: log to standard error as well as files
--api-version="": The API version to use when talking to the server
-a, --auth-path="": Path to the auth info file. If missing, prompt the user. Only used if using https.
--certificate-authority="": Path to a cert. file for the certificate authority.
--client-certificate="": Path to a client key file for TLS.
--client-key="": Path to a client key file for TLS.
--cluster="": The name of the kubeconfig cluster to use
--context="": The name of the kubeconfig context to use
--insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
--log_backtrace_at=:0: when logging hits line file:N, emit a stack trace
--log_dir=: If non-empty, write log files in this directory
--log_flush_frequency=5s: Maximum number of seconds between log flushes
--logtostderr=true: log to standard error instead of files
--match-server-version=false: Require server version to match client version
--namespace="": If present, the namespace scope for this CLI request.
--password="": Password for basic authentication to the API server.
-s, --server="": The address and port of the Kubernetes API server
--stderrthreshold=2: logs at or above this threshold go to stderr
--token="": Bearer token for authentication to the API server.
--user="": The name of the kubeconfig user to use
--username="": Username for basic authentication to the API server.
--v=0: log level for V logs
--validate=false: If true, use a schema to validate the input before sending it
--vmodule=: comma-separated list of pattern=N settings for file-filtered logging
```
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
* [kubectl config set](kubectl_config_set.md) - Sets an individual value in a .kubeconfig file
* [kubectl config set-cluster](kubectl_config_set-cluster.md) - Sets a cluster entry in .kubeconfig
* [kubectl config set-context](kubectl_config_set-context.md) - Sets a context entry in .kubeconfig
* [kubectl config set-credentials](kubectl_config_set-credentials.md) - Sets a user entry in .kubeconfig
* [kubectl config unset](kubectl_config_unset.md) - Unsets an individual value in a .kubeconfig file
* [kubectl config use-context](kubectl_config_use-context.md) - Sets the current-context in a .kubeconfig file
* [kubectl config view](kubectl_config_view.md) - displays merged .kubeconfig settings or a specified .kubeconfig file.
2015-04-07 03:38:51 +00:00
|
|
|
}
|
2016-01-06 10:59:28 +00:00
|
|
|
return nil
|
Auto generation of markdown docs!
An example from the kubernetes project, for the `kubectl config`
command, which as subcommands, and flags, and all sorts of stuff, it
will generate markdown like so:
config modifies .kubeconfig files
config modifies .kubeconfig files using subcommands like "kubectl config set current-context my-context"
```
kubectl config SUBCOMMAND
```
```
--envvar=false: use the .kubeconfig from $KUBECONFIG
--global=false: use the .kubeconfig from /home/username
-h, --help=false: help for config
--kubeconfig="": use a particular .kubeconfig file
--local=false: use the .kubeconfig in the current directory
```
```
--alsologtostderr=false: log to standard error as well as files
--api-version="": The API version to use when talking to the server
-a, --auth-path="": Path to the auth info file. If missing, prompt the user. Only used if using https.
--certificate-authority="": Path to a cert. file for the certificate authority.
--client-certificate="": Path to a client key file for TLS.
--client-key="": Path to a client key file for TLS.
--cluster="": The name of the kubeconfig cluster to use
--context="": The name of the kubeconfig context to use
--insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
--log_backtrace_at=:0: when logging hits line file:N, emit a stack trace
--log_dir=: If non-empty, write log files in this directory
--log_flush_frequency=5s: Maximum number of seconds between log flushes
--logtostderr=true: log to standard error instead of files
--match-server-version=false: Require server version to match client version
--namespace="": If present, the namespace scope for this CLI request.
--password="": Password for basic authentication to the API server.
-s, --server="": The address and port of the Kubernetes API server
--stderrthreshold=2: logs at or above this threshold go to stderr
--token="": Bearer token for authentication to the API server.
--user="": The name of the kubeconfig user to use
--username="": Username for basic authentication to the API server.
--v=0: log level for V logs
--validate=false: If true, use a schema to validate the input before sending it
--vmodule=: comma-separated list of pattern=N settings for file-filtered logging
```
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
* [kubectl config set](kubectl_config_set.md) - Sets an individual value in a .kubeconfig file
* [kubectl config set-cluster](kubectl_config_set-cluster.md) - Sets a cluster entry in .kubeconfig
* [kubectl config set-context](kubectl_config_set-context.md) - Sets a context entry in .kubeconfig
* [kubectl config set-credentials](kubectl_config_set-credentials.md) - Sets a user entry in .kubeconfig
* [kubectl config unset](kubectl_config_unset.md) - Unsets an individual value in a .kubeconfig file
* [kubectl config use-context](kubectl_config_use-context.md) - Sets the current-context in a .kubeconfig file
* [kubectl config view](kubectl_config_view.md) - displays merged .kubeconfig settings or a specified .kubeconfig file.
2015-04-07 03:38:51 +00:00
|
|
|
}
|
|
|
|
|
2017-04-19 12:39:58 +00:00
|
|
|
// GenMarkdown creates markdown output.
|
2016-01-06 10:59:28 +00:00
|
|
|
func GenMarkdown(cmd *cobra.Command, w io.Writer) error {
|
|
|
|
return GenMarkdownCustom(cmd, w, func(s string) string { return s })
|
2015-05-13 09:27:18 +00:00
|
|
|
}
|
|
|
|
|
2017-04-19 12:39:58 +00:00
|
|
|
// GenMarkdownCustom creates custom markdown output.
|
2016-01-06 10:59:28 +00:00
|
|
|
func GenMarkdownCustom(cmd *cobra.Command, w io.Writer, linkHandler func(string) string) error {
|
2017-05-20 17:28:06 +00:00
|
|
|
cmd.InitDefaultHelpCmd()
|
|
|
|
cmd.InitDefaultHelpFlag()
|
|
|
|
|
2017-04-24 18:42:49 +00:00
|
|
|
buf := new(bytes.Buffer)
|
Auto generation of markdown docs!
An example from the kubernetes project, for the `kubectl config`
command, which as subcommands, and flags, and all sorts of stuff, it
will generate markdown like so:
config modifies .kubeconfig files
config modifies .kubeconfig files using subcommands like "kubectl config set current-context my-context"
```
kubectl config SUBCOMMAND
```
```
--envvar=false: use the .kubeconfig from $KUBECONFIG
--global=false: use the .kubeconfig from /home/username
-h, --help=false: help for config
--kubeconfig="": use a particular .kubeconfig file
--local=false: use the .kubeconfig in the current directory
```
```
--alsologtostderr=false: log to standard error as well as files
--api-version="": The API version to use when talking to the server
-a, --auth-path="": Path to the auth info file. If missing, prompt the user. Only used if using https.
--certificate-authority="": Path to a cert. file for the certificate authority.
--client-certificate="": Path to a client key file for TLS.
--client-key="": Path to a client key file for TLS.
--cluster="": The name of the kubeconfig cluster to use
--context="": The name of the kubeconfig context to use
--insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
--log_backtrace_at=:0: when logging hits line file:N, emit a stack trace
--log_dir=: If non-empty, write log files in this directory
--log_flush_frequency=5s: Maximum number of seconds between log flushes
--logtostderr=true: log to standard error instead of files
--match-server-version=false: Require server version to match client version
--namespace="": If present, the namespace scope for this CLI request.
--password="": Password for basic authentication to the API server.
-s, --server="": The address and port of the Kubernetes API server
--stderrthreshold=2: logs at or above this threshold go to stderr
--token="": Bearer token for authentication to the API server.
--user="": The name of the kubeconfig user to use
--username="": Username for basic authentication to the API server.
--v=0: log level for V logs
--validate=false: If true, use a schema to validate the input before sending it
--vmodule=: comma-separated list of pattern=N settings for file-filtered logging
```
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
* [kubectl config set](kubectl_config_set.md) - Sets an individual value in a .kubeconfig file
* [kubectl config set-cluster](kubectl_config_set-cluster.md) - Sets a cluster entry in .kubeconfig
* [kubectl config set-context](kubectl_config_set-context.md) - Sets a context entry in .kubeconfig
* [kubectl config set-credentials](kubectl_config_set-credentials.md) - Sets a user entry in .kubeconfig
* [kubectl config unset](kubectl_config_unset.md) - Unsets an individual value in a .kubeconfig file
* [kubectl config use-context](kubectl_config_use-context.md) - Sets the current-context in a .kubeconfig file
* [kubectl config view](kubectl_config_view.md) - displays merged .kubeconfig settings or a specified .kubeconfig file.
2015-04-07 03:38:51 +00:00
|
|
|
name := cmd.CommandPath()
|
|
|
|
|
2017-04-24 18:42:49 +00:00
|
|
|
buf.WriteString("## " + name + "\n\n")
|
2020-08-26 15:18:51 +00:00
|
|
|
buf.WriteString(cmd.Short + "\n\n")
|
|
|
|
if len(cmd.Long) > 0 {
|
|
|
|
buf.WriteString("### Synopsis\n\n")
|
|
|
|
buf.WriteString(cmd.Long + "\n\n")
|
|
|
|
}
|
Auto generation of markdown docs!
An example from the kubernetes project, for the `kubectl config`
command, which as subcommands, and flags, and all sorts of stuff, it
will generate markdown like so:
config modifies .kubeconfig files
config modifies .kubeconfig files using subcommands like "kubectl config set current-context my-context"
```
kubectl config SUBCOMMAND
```
```
--envvar=false: use the .kubeconfig from $KUBECONFIG
--global=false: use the .kubeconfig from /home/username
-h, --help=false: help for config
--kubeconfig="": use a particular .kubeconfig file
--local=false: use the .kubeconfig in the current directory
```
```
--alsologtostderr=false: log to standard error as well as files
--api-version="": The API version to use when talking to the server
-a, --auth-path="": Path to the auth info file. If missing, prompt the user. Only used if using https.
--certificate-authority="": Path to a cert. file for the certificate authority.
--client-certificate="": Path to a client key file for TLS.
--client-key="": Path to a client key file for TLS.
--cluster="": The name of the kubeconfig cluster to use
--context="": The name of the kubeconfig context to use
--insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
--log_backtrace_at=:0: when logging hits line file:N, emit a stack trace
--log_dir=: If non-empty, write log files in this directory
--log_flush_frequency=5s: Maximum number of seconds between log flushes
--logtostderr=true: log to standard error instead of files
--match-server-version=false: Require server version to match client version
--namespace="": If present, the namespace scope for this CLI request.
--password="": Password for basic authentication to the API server.
-s, --server="": The address and port of the Kubernetes API server
--stderrthreshold=2: logs at or above this threshold go to stderr
--token="": Bearer token for authentication to the API server.
--user="": The name of the kubeconfig user to use
--username="": Username for basic authentication to the API server.
--v=0: log level for V logs
--validate=false: If true, use a schema to validate the input before sending it
--vmodule=: comma-separated list of pattern=N settings for file-filtered logging
```
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
* [kubectl config set](kubectl_config_set.md) - Sets an individual value in a .kubeconfig file
* [kubectl config set-cluster](kubectl_config_set-cluster.md) - Sets a cluster entry in .kubeconfig
* [kubectl config set-context](kubectl_config_set-context.md) - Sets a context entry in .kubeconfig
* [kubectl config set-credentials](kubectl_config_set-credentials.md) - Sets a user entry in .kubeconfig
* [kubectl config unset](kubectl_config_unset.md) - Unsets an individual value in a .kubeconfig file
* [kubectl config use-context](kubectl_config_use-context.md) - Sets the current-context in a .kubeconfig file
* [kubectl config view](kubectl_config_view.md) - displays merged .kubeconfig settings or a specified .kubeconfig file.
2015-04-07 03:38:51 +00:00
|
|
|
|
|
|
|
if cmd.Runnable() {
|
2017-04-24 18:42:49 +00:00
|
|
|
buf.WriteString(fmt.Sprintf("```\n%s\n```\n\n", cmd.UseLine()))
|
Auto generation of markdown docs!
An example from the kubernetes project, for the `kubectl config`
command, which as subcommands, and flags, and all sorts of stuff, it
will generate markdown like so:
config modifies .kubeconfig files
config modifies .kubeconfig files using subcommands like "kubectl config set current-context my-context"
```
kubectl config SUBCOMMAND
```
```
--envvar=false: use the .kubeconfig from $KUBECONFIG
--global=false: use the .kubeconfig from /home/username
-h, --help=false: help for config
--kubeconfig="": use a particular .kubeconfig file
--local=false: use the .kubeconfig in the current directory
```
```
--alsologtostderr=false: log to standard error as well as files
--api-version="": The API version to use when talking to the server
-a, --auth-path="": Path to the auth info file. If missing, prompt the user. Only used if using https.
--certificate-authority="": Path to a cert. file for the certificate authority.
--client-certificate="": Path to a client key file for TLS.
--client-key="": Path to a client key file for TLS.
--cluster="": The name of the kubeconfig cluster to use
--context="": The name of the kubeconfig context to use
--insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
--log_backtrace_at=:0: when logging hits line file:N, emit a stack trace
--log_dir=: If non-empty, write log files in this directory
--log_flush_frequency=5s: Maximum number of seconds between log flushes
--logtostderr=true: log to standard error instead of files
--match-server-version=false: Require server version to match client version
--namespace="": If present, the namespace scope for this CLI request.
--password="": Password for basic authentication to the API server.
-s, --server="": The address and port of the Kubernetes API server
--stderrthreshold=2: logs at or above this threshold go to stderr
--token="": Bearer token for authentication to the API server.
--user="": The name of the kubeconfig user to use
--username="": Username for basic authentication to the API server.
--v=0: log level for V logs
--validate=false: If true, use a schema to validate the input before sending it
--vmodule=: comma-separated list of pattern=N settings for file-filtered logging
```
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
* [kubectl config set](kubectl_config_set.md) - Sets an individual value in a .kubeconfig file
* [kubectl config set-cluster](kubectl_config_set-cluster.md) - Sets a cluster entry in .kubeconfig
* [kubectl config set-context](kubectl_config_set-context.md) - Sets a context entry in .kubeconfig
* [kubectl config set-credentials](kubectl_config_set-credentials.md) - Sets a user entry in .kubeconfig
* [kubectl config unset](kubectl_config_unset.md) - Unsets an individual value in a .kubeconfig file
* [kubectl config use-context](kubectl_config_use-context.md) - Sets the current-context in a .kubeconfig file
* [kubectl config view](kubectl_config_view.md) - displays merged .kubeconfig settings or a specified .kubeconfig file.
2015-04-07 03:38:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if len(cmd.Example) > 0 {
|
2017-04-24 18:42:49 +00:00
|
|
|
buf.WriteString("### Examples\n\n")
|
|
|
|
buf.WriteString(fmt.Sprintf("```\n%s\n```\n\n", cmd.Example))
|
Auto generation of markdown docs!
An example from the kubernetes project, for the `kubectl config`
command, which as subcommands, and flags, and all sorts of stuff, it
will generate markdown like so:
config modifies .kubeconfig files
config modifies .kubeconfig files using subcommands like "kubectl config set current-context my-context"
```
kubectl config SUBCOMMAND
```
```
--envvar=false: use the .kubeconfig from $KUBECONFIG
--global=false: use the .kubeconfig from /home/username
-h, --help=false: help for config
--kubeconfig="": use a particular .kubeconfig file
--local=false: use the .kubeconfig in the current directory
```
```
--alsologtostderr=false: log to standard error as well as files
--api-version="": The API version to use when talking to the server
-a, --auth-path="": Path to the auth info file. If missing, prompt the user. Only used if using https.
--certificate-authority="": Path to a cert. file for the certificate authority.
--client-certificate="": Path to a client key file for TLS.
--client-key="": Path to a client key file for TLS.
--cluster="": The name of the kubeconfig cluster to use
--context="": The name of the kubeconfig context to use
--insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
--log_backtrace_at=:0: when logging hits line file:N, emit a stack trace
--log_dir=: If non-empty, write log files in this directory
--log_flush_frequency=5s: Maximum number of seconds between log flushes
--logtostderr=true: log to standard error instead of files
--match-server-version=false: Require server version to match client version
--namespace="": If present, the namespace scope for this CLI request.
--password="": Password for basic authentication to the API server.
-s, --server="": The address and port of the Kubernetes API server
--stderrthreshold=2: logs at or above this threshold go to stderr
--token="": Bearer token for authentication to the API server.
--user="": The name of the kubeconfig user to use
--username="": Username for basic authentication to the API server.
--v=0: log level for V logs
--validate=false: If true, use a schema to validate the input before sending it
--vmodule=: comma-separated list of pattern=N settings for file-filtered logging
```
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
* [kubectl config set](kubectl_config_set.md) - Sets an individual value in a .kubeconfig file
* [kubectl config set-cluster](kubectl_config_set-cluster.md) - Sets a cluster entry in .kubeconfig
* [kubectl config set-context](kubectl_config_set-context.md) - Sets a context entry in .kubeconfig
* [kubectl config set-credentials](kubectl_config_set-credentials.md) - Sets a user entry in .kubeconfig
* [kubectl config unset](kubectl_config_unset.md) - Unsets an individual value in a .kubeconfig file
* [kubectl config use-context](kubectl_config_use-context.md) - Sets the current-context in a .kubeconfig file
* [kubectl config view](kubectl_config_view.md) - displays merged .kubeconfig settings or a specified .kubeconfig file.
2015-04-07 03:38:51 +00:00
|
|
|
}
|
|
|
|
|
2017-04-24 18:42:49 +00:00
|
|
|
if err := printOptions(buf, cmd, name); err != nil {
|
2016-01-06 10:59:28 +00:00
|
|
|
return err
|
|
|
|
}
|
2015-11-23 23:19:16 +00:00
|
|
|
if hasSeeAlso(cmd) {
|
2017-12-04 10:43:02 +00:00
|
|
|
buf.WriteString("### SEE ALSO\n\n")
|
Auto generation of markdown docs!
An example from the kubernetes project, for the `kubectl config`
command, which as subcommands, and flags, and all sorts of stuff, it
will generate markdown like so:
config modifies .kubeconfig files
config modifies .kubeconfig files using subcommands like "kubectl config set current-context my-context"
```
kubectl config SUBCOMMAND
```
```
--envvar=false: use the .kubeconfig from $KUBECONFIG
--global=false: use the .kubeconfig from /home/username
-h, --help=false: help for config
--kubeconfig="": use a particular .kubeconfig file
--local=false: use the .kubeconfig in the current directory
```
```
--alsologtostderr=false: log to standard error as well as files
--api-version="": The API version to use when talking to the server
-a, --auth-path="": Path to the auth info file. If missing, prompt the user. Only used if using https.
--certificate-authority="": Path to a cert. file for the certificate authority.
--client-certificate="": Path to a client key file for TLS.
--client-key="": Path to a client key file for TLS.
--cluster="": The name of the kubeconfig cluster to use
--context="": The name of the kubeconfig context to use
--insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
--log_backtrace_at=:0: when logging hits line file:N, emit a stack trace
--log_dir=: If non-empty, write log files in this directory
--log_flush_frequency=5s: Maximum number of seconds between log flushes
--logtostderr=true: log to standard error instead of files
--match-server-version=false: Require server version to match client version
--namespace="": If present, the namespace scope for this CLI request.
--password="": Password for basic authentication to the API server.
-s, --server="": The address and port of the Kubernetes API server
--stderrthreshold=2: logs at or above this threshold go to stderr
--token="": Bearer token for authentication to the API server.
--user="": The name of the kubeconfig user to use
--username="": Username for basic authentication to the API server.
--v=0: log level for V logs
--validate=false: If true, use a schema to validate the input before sending it
--vmodule=: comma-separated list of pattern=N settings for file-filtered logging
```
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
* [kubectl config set](kubectl_config_set.md) - Sets an individual value in a .kubeconfig file
* [kubectl config set-cluster](kubectl_config_set-cluster.md) - Sets a cluster entry in .kubeconfig
* [kubectl config set-context](kubectl_config_set-context.md) - Sets a context entry in .kubeconfig
* [kubectl config set-credentials](kubectl_config_set-credentials.md) - Sets a user entry in .kubeconfig
* [kubectl config unset](kubectl_config_unset.md) - Unsets an individual value in a .kubeconfig file
* [kubectl config use-context](kubectl_config_use-context.md) - Sets the current-context in a .kubeconfig file
* [kubectl config view](kubectl_config_view.md) - displays merged .kubeconfig settings or a specified .kubeconfig file.
2015-04-07 03:38:51 +00:00
|
|
|
if cmd.HasParent() {
|
|
|
|
parent := cmd.Parent()
|
|
|
|
pname := parent.CommandPath()
|
|
|
|
link := pname + ".md"
|
|
|
|
link = strings.Replace(link, " ", "_", -1)
|
2017-04-24 18:42:49 +00:00
|
|
|
buf.WriteString(fmt.Sprintf("* [%s](%s)\t - %s\n", pname, linkHandler(link), parent.Short))
|
2015-11-23 23:19:16 +00:00
|
|
|
cmd.VisitParents(func(c *cobra.Command) {
|
2015-11-08 01:21:25 +00:00
|
|
|
if c.DisableAutoGenTag {
|
|
|
|
cmd.DisableAutoGenTag = c.DisableAutoGenTag
|
|
|
|
}
|
|
|
|
})
|
Auto generation of markdown docs!
An example from the kubernetes project, for the `kubectl config`
command, which as subcommands, and flags, and all sorts of stuff, it
will generate markdown like so:
config modifies .kubeconfig files
config modifies .kubeconfig files using subcommands like "kubectl config set current-context my-context"
```
kubectl config SUBCOMMAND
```
```
--envvar=false: use the .kubeconfig from $KUBECONFIG
--global=false: use the .kubeconfig from /home/username
-h, --help=false: help for config
--kubeconfig="": use a particular .kubeconfig file
--local=false: use the .kubeconfig in the current directory
```
```
--alsologtostderr=false: log to standard error as well as files
--api-version="": The API version to use when talking to the server
-a, --auth-path="": Path to the auth info file. If missing, prompt the user. Only used if using https.
--certificate-authority="": Path to a cert. file for the certificate authority.
--client-certificate="": Path to a client key file for TLS.
--client-key="": Path to a client key file for TLS.
--cluster="": The name of the kubeconfig cluster to use
--context="": The name of the kubeconfig context to use
--insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
--log_backtrace_at=:0: when logging hits line file:N, emit a stack trace
--log_dir=: If non-empty, write log files in this directory
--log_flush_frequency=5s: Maximum number of seconds between log flushes
--logtostderr=true: log to standard error instead of files
--match-server-version=false: Require server version to match client version
--namespace="": If present, the namespace scope for this CLI request.
--password="": Password for basic authentication to the API server.
-s, --server="": The address and port of the Kubernetes API server
--stderrthreshold=2: logs at or above this threshold go to stderr
--token="": Bearer token for authentication to the API server.
--user="": The name of the kubeconfig user to use
--username="": Username for basic authentication to the API server.
--v=0: log level for V logs
--validate=false: If true, use a schema to validate the input before sending it
--vmodule=: comma-separated list of pattern=N settings for file-filtered logging
```
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
* [kubectl config set](kubectl_config_set.md) - Sets an individual value in a .kubeconfig file
* [kubectl config set-cluster](kubectl_config_set-cluster.md) - Sets a cluster entry in .kubeconfig
* [kubectl config set-context](kubectl_config_set-context.md) - Sets a context entry in .kubeconfig
* [kubectl config set-credentials](kubectl_config_set-credentials.md) - Sets a user entry in .kubeconfig
* [kubectl config unset](kubectl_config_unset.md) - Unsets an individual value in a .kubeconfig file
* [kubectl config use-context](kubectl_config_use-context.md) - Sets the current-context in a .kubeconfig file
* [kubectl config view](kubectl_config_view.md) - displays merged .kubeconfig settings or a specified .kubeconfig file.
2015-04-07 03:38:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
children := cmd.Commands()
|
|
|
|
sort.Sort(byName(children))
|
|
|
|
|
|
|
|
for _, child := range children {
|
2017-03-09 15:37:15 +00:00
|
|
|
if !child.IsAvailableCommand() || child.IsAdditionalHelpTopicCommand() {
|
2015-04-07 21:38:22 +00:00
|
|
|
continue
|
|
|
|
}
|
Auto generation of markdown docs!
An example from the kubernetes project, for the `kubectl config`
command, which as subcommands, and flags, and all sorts of stuff, it
will generate markdown like so:
config modifies .kubeconfig files
config modifies .kubeconfig files using subcommands like "kubectl config set current-context my-context"
```
kubectl config SUBCOMMAND
```
```
--envvar=false: use the .kubeconfig from $KUBECONFIG
--global=false: use the .kubeconfig from /home/username
-h, --help=false: help for config
--kubeconfig="": use a particular .kubeconfig file
--local=false: use the .kubeconfig in the current directory
```
```
--alsologtostderr=false: log to standard error as well as files
--api-version="": The API version to use when talking to the server
-a, --auth-path="": Path to the auth info file. If missing, prompt the user. Only used if using https.
--certificate-authority="": Path to a cert. file for the certificate authority.
--client-certificate="": Path to a client key file for TLS.
--client-key="": Path to a client key file for TLS.
--cluster="": The name of the kubeconfig cluster to use
--context="": The name of the kubeconfig context to use
--insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
--log_backtrace_at=:0: when logging hits line file:N, emit a stack trace
--log_dir=: If non-empty, write log files in this directory
--log_flush_frequency=5s: Maximum number of seconds between log flushes
--logtostderr=true: log to standard error instead of files
--match-server-version=false: Require server version to match client version
--namespace="": If present, the namespace scope for this CLI request.
--password="": Password for basic authentication to the API server.
-s, --server="": The address and port of the Kubernetes API server
--stderrthreshold=2: logs at or above this threshold go to stderr
--token="": Bearer token for authentication to the API server.
--user="": The name of the kubeconfig user to use
--username="": Username for basic authentication to the API server.
--v=0: log level for V logs
--validate=false: If true, use a schema to validate the input before sending it
--vmodule=: comma-separated list of pattern=N settings for file-filtered logging
```
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
* [kubectl config set](kubectl_config_set.md) - Sets an individual value in a .kubeconfig file
* [kubectl config set-cluster](kubectl_config_set-cluster.md) - Sets a cluster entry in .kubeconfig
* [kubectl config set-context](kubectl_config_set-context.md) - Sets a context entry in .kubeconfig
* [kubectl config set-credentials](kubectl_config_set-credentials.md) - Sets a user entry in .kubeconfig
* [kubectl config unset](kubectl_config_unset.md) - Unsets an individual value in a .kubeconfig file
* [kubectl config use-context](kubectl_config_use-context.md) - Sets the current-context in a .kubeconfig file
* [kubectl config view](kubectl_config_view.md) - displays merged .kubeconfig settings or a specified .kubeconfig file.
2015-04-07 03:38:51 +00:00
|
|
|
cname := name + " " + child.Name()
|
|
|
|
link := cname + ".md"
|
|
|
|
link = strings.Replace(link, " ", "_", -1)
|
2017-04-24 18:42:49 +00:00
|
|
|
buf.WriteString(fmt.Sprintf("* [%s](%s)\t - %s\n", cname, linkHandler(link), child.Short))
|
Auto generation of markdown docs!
An example from the kubernetes project, for the `kubectl config`
command, which as subcommands, and flags, and all sorts of stuff, it
will generate markdown like so:
config modifies .kubeconfig files
config modifies .kubeconfig files using subcommands like "kubectl config set current-context my-context"
```
kubectl config SUBCOMMAND
```
```
--envvar=false: use the .kubeconfig from $KUBECONFIG
--global=false: use the .kubeconfig from /home/username
-h, --help=false: help for config
--kubeconfig="": use a particular .kubeconfig file
--local=false: use the .kubeconfig in the current directory
```
```
--alsologtostderr=false: log to standard error as well as files
--api-version="": The API version to use when talking to the server
-a, --auth-path="": Path to the auth info file. If missing, prompt the user. Only used if using https.
--certificate-authority="": Path to a cert. file for the certificate authority.
--client-certificate="": Path to a client key file for TLS.
--client-key="": Path to a client key file for TLS.
--cluster="": The name of the kubeconfig cluster to use
--context="": The name of the kubeconfig context to use
--insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
--log_backtrace_at=:0: when logging hits line file:N, emit a stack trace
--log_dir=: If non-empty, write log files in this directory
--log_flush_frequency=5s: Maximum number of seconds between log flushes
--logtostderr=true: log to standard error instead of files
--match-server-version=false: Require server version to match client version
--namespace="": If present, the namespace scope for this CLI request.
--password="": Password for basic authentication to the API server.
-s, --server="": The address and port of the Kubernetes API server
--stderrthreshold=2: logs at or above this threshold go to stderr
--token="": Bearer token for authentication to the API server.
--user="": The name of the kubeconfig user to use
--username="": Username for basic authentication to the API server.
--v=0: log level for V logs
--validate=false: If true, use a schema to validate the input before sending it
--vmodule=: comma-separated list of pattern=N settings for file-filtered logging
```
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
* [kubectl config set](kubectl_config_set.md) - Sets an individual value in a .kubeconfig file
* [kubectl config set-cluster](kubectl_config_set-cluster.md) - Sets a cluster entry in .kubeconfig
* [kubectl config set-context](kubectl_config_set-context.md) - Sets a context entry in .kubeconfig
* [kubectl config set-credentials](kubectl_config_set-credentials.md) - Sets a user entry in .kubeconfig
* [kubectl config unset](kubectl_config_unset.md) - Unsets an individual value in a .kubeconfig file
* [kubectl config use-context](kubectl_config_use-context.md) - Sets the current-context in a .kubeconfig file
* [kubectl config view](kubectl_config_view.md) - displays merged .kubeconfig settings or a specified .kubeconfig file.
2015-04-07 03:38:51 +00:00
|
|
|
}
|
2017-04-24 18:42:49 +00:00
|
|
|
buf.WriteString("\n")
|
Auto generation of markdown docs!
An example from the kubernetes project, for the `kubectl config`
command, which as subcommands, and flags, and all sorts of stuff, it
will generate markdown like so:
config modifies .kubeconfig files
config modifies .kubeconfig files using subcommands like "kubectl config set current-context my-context"
```
kubectl config SUBCOMMAND
```
```
--envvar=false: use the .kubeconfig from $KUBECONFIG
--global=false: use the .kubeconfig from /home/username
-h, --help=false: help for config
--kubeconfig="": use a particular .kubeconfig file
--local=false: use the .kubeconfig in the current directory
```
```
--alsologtostderr=false: log to standard error as well as files
--api-version="": The API version to use when talking to the server
-a, --auth-path="": Path to the auth info file. If missing, prompt the user. Only used if using https.
--certificate-authority="": Path to a cert. file for the certificate authority.
--client-certificate="": Path to a client key file for TLS.
--client-key="": Path to a client key file for TLS.
--cluster="": The name of the kubeconfig cluster to use
--context="": The name of the kubeconfig context to use
--insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
--log_backtrace_at=:0: when logging hits line file:N, emit a stack trace
--log_dir=: If non-empty, write log files in this directory
--log_flush_frequency=5s: Maximum number of seconds between log flushes
--logtostderr=true: log to standard error instead of files
--match-server-version=false: Require server version to match client version
--namespace="": If present, the namespace scope for this CLI request.
--password="": Password for basic authentication to the API server.
-s, --server="": The address and port of the Kubernetes API server
--stderrthreshold=2: logs at or above this threshold go to stderr
--token="": Bearer token for authentication to the API server.
--user="": The name of the kubeconfig user to use
--username="": Username for basic authentication to the API server.
--v=0: log level for V logs
--validate=false: If true, use a schema to validate the input before sending it
--vmodule=: comma-separated list of pattern=N settings for file-filtered logging
```
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
* [kubectl config set](kubectl_config_set.md) - Sets an individual value in a .kubeconfig file
* [kubectl config set-cluster](kubectl_config_set-cluster.md) - Sets a cluster entry in .kubeconfig
* [kubectl config set-context](kubectl_config_set-context.md) - Sets a context entry in .kubeconfig
* [kubectl config set-credentials](kubectl_config_set-credentials.md) - Sets a user entry in .kubeconfig
* [kubectl config unset](kubectl_config_unset.md) - Unsets an individual value in a .kubeconfig file
* [kubectl config use-context](kubectl_config_use-context.md) - Sets the current-context in a .kubeconfig file
* [kubectl config view](kubectl_config_view.md) - displays merged .kubeconfig settings or a specified .kubeconfig file.
2015-04-07 03:38:51 +00:00
|
|
|
}
|
2015-11-08 01:21:25 +00:00
|
|
|
if !cmd.DisableAutoGenTag {
|
2017-04-24 18:42:49 +00:00
|
|
|
buf.WriteString("###### Auto generated by spf13/cobra on " + time.Now().Format("2-Jan-2006") + "\n")
|
2015-11-08 01:21:25 +00:00
|
|
|
}
|
2017-04-24 18:42:49 +00:00
|
|
|
_, err := buf.WriteTo(w)
|
|
|
|
return err
|
Auto generation of markdown docs!
An example from the kubernetes project, for the `kubectl config`
command, which as subcommands, and flags, and all sorts of stuff, it
will generate markdown like so:
config modifies .kubeconfig files
config modifies .kubeconfig files using subcommands like "kubectl config set current-context my-context"
```
kubectl config SUBCOMMAND
```
```
--envvar=false: use the .kubeconfig from $KUBECONFIG
--global=false: use the .kubeconfig from /home/username
-h, --help=false: help for config
--kubeconfig="": use a particular .kubeconfig file
--local=false: use the .kubeconfig in the current directory
```
```
--alsologtostderr=false: log to standard error as well as files
--api-version="": The API version to use when talking to the server
-a, --auth-path="": Path to the auth info file. If missing, prompt the user. Only used if using https.
--certificate-authority="": Path to a cert. file for the certificate authority.
--client-certificate="": Path to a client key file for TLS.
--client-key="": Path to a client key file for TLS.
--cluster="": The name of the kubeconfig cluster to use
--context="": The name of the kubeconfig context to use
--insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
--log_backtrace_at=:0: when logging hits line file:N, emit a stack trace
--log_dir=: If non-empty, write log files in this directory
--log_flush_frequency=5s: Maximum number of seconds between log flushes
--logtostderr=true: log to standard error instead of files
--match-server-version=false: Require server version to match client version
--namespace="": If present, the namespace scope for this CLI request.
--password="": Password for basic authentication to the API server.
-s, --server="": The address and port of the Kubernetes API server
--stderrthreshold=2: logs at or above this threshold go to stderr
--token="": Bearer token for authentication to the API server.
--user="": The name of the kubeconfig user to use
--username="": Username for basic authentication to the API server.
--v=0: log level for V logs
--validate=false: If true, use a schema to validate the input before sending it
--vmodule=: comma-separated list of pattern=N settings for file-filtered logging
```
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
* [kubectl config set](kubectl_config_set.md) - Sets an individual value in a .kubeconfig file
* [kubectl config set-cluster](kubectl_config_set-cluster.md) - Sets a cluster entry in .kubeconfig
* [kubectl config set-context](kubectl_config_set-context.md) - Sets a context entry in .kubeconfig
* [kubectl config set-credentials](kubectl_config_set-credentials.md) - Sets a user entry in .kubeconfig
* [kubectl config unset](kubectl_config_unset.md) - Unsets an individual value in a .kubeconfig file
* [kubectl config use-context](kubectl_config_use-context.md) - Sets the current-context in a .kubeconfig file
* [kubectl config view](kubectl_config_view.md) - displays merged .kubeconfig settings or a specified .kubeconfig file.
2015-04-07 03:38:51 +00:00
|
|
|
}
|
|
|
|
|
2017-04-19 12:39:58 +00:00
|
|
|
// GenMarkdownTree will generate a markdown page for this command and all
|
|
|
|
// descendants in the directory given. The header may be nil.
|
|
|
|
// This function may not work correctly if your command names have `-` in them.
|
|
|
|
// If you have `cmd` with two subcmds, `sub` and `sub-third`,
|
|
|
|
// and `sub` has a subcommand called `third`, it is undefined which
|
|
|
|
// help output will be in the file `cmd-sub-third.1`.
|
2016-01-06 10:59:28 +00:00
|
|
|
func GenMarkdownTree(cmd *cobra.Command, dir string) error {
|
2015-05-21 00:21:00 +00:00
|
|
|
identity := func(s string) string { return s }
|
|
|
|
emptyStr := func(s string) string { return "" }
|
2021-01-23 23:05:55 +00:00
|
|
|
return GenMarkdownTreeCustom(cmd, dir, emptyStr, identity)
|
2015-08-18 22:33:41 +00:00
|
|
|
}
|
|
|
|
|
2017-05-09 09:14:48 +00:00
|
|
|
// GenMarkdownTreeCustom is the the same as GenMarkdownTree, but
|
2021-01-23 23:05:55 +00:00
|
|
|
// with custom filePrepender and linkHandler.
|
|
|
|
func GenMarkdownTreeCustom(cmd *cobra.Command, dir string, filePrepender, linkHandler func(string) string) error {
|
Auto generation of markdown docs!
An example from the kubernetes project, for the `kubectl config`
command, which as subcommands, and flags, and all sorts of stuff, it
will generate markdown like so:
config modifies .kubeconfig files
config modifies .kubeconfig files using subcommands like "kubectl config set current-context my-context"
```
kubectl config SUBCOMMAND
```
```
--envvar=false: use the .kubeconfig from $KUBECONFIG
--global=false: use the .kubeconfig from /home/username
-h, --help=false: help for config
--kubeconfig="": use a particular .kubeconfig file
--local=false: use the .kubeconfig in the current directory
```
```
--alsologtostderr=false: log to standard error as well as files
--api-version="": The API version to use when talking to the server
-a, --auth-path="": Path to the auth info file. If missing, prompt the user. Only used if using https.
--certificate-authority="": Path to a cert. file for the certificate authority.
--client-certificate="": Path to a client key file for TLS.
--client-key="": Path to a client key file for TLS.
--cluster="": The name of the kubeconfig cluster to use
--context="": The name of the kubeconfig context to use
--insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
--log_backtrace_at=:0: when logging hits line file:N, emit a stack trace
--log_dir=: If non-empty, write log files in this directory
--log_flush_frequency=5s: Maximum number of seconds between log flushes
--logtostderr=true: log to standard error instead of files
--match-server-version=false: Require server version to match client version
--namespace="": If present, the namespace scope for this CLI request.
--password="": Password for basic authentication to the API server.
-s, --server="": The address and port of the Kubernetes API server
--stderrthreshold=2: logs at or above this threshold go to stderr
--token="": Bearer token for authentication to the API server.
--user="": The name of the kubeconfig user to use
--username="": Username for basic authentication to the API server.
--v=0: log level for V logs
--validate=false: If true, use a schema to validate the input before sending it
--vmodule=: comma-separated list of pattern=N settings for file-filtered logging
```
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
* [kubectl config set](kubectl_config_set.md) - Sets an individual value in a .kubeconfig file
* [kubectl config set-cluster](kubectl_config_set-cluster.md) - Sets a cluster entry in .kubeconfig
* [kubectl config set-context](kubectl_config_set-context.md) - Sets a context entry in .kubeconfig
* [kubectl config set-credentials](kubectl_config_set-credentials.md) - Sets a user entry in .kubeconfig
* [kubectl config unset](kubectl_config_unset.md) - Unsets an individual value in a .kubeconfig file
* [kubectl config use-context](kubectl_config_use-context.md) - Sets the current-context in a .kubeconfig file
* [kubectl config view](kubectl_config_view.md) - displays merged .kubeconfig settings or a specified .kubeconfig file.
2015-04-07 03:38:51 +00:00
|
|
|
for _, c := range cmd.Commands() {
|
2017-03-09 15:37:15 +00:00
|
|
|
if !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() {
|
2015-08-18 22:33:41 +00:00
|
|
|
continue
|
|
|
|
}
|
2021-01-23 23:05:55 +00:00
|
|
|
if err := GenMarkdownTreeCustom(c, dir, filePrepender, linkHandler); err != nil {
|
2016-01-06 10:59:28 +00:00
|
|
|
return err
|
|
|
|
}
|
Auto generation of markdown docs!
An example from the kubernetes project, for the `kubectl config`
command, which as subcommands, and flags, and all sorts of stuff, it
will generate markdown like so:
config modifies .kubeconfig files
config modifies .kubeconfig files using subcommands like "kubectl config set current-context my-context"
```
kubectl config SUBCOMMAND
```
```
--envvar=false: use the .kubeconfig from $KUBECONFIG
--global=false: use the .kubeconfig from /home/username
-h, --help=false: help for config
--kubeconfig="": use a particular .kubeconfig file
--local=false: use the .kubeconfig in the current directory
```
```
--alsologtostderr=false: log to standard error as well as files
--api-version="": The API version to use when talking to the server
-a, --auth-path="": Path to the auth info file. If missing, prompt the user. Only used if using https.
--certificate-authority="": Path to a cert. file for the certificate authority.
--client-certificate="": Path to a client key file for TLS.
--client-key="": Path to a client key file for TLS.
--cluster="": The name of the kubeconfig cluster to use
--context="": The name of the kubeconfig context to use
--insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
--log_backtrace_at=:0: when logging hits line file:N, emit a stack trace
--log_dir=: If non-empty, write log files in this directory
--log_flush_frequency=5s: Maximum number of seconds between log flushes
--logtostderr=true: log to standard error instead of files
--match-server-version=false: Require server version to match client version
--namespace="": If present, the namespace scope for this CLI request.
--password="": Password for basic authentication to the API server.
-s, --server="": The address and port of the Kubernetes API server
--stderrthreshold=2: logs at or above this threshold go to stderr
--token="": Bearer token for authentication to the API server.
--user="": The name of the kubeconfig user to use
--username="": Username for basic authentication to the API server.
--v=0: log level for V logs
--validate=false: If true, use a schema to validate the input before sending it
--vmodule=: comma-separated list of pattern=N settings for file-filtered logging
```
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
* [kubectl config set](kubectl_config_set.md) - Sets an individual value in a .kubeconfig file
* [kubectl config set-cluster](kubectl_config_set-cluster.md) - Sets a cluster entry in .kubeconfig
* [kubectl config set-context](kubectl_config_set-context.md) - Sets a context entry in .kubeconfig
* [kubectl config set-credentials](kubectl_config_set-credentials.md) - Sets a user entry in .kubeconfig
* [kubectl config unset](kubectl_config_unset.md) - Unsets an individual value in a .kubeconfig file
* [kubectl config use-context](kubectl_config_use-context.md) - Sets the current-context in a .kubeconfig file
* [kubectl config view](kubectl_config_view.md) - displays merged .kubeconfig settings or a specified .kubeconfig file.
2015-04-07 03:38:51 +00:00
|
|
|
}
|
|
|
|
|
2016-01-17 00:24:54 +00:00
|
|
|
basename := strings.Replace(cmd.CommandPath(), " ", "_", -1) + ".md"
|
|
|
|
filename := filepath.Join(dir, basename)
|
2016-01-06 10:59:28 +00:00
|
|
|
f, err := os.Create(filename)
|
Auto generation of markdown docs!
An example from the kubernetes project, for the `kubectl config`
command, which as subcommands, and flags, and all sorts of stuff, it
will generate markdown like so:
config modifies .kubeconfig files
config modifies .kubeconfig files using subcommands like "kubectl config set current-context my-context"
```
kubectl config SUBCOMMAND
```
```
--envvar=false: use the .kubeconfig from $KUBECONFIG
--global=false: use the .kubeconfig from /home/username
-h, --help=false: help for config
--kubeconfig="": use a particular .kubeconfig file
--local=false: use the .kubeconfig in the current directory
```
```
--alsologtostderr=false: log to standard error as well as files
--api-version="": The API version to use when talking to the server
-a, --auth-path="": Path to the auth info file. If missing, prompt the user. Only used if using https.
--certificate-authority="": Path to a cert. file for the certificate authority.
--client-certificate="": Path to a client key file for TLS.
--client-key="": Path to a client key file for TLS.
--cluster="": The name of the kubeconfig cluster to use
--context="": The name of the kubeconfig context to use
--insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
--log_backtrace_at=:0: when logging hits line file:N, emit a stack trace
--log_dir=: If non-empty, write log files in this directory
--log_flush_frequency=5s: Maximum number of seconds between log flushes
--logtostderr=true: log to standard error instead of files
--match-server-version=false: Require server version to match client version
--namespace="": If present, the namespace scope for this CLI request.
--password="": Password for basic authentication to the API server.
-s, --server="": The address and port of the Kubernetes API server
--stderrthreshold=2: logs at or above this threshold go to stderr
--token="": Bearer token for authentication to the API server.
--user="": The name of the kubeconfig user to use
--username="": Username for basic authentication to the API server.
--v=0: log level for V logs
--validate=false: If true, use a schema to validate the input before sending it
--vmodule=: comma-separated list of pattern=N settings for file-filtered logging
```
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
* [kubectl config set](kubectl_config_set.md) - Sets an individual value in a .kubeconfig file
* [kubectl config set-cluster](kubectl_config_set-cluster.md) - Sets a cluster entry in .kubeconfig
* [kubectl config set-context](kubectl_config_set-context.md) - Sets a context entry in .kubeconfig
* [kubectl config set-credentials](kubectl_config_set-credentials.md) - Sets a user entry in .kubeconfig
* [kubectl config unset](kubectl_config_unset.md) - Unsets an individual value in a .kubeconfig file
* [kubectl config use-context](kubectl_config_use-context.md) - Sets the current-context in a .kubeconfig file
* [kubectl config view](kubectl_config_view.md) - displays merged .kubeconfig settings or a specified .kubeconfig file.
2015-04-07 03:38:51 +00:00
|
|
|
if err != nil {
|
2016-01-06 10:59:28 +00:00
|
|
|
return err
|
Auto generation of markdown docs!
An example from the kubernetes project, for the `kubectl config`
command, which as subcommands, and flags, and all sorts of stuff, it
will generate markdown like so:
config modifies .kubeconfig files
config modifies .kubeconfig files using subcommands like "kubectl config set current-context my-context"
```
kubectl config SUBCOMMAND
```
```
--envvar=false: use the .kubeconfig from $KUBECONFIG
--global=false: use the .kubeconfig from /home/username
-h, --help=false: help for config
--kubeconfig="": use a particular .kubeconfig file
--local=false: use the .kubeconfig in the current directory
```
```
--alsologtostderr=false: log to standard error as well as files
--api-version="": The API version to use when talking to the server
-a, --auth-path="": Path to the auth info file. If missing, prompt the user. Only used if using https.
--certificate-authority="": Path to a cert. file for the certificate authority.
--client-certificate="": Path to a client key file for TLS.
--client-key="": Path to a client key file for TLS.
--cluster="": The name of the kubeconfig cluster to use
--context="": The name of the kubeconfig context to use
--insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
--log_backtrace_at=:0: when logging hits line file:N, emit a stack trace
--log_dir=: If non-empty, write log files in this directory
--log_flush_frequency=5s: Maximum number of seconds between log flushes
--logtostderr=true: log to standard error instead of files
--match-server-version=false: Require server version to match client version
--namespace="": If present, the namespace scope for this CLI request.
--password="": Password for basic authentication to the API server.
-s, --server="": The address and port of the Kubernetes API server
--stderrthreshold=2: logs at or above this threshold go to stderr
--token="": Bearer token for authentication to the API server.
--user="": The name of the kubeconfig user to use
--username="": Username for basic authentication to the API server.
--v=0: log level for V logs
--validate=false: If true, use a schema to validate the input before sending it
--vmodule=: comma-separated list of pattern=N settings for file-filtered logging
```
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
* [kubectl config set](kubectl_config_set.md) - Sets an individual value in a .kubeconfig file
* [kubectl config set-cluster](kubectl_config_set-cluster.md) - Sets a cluster entry in .kubeconfig
* [kubectl config set-context](kubectl_config_set-context.md) - Sets a context entry in .kubeconfig
* [kubectl config set-credentials](kubectl_config_set-credentials.md) - Sets a user entry in .kubeconfig
* [kubectl config unset](kubectl_config_unset.md) - Unsets an individual value in a .kubeconfig file
* [kubectl config use-context](kubectl_config_use-context.md) - Sets the current-context in a .kubeconfig file
* [kubectl config view](kubectl_config_view.md) - displays merged .kubeconfig settings or a specified .kubeconfig file.
2015-04-07 03:38:51 +00:00
|
|
|
}
|
2016-01-06 10:59:28 +00:00
|
|
|
defer f.Close()
|
|
|
|
|
|
|
|
if _, err := io.WriteString(f, filePrepender(filename)); err != nil {
|
|
|
|
return err
|
2015-05-13 09:27:18 +00:00
|
|
|
}
|
2016-01-06 10:59:28 +00:00
|
|
|
if err := GenMarkdownCustom(cmd, f, linkHandler); err != nil {
|
|
|
|
return err
|
Auto generation of markdown docs!
An example from the kubernetes project, for the `kubectl config`
command, which as subcommands, and flags, and all sorts of stuff, it
will generate markdown like so:
config modifies .kubeconfig files
config modifies .kubeconfig files using subcommands like "kubectl config set current-context my-context"
```
kubectl config SUBCOMMAND
```
```
--envvar=false: use the .kubeconfig from $KUBECONFIG
--global=false: use the .kubeconfig from /home/username
-h, --help=false: help for config
--kubeconfig="": use a particular .kubeconfig file
--local=false: use the .kubeconfig in the current directory
```
```
--alsologtostderr=false: log to standard error as well as files
--api-version="": The API version to use when talking to the server
-a, --auth-path="": Path to the auth info file. If missing, prompt the user. Only used if using https.
--certificate-authority="": Path to a cert. file for the certificate authority.
--client-certificate="": Path to a client key file for TLS.
--client-key="": Path to a client key file for TLS.
--cluster="": The name of the kubeconfig cluster to use
--context="": The name of the kubeconfig context to use
--insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
--log_backtrace_at=:0: when logging hits line file:N, emit a stack trace
--log_dir=: If non-empty, write log files in this directory
--log_flush_frequency=5s: Maximum number of seconds between log flushes
--logtostderr=true: log to standard error instead of files
--match-server-version=false: Require server version to match client version
--namespace="": If present, the namespace scope for this CLI request.
--password="": Password for basic authentication to the API server.
-s, --server="": The address and port of the Kubernetes API server
--stderrthreshold=2: logs at or above this threshold go to stderr
--token="": Bearer token for authentication to the API server.
--user="": The name of the kubeconfig user to use
--username="": Username for basic authentication to the API server.
--v=0: log level for V logs
--validate=false: If true, use a schema to validate the input before sending it
--vmodule=: comma-separated list of pattern=N settings for file-filtered logging
```
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
* [kubectl config set](kubectl_config_set.md) - Sets an individual value in a .kubeconfig file
* [kubectl config set-cluster](kubectl_config_set-cluster.md) - Sets a cluster entry in .kubeconfig
* [kubectl config set-context](kubectl_config_set-context.md) - Sets a context entry in .kubeconfig
* [kubectl config set-credentials](kubectl_config_set-credentials.md) - Sets a user entry in .kubeconfig
* [kubectl config unset](kubectl_config_unset.md) - Unsets an individual value in a .kubeconfig file
* [kubectl config use-context](kubectl_config_use-context.md) - Sets the current-context in a .kubeconfig file
* [kubectl config view](kubectl_config_view.md) - displays merged .kubeconfig settings or a specified .kubeconfig file.
2015-04-07 03:38:51 +00:00
|
|
|
}
|
2016-01-06 10:59:28 +00:00
|
|
|
return nil
|
Auto generation of markdown docs!
An example from the kubernetes project, for the `kubectl config`
command, which as subcommands, and flags, and all sorts of stuff, it
will generate markdown like so:
config modifies .kubeconfig files
config modifies .kubeconfig files using subcommands like "kubectl config set current-context my-context"
```
kubectl config SUBCOMMAND
```
```
--envvar=false: use the .kubeconfig from $KUBECONFIG
--global=false: use the .kubeconfig from /home/username
-h, --help=false: help for config
--kubeconfig="": use a particular .kubeconfig file
--local=false: use the .kubeconfig in the current directory
```
```
--alsologtostderr=false: log to standard error as well as files
--api-version="": The API version to use when talking to the server
-a, --auth-path="": Path to the auth info file. If missing, prompt the user. Only used if using https.
--certificate-authority="": Path to a cert. file for the certificate authority.
--client-certificate="": Path to a client key file for TLS.
--client-key="": Path to a client key file for TLS.
--cluster="": The name of the kubeconfig cluster to use
--context="": The name of the kubeconfig context to use
--insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
--log_backtrace_at=:0: when logging hits line file:N, emit a stack trace
--log_dir=: If non-empty, write log files in this directory
--log_flush_frequency=5s: Maximum number of seconds between log flushes
--logtostderr=true: log to standard error instead of files
--match-server-version=false: Require server version to match client version
--namespace="": If present, the namespace scope for this CLI request.
--password="": Password for basic authentication to the API server.
-s, --server="": The address and port of the Kubernetes API server
--stderrthreshold=2: logs at or above this threshold go to stderr
--token="": Bearer token for authentication to the API server.
--user="": The name of the kubeconfig user to use
--username="": Username for basic authentication to the API server.
--v=0: log level for V logs
--validate=false: If true, use a schema to validate the input before sending it
--vmodule=: comma-separated list of pattern=N settings for file-filtered logging
```
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
* [kubectl config set](kubectl_config_set.md) - Sets an individual value in a .kubeconfig file
* [kubectl config set-cluster](kubectl_config_set-cluster.md) - Sets a cluster entry in .kubeconfig
* [kubectl config set-context](kubectl_config_set-context.md) - Sets a context entry in .kubeconfig
* [kubectl config set-credentials](kubectl_config_set-credentials.md) - Sets a user entry in .kubeconfig
* [kubectl config unset](kubectl_config_unset.md) - Unsets an individual value in a .kubeconfig file
* [kubectl config use-context](kubectl_config_use-context.md) - Sets the current-context in a .kubeconfig file
* [kubectl config view](kubectl_config_view.md) - displays merged .kubeconfig settings or a specified .kubeconfig file.
2015-04-07 03:38:51 +00:00
|
|
|
}
|