From c66caa5336c093ec3c2021afb57202e3d0b99dd3 Mon Sep 17 00:00:00 2001 From: Brendan Burns Date: Mon, 16 Mar 2015 11:23:02 -0700 Subject: [PATCH 1/2] Revert "Revert "Update cobra/pflag. Also update generated kubectl documentation."" This reverts commit 69432e8b2fd5f29c8a9d6c08a7eafcef896eee4f. COMMIT_BLOCKED_ON_GENDOCS --- Godeps/Godeps.json | 4 +- .../src/github.com/spf13/cobra/cobra_test.go | 48 ++++- .../src/github.com/spf13/cobra/command.go | 202 +++++++++++------- .../src/github.com/spf13/pflag/bool_test.go | 2 +- .../github.com/spf13/pflag/example_test.go | 2 +- .../src/github.com/spf13/pflag/flag.go | 4 + docs/kubectl-clusterinfo.md | 7 +- docs/kubectl-config-set-cluster.md | 10 +- docs/kubectl-config-set-context.md | 13 +- docs/kubectl-config-set-credentials.md | 14 +- docs/kubectl-config-set.md | 7 +- docs/kubectl-config-unset.md | 7 +- docs/kubectl-config-use-context.md | 7 +- docs/kubectl-config-view.md | 2 +- docs/kubectl-config.md | 4 +- docs/kubectl-create.md | 2 +- docs/kubectl-delete.md | 2 +- docs/kubectl-describe.md | 7 +- docs/kubectl-exec.md | 2 +- docs/kubectl-expose.md | 5 +- docs/kubectl-get.md | 2 +- docs/kubectl-label.md | 2 +- docs/kubectl-log.md | 2 +- docs/kubectl-namespace.md | 7 +- docs/kubectl-port-forward.md | 2 +- docs/kubectl-proxy.md | 2 +- docs/kubectl-resize.md | 2 +- docs/kubectl-rollingupdate.md | 2 +- docs/kubectl-run-container.md | 2 +- docs/kubectl-stop.md | 2 +- docs/kubectl-update.md | 2 +- docs/kubectl-version.md | 2 +- docs/man/man1/kubectl-clusterinfo.1 | 10 +- docs/man/man1/kubectl-config-set-cluster.1 | 40 ++-- docs/man/man1/kubectl-config-set-context.1 | 34 +-- .../man/man1/kubectl-config-set-credentials.1 | 56 ++--- docs/man/man1/kubectl-config-set.1 | 10 +- docs/man/man1/kubectl-config-unset.1 | 10 +- docs/man/man1/kubectl-config-use-context.1 | 10 +- docs/man/man1/kubectl-config-view.1 | 8 +- docs/man/man1/kubectl-config.1 | 16 +- docs/man/man1/kubectl-create.1 | 8 +- docs/man/man1/kubectl-delete.1 | 8 +- docs/man/man1/kubectl-describe.1 | 10 +- docs/man/man1/kubectl-exec.1 | 8 +- docs/man/man1/kubectl-expose.1 | 9 +- docs/man/man1/kubectl-get.1 | 8 +- docs/man/man1/kubectl-label.1 | 8 +- docs/man/man1/kubectl-log.1 | 8 +- docs/man/man1/kubectl-namespace.1 | 10 +- docs/man/man1/kubectl-port-forward.1 | 8 +- docs/man/man1/kubectl-proxy.1 | 8 +- docs/man/man1/kubectl-resize.1 | 8 +- docs/man/man1/kubectl-rollingupdate.1 | 8 +- docs/man/man1/kubectl-run-container.1 | 8 +- docs/man/man1/kubectl-stop.1 | 8 +- docs/man/man1/kubectl-update.1 | 8 +- docs/man/man1/kubectl-version.1 | 8 +- 58 files changed, 426 insertions(+), 289 deletions(-) diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 23dd4db906..286897ea16 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -387,11 +387,11 @@ }, { "ImportPath": "github.com/spf13/cobra", - "Rev": "f8e1ec56bdd7494d309c69681267859a6bfb7549" + "Rev": "9e7273d5469dd5e04a35fd8823ba510117448c0b" }, { "ImportPath": "github.com/spf13/pflag", - "Rev": "370c3171201099fa6b466db45c8a032cbce33d8d" + "Rev": "11b7cf8387a31f278486eaad758162830eca8c73" }, { "ImportPath": "github.com/stretchr/objx", diff --git a/Godeps/_workspace/src/github.com/spf13/cobra/cobra_test.go b/Godeps/_workspace/src/github.com/spf13/cobra/cobra_test.go index 629865c210..fa1192277c 100644 --- a/Godeps/_workspace/src/github.com/spf13/cobra/cobra_test.go +++ b/Godeps/_workspace/src/github.com/spf13/cobra/cobra_test.go @@ -11,11 +11,14 @@ var _ = fmt.Println var tp, te, tt, t1 []string var flagb1, flagb2, flagb3, flagbr bool -var flags1, flags2, flags3 string +var flags1, flags2a, flags2b, flags3 string var flagi1, flagi2, flagi3, flagir int var globalFlag1 bool var flagEcho, rootcalled bool +const strtwoParentHelp = "help message for parent flag strtwo" +const strtwoChildHelp = "help message for child flag strtwo" + var cmdPrint = &Command{ Use: "print [string to print]", Short: "Print anything to the screen", @@ -72,11 +75,12 @@ func flagInit() { cmdRootNoRun.ResetFlags() cmdRootSameName.ResetFlags() cmdRootWithRun.ResetFlags() + cmdRootNoRun.PersistentFlags().StringVarP(&flags2a, "strtwo", "t", "two", strtwoParentHelp) cmdEcho.Flags().IntVarP(&flagi1, "intone", "i", 123, "help message for flag intone") cmdTimes.Flags().IntVarP(&flagi2, "inttwo", "j", 234, "help message for flag inttwo") cmdPrint.Flags().IntVarP(&flagi3, "intthree", "i", 345, "help message for flag intthree") cmdEcho.PersistentFlags().StringVarP(&flags1, "strone", "s", "one", "help message for flag strone") - cmdTimes.PersistentFlags().StringVarP(&flags2, "strtwo", "t", "two", "help message for flag strtwo") + cmdTimes.PersistentFlags().StringVarP(&flags2b, "strtwo", "t", "2", strtwoChildHelp) cmdPrint.PersistentFlags().StringVarP(&flags3, "strthree", "s", "three", "help message for flag strthree") cmdEcho.Flags().BoolVarP(&flagb1, "boolone", "b", true, "help message for flag boolone") cmdTimes.Flags().BoolVarP(&flagb2, "booltwo", "c", false, "help message for flag booltwo") @@ -377,10 +381,21 @@ func TestChildCommandFlags(t *testing.T) { t.Errorf("invalid flag should generate error") } - if !strings.Contains(r.Output, "intone=123") { + if !strings.Contains(r.Output, "unknown shorthand flag") { t.Errorf("Wrong error message displayed, \n %s", r.Output) } + // Testing with persistent flag overwritten by child + noRRSetupTest("echo times --strtwo=child one two") + + if flags2b != "child" { + t.Errorf("flag value should be child, %s given", flags2b) + } + + if flags2a != "two" { + t.Errorf("unset flag should have default value, expecting two, given %s", flags2a) + } + // Testing flag with invalid input r = noRRSetupTest("echo -i10E") @@ -437,6 +452,13 @@ func TestHelpCommand(t *testing.T) { checkResultContains(t, r, cmdTimes.Long) } +func TestChildCommandHelp(t *testing.T) { + c := noRRSetupTest("print --help") + checkResultContains(t, c, strtwoParentHelp) + r := noRRSetupTest("echo times --help") + checkResultContains(t, r, strtwoChildHelp) +} + func TestRunnableRootCommand(t *testing.T) { fullSetupTest("") @@ -486,6 +508,26 @@ func TestRootHelp(t *testing.T) { } +func TestFlagAccess(t *testing.T) { + initialize() + + local := cmdTimes.LocalFlags() + inherited := cmdTimes.InheritedFlags() + + for _, f := range []string{"inttwo", "strtwo", "booltwo"} { + if local.Lookup(f) == nil { + t.Errorf("LocalFlags expected to contain %s, Got: nil", f) + } + } + if inherited.Lookup("strone") == nil { + t.Errorf("InheritedFlags expected to contain strone, Got: nil") + } + if inherited.Lookup("strtwo") != nil { + t.Errorf("InheritedFlags shouldn not contain overwritten flag strtwo") + + } +} + func TestRootNoCommandHelp(t *testing.T) { x := rootOnlySetupTest("--help") diff --git a/Godeps/_workspace/src/github.com/spf13/cobra/command.go b/Godeps/_workspace/src/github.com/spf13/cobra/command.go index 6ac3ea70c5..82368e2673 100644 --- a/Godeps/_workspace/src/github.com/spf13/cobra/command.go +++ b/Godeps/_workspace/src/github.com/spf13/cobra/command.go @@ -46,6 +46,8 @@ type Command struct { flags *flag.FlagSet // Set of flags childrens of this command will inherit pflags *flag.FlagSet + // Flags that are declared specifically by this command (not inherited). + lflags *flag.FlagSet // Run runs the command. // The args are the arguments after the command name. Run func(cmd *Command, args []string) @@ -218,8 +220,8 @@ Available Commands: {{range .Commands}}{{if .Runnable}} {{end}} {{ if .HasLocalFlags}}Flags: {{.LocalFlags.FlagUsages}}{{end}} -{{ if .HasAnyPersistentFlags}}Global Flags: -{{.AllPersistentFlags.FlagUsages}}{{end}}{{if .HasParent}}{{if and (gt .Commands 0) (gt .Parent.Commands 1) }} +{{ if .HasInheritedFlags}}Global Flags: +{{.InheritedFlags.FlagUsages}}{{end}}{{if .HasParent}}{{if and (gt .Commands 0) (gt .Parent.Commands 1) }} Additional help topics: {{if gt .Commands 0 }}{{range .Commands}}{{if not .Runnable}} {{rpad .CommandPath .CommandPathPadding}} {{.Short}}{{end}}{{end}}{{end}}{{if gt .Parent.Commands 1 }}{{range .Parent.Commands}}{{if .Runnable}}{{if not (eq .Name $cmd.Name) }}{{end}} {{rpad .CommandPath .CommandPathPadding}} {{.Short}}{{end}}{{end}}{{end}}{{end}} {{end}}{{ if .HasSubCommands }} @@ -249,7 +251,27 @@ func (c *Command) resetChildrensParents() { } } -func stripFlags(args []string) []string { +// Test if the named flag is a boolean flag. +func isBooleanFlag(name string, f *flag.FlagSet) bool { + flag := f.Lookup(name) + if flag == nil { + return false + } + return flag.Value.Type() == "bool" +} + +// Test if the named flag is a boolean flag. +func isBooleanShortFlag(name string, f *flag.FlagSet) bool { + result := false + f.VisitAll(func(f *flag.Flag) { + if f.Shorthand == name && f.Value.Type() == "bool" { + result = true + } + }) + return result +} + +func stripFlags(args []string, c *Command) []string { if len(args) < 1 { return args } @@ -257,6 +279,7 @@ func stripFlags(args []string) []string { commands := []string{} inQuote := false + inFlag := false for _, y := range args { if !inQuote { switch { @@ -264,8 +287,16 @@ func stripFlags(args []string) []string { inQuote = true case strings.Contains(y, "=\""): inQuote = true + case strings.HasPrefix(y, "--") && !strings.Contains(y, "="): + // TODO: this isn't quite right, we should really check ahead for 'true' or 'false' + inFlag = !isBooleanFlag(y[2:], c.Flags()) + case strings.HasPrefix(y, "-") && !strings.Contains(y, "=") && len(y) == 2 && !isBooleanShortFlag(y[1:], c.Flags()): + inFlag = true + case inFlag: + inFlag = false case !strings.HasPrefix(y, "-"): commands = append(commands, y) + inFlag = false } } @@ -303,7 +334,7 @@ func (c *Command) Find(arrs []string) (*Command, []string, error) { innerfind = func(c *Command, args []string) (*Command, []string) { if len(args) > 0 && c.HasSubCommands() { - argsWOflags := stripFlags(args) + argsWOflags := stripFlags(args, c) if len(argsWOflags) > 0 { matches := make([]*Command, 0) for _, cmd := range c.commands { @@ -372,7 +403,10 @@ func (c *Command) execute(a []string) (err error) { } err = c.ParseFlags(a) - + if err == flag.ErrHelp { + c.Help() + return nil + } if err != nil { // We're writing subcommand usage to root command's error buffer to have it displayed to the user r := c.Root() @@ -460,14 +494,15 @@ func (c *Command) Execute() (err error) { if e != nil { // Flags parsing had an error. // If an error happens here, we have to report it to the user - c.Println(c.errorMsgFromParse()) + c.Println(e.Error()) // If an error happens search also for subcommand info about that if c.cmdErrorBuf != nil && c.cmdErrorBuf.Len() > 0 { c.Println(c.cmdErrorBuf.String()) } else { c.Usage() } - return e + err = e + return } else { // If help is called, regardless of other flags, we print that if c.helpFlagVal { @@ -491,9 +526,13 @@ func (c *Command) Execute() (err error) { } if err != nil { - c.Println("Error:", err.Error()) - c.Printf("%v: invalid command %#q\n", c.Root().Name(), os.Args[1:]) - c.Printf("Run '%v help' for usage\n", c.Root().Name()) + if err == flag.ErrHelp { + c.Help() + } else { + c.Println("Error:", err.Error()) + c.Printf("%v: invalid command %#q\n", c.Root().Name(), os.Args[1:]) + c.Printf("Run '%v help' for usage\n", c.Root().Name()) + } } return @@ -553,6 +592,40 @@ func (c *Command) AddCommand(cmds ...*Command) { } } +// AddCommand removes one or more commands from a parent command. +func (c *Command) RemoveCommand(cmds ...*Command) { + commands := []*Command{} +main: + for _, command := range c.commands { + for _, cmd := range cmds { + if command == cmd { + command.parent = nil + continue main + } + } + commands = append(commands, command) + } + c.commands = commands + // recompute all lengths + c.commandsMaxUseLen = 0 + c.commandsMaxCommandPathLen = 0 + c.commandsMaxNameLen = 0 + for _, command := range c.commands { + usageLen := len(command.Use) + if usageLen > c.commandsMaxUseLen { + c.commandsMaxUseLen = usageLen + } + commandPathLen := len(command.CommandPath()) + if commandPathLen > c.commandsMaxCommandPathLen { + c.commandsMaxCommandPathLen = commandPathLen + } + nameLen := len(command.Name()) + if nameLen > c.commandsMaxNameLen { + c.commandsMaxNameLen = nameLen + } + } +} + // Convenience method to Print to the defined output func (c *Command) Print(i ...interface{}) { fmt.Fprint(c.Out(), i...) @@ -726,14 +799,9 @@ func (c *Command) LocalFlags() *flag.FlagSet { c.mergePersistentFlags() local := flag.NewFlagSet(c.Name(), flag.ContinueOnError) - allPersistent := c.AllPersistentFlags() - - c.Flags().VisitAll(func(f *flag.Flag) { - if allPersistent.Lookup(f.Name) == nil { - local.AddFlag(f) - } + c.lflags.VisitAll(func(f *flag.Flag) { + local.AddFlag(f) }) - return local } @@ -741,44 +809,34 @@ func (c *Command) LocalFlags() *flag.FlagSet { func (c *Command) InheritedFlags() *flag.FlagSet { c.mergePersistentFlags() - local := flag.NewFlagSet(c.Name(), flag.ContinueOnError) + inherited := flag.NewFlagSet(c.Name(), flag.ContinueOnError) + local := c.LocalFlags() - var rmerge func(x *Command) + var rmerge func(x *Command) - rmerge = func(x *Command) { - if x.HasPersistentFlags() { - x.PersistentFlags().VisitAll(func(f *flag.Flag) { - if local.Lookup(f.Name) == nil { - local.AddFlag(f) - } - }) - } - if x.HasParent() { - rmerge(x.parent) - } - } + rmerge = func(x *Command) { + if x.HasPersistentFlags() { + x.PersistentFlags().VisitAll(func(f *flag.Flag) { + if inherited.Lookup(f.Name) == nil && local.Lookup(f.Name) == nil { + inherited.AddFlag(f) + } + }) + } + if x.HasParent() { + rmerge(x.parent) + } + } if c.HasParent() { rmerge(c.parent) } - return local + return inherited } // All Flags which were not inherited from parent commands func (c *Command) NonInheritedFlags() *flag.FlagSet { - c.mergePersistentFlags() - - local := flag.NewFlagSet(c.Name(), flag.ContinueOnError) - inheritedFlags := c.InheritedFlags() - - c.Flags().VisitAll(func(f *flag.Flag) { - if inheritedFlags.Lookup(f.Name) == nil { - local.AddFlag(f) - } - }) - - return local + return c.LocalFlags() } // Get the Persistent FlagSet specifically set in the current command @@ -793,29 +851,6 @@ func (c *Command) PersistentFlags() *flag.FlagSet { return c.pflags } -// Get the Persistent FlagSet traversing the Command hierarchy -func (c *Command) AllPersistentFlags() *flag.FlagSet { - allPersistent := flag.NewFlagSet(c.Name(), flag.ContinueOnError) - - var visit func(x *Command) - visit = func(x *Command) { - if x.HasPersistentFlags() { - x.PersistentFlags().VisitAll(func(f *flag.Flag) { - if allPersistent.Lookup(f.Name) == nil { - allPersistent.AddFlag(f) - } - }) - } - if x.HasParent() { - visit(x.parent) - } - } - - visit(c) - - return allPersistent -} - // For use in testing func (c *Command) ResetFlags() { c.flagErrorBuf = new(bytes.Buffer) @@ -836,16 +871,15 @@ func (c *Command) HasPersistentFlags() bool { return c.PersistentFlags().HasFlags() } -// Does the command hierarchy contain persistent flags -func (c *Command) HasAnyPersistentFlags() bool { - return c.AllPersistentFlags().HasFlags() -} - // Does the command has flags specifically declared locally func (c *Command) HasLocalFlags() bool { return c.LocalFlags().HasFlags() } +func (c *Command) HasInheritedFlags() bool { + return c.InheritedFlags().HasFlags() +} + // Climbs up the command tree looking for matching flag func (c *Command) Flag(name string) (flag *flag.Flag) { flag = c.Flags().Lookup(name) @@ -873,16 +907,7 @@ func (c *Command) persistentFlag(name string) (flag *flag.Flag) { func (c *Command) ParseFlags(args []string) (err error) { c.mergePersistentFlags() err = c.Flags().Parse(args) - - // The upstream library adds spaces to the error - // response regardless of success. - // Handling it here until fixing upstream - if len(strings.TrimSpace(c.flagErrorBuf.String())) > 1 { - return fmt.Errorf("%s", c.flagErrorBuf.String()) - } - - //always return nil because upstream library is inconsistent & we always check the error buffer anyway - return nil + return } func (c *Command) Parent() *Command { @@ -892,6 +917,19 @@ func (c *Command) Parent() *Command { func (c *Command) mergePersistentFlags() { var rmerge func(x *Command) + // Save the set of local flags + if c.lflags == nil { + c.lflags = flag.NewFlagSet(c.Name(), flag.ContinueOnError) + if c.flagErrorBuf == nil { + c.flagErrorBuf = new(bytes.Buffer) + } + c.lflags.SetOutput(c.flagErrorBuf) + addtolocal := func(f *flag.Flag) { + c.lflags.AddFlag(f) + } + c.Flags().VisitAll(addtolocal) + c.PersistentFlags().VisitAll(addtolocal) + } rmerge = func(x *Command) { if x.HasPersistentFlags() { x.PersistentFlags().VisitAll(func(f *flag.Flag) { diff --git a/Godeps/_workspace/src/github.com/spf13/pflag/bool_test.go b/Godeps/_workspace/src/github.com/spf13/pflag/bool_test.go index 72a12beca9..fe45b8d6e6 100644 --- a/Godeps/_workspace/src/github.com/spf13/pflag/bool_test.go +++ b/Godeps/_workspace/src/github.com/spf13/pflag/bool_test.go @@ -9,7 +9,7 @@ import ( "strconv" "testing" - . "github.com/ogier/pflag" + . "github.com/spf13/pflag" ) // This value can be a boolean ("true", "false") or "maybe" diff --git a/Godeps/_workspace/src/github.com/spf13/pflag/example_test.go b/Godeps/_workspace/src/github.com/spf13/pflag/example_test.go index 6aaed3c808..9be7a49f26 100644 --- a/Godeps/_workspace/src/github.com/spf13/pflag/example_test.go +++ b/Godeps/_workspace/src/github.com/spf13/pflag/example_test.go @@ -11,7 +11,7 @@ import ( "strings" "time" - flag "github.com/ogier/pflag" + flag "github.com/spf13/pflag" ) // Example 1: A single string flag called "species" with default value "gopher". diff --git a/Godeps/_workspace/src/github.com/spf13/pflag/flag.go b/Godeps/_workspace/src/github.com/spf13/pflag/flag.go index ad65ddad2d..72165f6c8a 100644 --- a/Godeps/_workspace/src/github.com/spf13/pflag/flag.go +++ b/Godeps/_workspace/src/github.com/spf13/pflag/flag.go @@ -498,6 +498,7 @@ func (f *FlagSet) parseShortArg(s string, args []string) (a []string, err error) if len(args) == 0 { return } + return } if alreadythere { if bv, ok := flag.Value.(boolFlag); ok && bv.IsBoolFlag() { @@ -551,6 +552,9 @@ func (f *FlagSet) parseArgs(args []string) (err error) { } else { args, err = f.parseShortArg(s, args) } + if err != nil { + return + } } return } diff --git a/docs/kubectl-clusterinfo.md b/docs/kubectl-clusterinfo.md index 8b5bfff601..90d8995ebd 100644 --- a/docs/kubectl-clusterinfo.md +++ b/docs/kubectl-clusterinfo.md @@ -11,6 +11,12 @@ Display addresses of the master and services with label kubernetes.io/cluster-se kubectl clusterinfo ``` +### Options + +``` + -h, --help=false: help for clusterinfo +``` + ### Options inherrited from parent commands ``` @@ -22,7 +28,6 @@ kubectl clusterinfo --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 - -h, --help=false: help for kubectl --insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. --kubeconfig="": Path to the kubeconfig file to use for CLI requests. --log_backtrace_at=:0: when logging hits line file:N, emit a stack trace diff --git a/docs/kubectl-config-set-cluster.md b/docs/kubectl-config-set-cluster.md index 106e7203a5..fde779c9af 100644 --- a/docs/kubectl-config-set-cluster.md +++ b/docs/kubectl-config-set-cluster.md @@ -28,24 +28,25 @@ $ kubectl config set-cluster e2e --insecure-skip-tls-verify=true ### Options ``` + --api-version=: api-version for the cluster entry in .kubeconfig + --certificate-authority=: path to certificate-authority for the cluster entry in .kubeconfig --embed-certs=false: embed-certs for the cluster entry in .kubeconfig + -h, --help=false: help for set-cluster + --insecure-skip-tls-verify=false: insecure-skip-tls-verify for the cluster entry in .kubeconfig + --server=: server for the cluster entry in .kubeconfig ``` ### Options inherrited from parent commands ``` --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 --envvar=false: use the .kubeconfig from $KUBECONFIG --global=false: use the .kubeconfig from /home/username - -h, --help=false: help for config - --insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. --kubeconfig="": use a particular .kubeconfig file --local=false: use the .kubeconfig in the current directory --log_backtrace_at=:0: when logging hits line file:N, emit a stack trace @@ -55,7 +56,6 @@ $ kubectl config set-cluster e2e --insecure-skip-tls-verify=true --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 diff --git a/docs/kubectl-config-set-context.md b/docs/kubectl-config-set-context.md index 9e4e3062c7..7b271f4ec6 100644 --- a/docs/kubectl-config-set-context.md +++ b/docs/kubectl-config-set-context.md @@ -19,6 +19,15 @@ kubectl config set-context NAME [--cluster=cluster_nickname] [--user=user_nickna $ kubectl config set-context gce --user=cluster-admin ``` +### Options + +``` + --cluster=: cluster for the context entry in .kubeconfig + -h, --help=false: help for set-context + --namespace=: namespace for the context entry in .kubeconfig + --user=: user for the context entry in .kubeconfig +``` + ### Options inherrited from parent commands ``` @@ -28,11 +37,9 @@ $ kubectl config set-context gce --user=cluster-admin --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 --envvar=false: use the .kubeconfig from $KUBECONFIG --global=false: use the .kubeconfig from /home/username - -h, --help=false: help for config --insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. --kubeconfig="": use a particular .kubeconfig file --local=false: use the .kubeconfig in the current directory @@ -41,12 +48,10 @@ $ kubectl config set-context gce --user=cluster-admin --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 diff --git a/docs/kubectl-config-set-credentials.md b/docs/kubectl-config-set-credentials.md index a956753902..b316a976ce 100644 --- a/docs/kubectl-config-set-credentials.md +++ b/docs/kubectl-config-set-credentials.md @@ -41,7 +41,14 @@ $ kubectl set-credentials cluster-admin --client-certificate=~/.kube/admin.crt - ### Options ``` + --auth-path=: auth-path for the user entry in .kubeconfig + --client-certificate=: path to client-certificate for the user entry in .kubeconfig + --client-key=: path to client-key for the user entry in .kubeconfig --embed-certs=false: embed client cert/key for the user entry in .kubeconfig + -h, --help=false: help for set-credentials + --password=: password for the user entry in .kubeconfig + --token=: token for the user entry in .kubeconfig + --username=: username for the user entry in .kubeconfig ``` ### Options inherrited from parent commands @@ -49,15 +56,11 @@ $ kubectl set-credentials cluster-admin --client-certificate=~/.kube/admin.crt - ``` --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 --envvar=false: use the .kubeconfig from $KUBECONFIG --global=false: use the .kubeconfig from /home/username - -h, --help=false: help for config --insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. --kubeconfig="": use a particular .kubeconfig file --local=false: use the .kubeconfig in the current directory @@ -67,12 +70,9 @@ $ kubectl set-credentials cluster-admin --client-certificate=~/.kube/admin.crt - --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 diff --git a/docs/kubectl-config-set.md b/docs/kubectl-config-set.md index 1be356a5cb..16e970735d 100644 --- a/docs/kubectl-config-set.md +++ b/docs/kubectl-config-set.md @@ -13,6 +13,12 @@ PROPERTY_VALUE is the new value you wish to set. kubectl config set PROPERTY_NAME PROPERTY_VALUE ``` +### Options + +``` + -h, --help=false: help for set +``` + ### Options inherrited from parent commands ``` @@ -26,7 +32,6 @@ kubectl config set PROPERTY_NAME PROPERTY_VALUE --context="": The name of the kubeconfig context to use --envvar=false: use the .kubeconfig from $KUBECONFIG --global=false: use the .kubeconfig from /home/username - -h, --help=false: help for config --insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. --kubeconfig="": use a particular .kubeconfig file --local=false: use the .kubeconfig in the current directory diff --git a/docs/kubectl-config-unset.md b/docs/kubectl-config-unset.md index 3e327de079..ca6f75e2f5 100644 --- a/docs/kubectl-config-unset.md +++ b/docs/kubectl-config-unset.md @@ -12,6 +12,12 @@ PROPERTY_NAME is a dot delimited name where each token represents either a attri kubectl config unset PROPERTY_NAME ``` +### Options + +``` + -h, --help=false: help for unset +``` + ### Options inherrited from parent commands ``` @@ -25,7 +31,6 @@ kubectl config unset PROPERTY_NAME --context="": The name of the kubeconfig context to use --envvar=false: use the .kubeconfig from $KUBECONFIG --global=false: use the .kubeconfig from /home/username - -h, --help=false: help for config --insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. --kubeconfig="": use a particular .kubeconfig file --local=false: use the .kubeconfig in the current directory diff --git a/docs/kubectl-config-use-context.md b/docs/kubectl-config-use-context.md index 11f6e0f7b8..ee24b9c650 100644 --- a/docs/kubectl-config-use-context.md +++ b/docs/kubectl-config-use-context.md @@ -11,6 +11,12 @@ Sets the current-context in a .kubeconfig file kubectl config use-context CONTEXT_NAME ``` +### Options + +``` + -h, --help=false: help for use-context +``` + ### Options inherrited from parent commands ``` @@ -24,7 +30,6 @@ kubectl config use-context CONTEXT_NAME --context="": The name of the kubeconfig context to use --envvar=false: use the .kubeconfig from $KUBECONFIG --global=false: use the .kubeconfig from /home/username - -h, --help=false: help for config --insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. --kubeconfig="": use a particular .kubeconfig file --local=false: use the .kubeconfig in the current directory diff --git a/docs/kubectl-config-view.md b/docs/kubectl-config-view.md index dd50f1eab8..afe81c4005 100644 --- a/docs/kubectl-config-view.md +++ b/docs/kubectl-config-view.md @@ -29,6 +29,7 @@ $ kubectl config view -o template --template='{{ index . "users" "e2e" "password ### Options ``` + -h, --help=false: help for view --merge=true: merge together the full hierarchy of .kubeconfig files --no-headers=false: When using the default output, don't print headers. -o, --output="": Output format. One of: json|yaml|template|templatefile. @@ -49,7 +50,6 @@ $ kubectl config view -o template --template='{{ index . "users" "e2e" "password --context="": The name of the kubeconfig context to use --envvar=false: use the .kubeconfig from $KUBECONFIG --global=false: use the .kubeconfig from /home/username - -h, --help=false: help for config --insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. --kubeconfig="": use a particular .kubeconfig file --local=false: use the .kubeconfig in the current directory diff --git a/docs/kubectl-config.md b/docs/kubectl-config.md index 56cef264f0..b5e9fdb4ae 100644 --- a/docs/kubectl-config.md +++ b/docs/kubectl-config.md @@ -16,6 +16,8 @@ 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 ``` @@ -30,9 +32,7 @@ kubectl config SUBCOMMAND --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 - -h, --help=false: help for kubectl --insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. - --kubeconfig="": Path to the kubeconfig file to use for CLI requests. --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 diff --git a/docs/kubectl-create.md b/docs/kubectl-create.md index 52f8ea32fb..5499da03e6 100644 --- a/docs/kubectl-create.md +++ b/docs/kubectl-create.md @@ -27,6 +27,7 @@ $ cat pod.json | kubectl create -f - ``` -f, --filename=[]: Filename, directory, or URL to file to use to create the resource + -h, --help=false: help for create ``` ### Options inherrited from parent commands @@ -40,7 +41,6 @@ $ cat pod.json | kubectl create -f - --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 - -h, --help=false: help for kubectl --insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. --kubeconfig="": Path to the kubeconfig file to use for CLI requests. --log_backtrace_at=:0: when logging hits line file:N, emit a stack trace diff --git a/docs/kubectl-delete.md b/docs/kubectl-delete.md index c92da2baee..5b5cc713ba 100644 --- a/docs/kubectl-delete.md +++ b/docs/kubectl-delete.md @@ -44,6 +44,7 @@ $ kubectl delete pods --all ``` --all=false: [-all] to select all the specified resources -f, --filename=[]: Filename, directory, or URL to a file containing the resource to delete + -h, --help=false: help for delete -l, --selector="": Selector (label query) to filter on ``` @@ -58,7 +59,6 @@ $ kubectl delete pods --all --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 - -h, --help=false: help for kubectl --insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. --kubeconfig="": Path to the kubeconfig file to use for CLI requests. --log_backtrace_at=:0: when logging hits line file:N, emit a stack trace diff --git a/docs/kubectl-describe.md b/docs/kubectl-describe.md index 50d0373b78..e79c4526fd 100644 --- a/docs/kubectl-describe.md +++ b/docs/kubectl-describe.md @@ -14,6 +14,12 @@ given resource. kubectl describe RESOURCE ID ``` +### Options + +``` + -h, --help=false: help for describe +``` + ### Options inherrited from parent commands ``` @@ -25,7 +31,6 @@ kubectl describe RESOURCE ID --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 - -h, --help=false: help for kubectl --insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. --kubeconfig="": Path to the kubeconfig file to use for CLI requests. --log_backtrace_at=:0: when logging hits line file:N, emit a stack trace diff --git a/docs/kubectl-exec.md b/docs/kubectl-exec.md index 3fdda08552..e2b75f1087 100644 --- a/docs/kubectl-exec.md +++ b/docs/kubectl-exec.md @@ -25,6 +25,7 @@ $ kubectl exec -p 123456-7890 -c ruby-container -i -t -- bash -il ``` -c, --container="": Container name + -h, --help=false: help for exec -p, --pod="": Pod name -i, --stdin=false: Pass stdin to the container -t, --tty=false: Stdin is a TTY @@ -41,7 +42,6 @@ $ kubectl exec -p 123456-7890 -c ruby-container -i -t -- bash -il --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 - -h, --help=false: help for kubectl --insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. --kubeconfig="": Path to the kubeconfig file to use for CLI requests. --log_backtrace_at=:0: when logging hits line file:N, emit a stack trace diff --git a/docs/kubectl-expose.md b/docs/kubectl-expose.md index 81243fe8cc..c548dedd19 100644 --- a/docs/kubectl-expose.md +++ b/docs/kubectl-expose.md @@ -31,7 +31,11 @@ $ kubectl expose streamer --port=4100 --protocol=udp --service-name=video-stream --create-external-load-balancer=false: If true, create an external load balancer for this service. Implementation is cloud provider dependent. Default is 'false'. --dry-run=false: If true, only print the object that would be sent, without creating it. --generator="service/v1": The name of the API generator to use. Default is 'service/v1'. +<<<<<<< HEAD -l, --labels="": Labels to apply to the service created by this call. +======= + -h, --help=false: help for expose +>>>>>>> Revert "Revert "Update cobra/pflag. Also update generated kubectl documentation."" --no-headers=false: When using the default output, don't print headers. -o, --output="": Output format. One of: json|yaml|template|templatefile. --output-version="": Output the formatted object with the given version (default api-version). @@ -55,7 +59,6 @@ $ kubectl expose streamer --port=4100 --protocol=udp --service-name=video-stream --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 - -h, --help=false: help for kubectl --insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. --kubeconfig="": Path to the kubeconfig file to use for CLI requests. --log_backtrace_at=:0: when logging hits line file:N, emit a stack trace diff --git a/docs/kubectl-get.md b/docs/kubectl-get.md index fcdf18472c..87d247cf38 100644 --- a/docs/kubectl-get.md +++ b/docs/kubectl-get.md @@ -39,6 +39,7 @@ $ kubectl get rc,services ### Options ``` + -h, --help=false: help for get --no-headers=false: When using the default output, don't print headers. -o, --output="": Output format. One of: json|yaml|template|templatefile. --output-version="": Output the formatted object with the given version (default api-version). @@ -59,7 +60,6 @@ $ kubectl get rc,services --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 - -h, --help=false: help for kubectl --insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. --kubeconfig="": Path to the kubeconfig file to use for CLI requests. --log_backtrace_at=:0: when logging hits line file:N, emit a stack trace diff --git a/docs/kubectl-label.md b/docs/kubectl-label.md index c3ace001b1..41f2d3e6d7 100644 --- a/docs/kubectl-label.md +++ b/docs/kubectl-label.md @@ -34,6 +34,7 @@ $ kubectl label pods foo bar- ### Options ``` + -h, --help=false: help for label --no-headers=false: When using the default output, don't print headers. -o, --output="": Output format. One of: json|yaml|template|templatefile. --output-version="": Output the formatted object with the given version (default api-version). @@ -53,7 +54,6 @@ $ kubectl label pods foo bar- --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 - -h, --help=false: help for kubectl --insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. --kubeconfig="": Path to the kubeconfig file to use for CLI requests. --log_backtrace_at=:0: when logging hits line file:N, emit a stack trace diff --git a/docs/kubectl-log.md b/docs/kubectl-log.md index 47974b1044..1e3510ad93 100644 --- a/docs/kubectl-log.md +++ b/docs/kubectl-log.md @@ -25,6 +25,7 @@ $ kubectl log -f 123456-7890 ruby-container ``` -f, --follow=false: Specify if the logs should be streamed. + -h, --help=false: help for log --interactive=true: If true, prompt the user for input when required. Default true. ``` @@ -39,7 +40,6 @@ $ kubectl log -f 123456-7890 ruby-container --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 - -h, --help=false: help for kubectl --insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. --kubeconfig="": Path to the kubeconfig file to use for CLI requests. --log_backtrace_at=:0: when logging hits line file:N, emit a stack trace diff --git a/docs/kubectl-namespace.md b/docs/kubectl-namespace.md index e78ae43294..7f7c68961b 100644 --- a/docs/kubectl-namespace.md +++ b/docs/kubectl-namespace.md @@ -14,6 +14,12 @@ namespace has been superceded by the context.namespace field of .kubeconfig file kubectl namespace [namespace] ``` +### Options + +``` + -h, --help=false: help for namespace +``` + ### Options inherrited from parent commands ``` @@ -25,7 +31,6 @@ kubectl namespace [namespace] --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 - -h, --help=false: help for kubectl --insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. --kubeconfig="": Path to the kubeconfig file to use for CLI requests. --log_backtrace_at=:0: when logging hits line file:N, emit a stack trace diff --git a/docs/kubectl-port-forward.md b/docs/kubectl-port-forward.md index 468dc2356e..b7c44b12f9 100644 --- a/docs/kubectl-port-forward.md +++ b/docs/kubectl-port-forward.md @@ -31,6 +31,7 @@ $ kubectl port-forward -p mypod 0:5000 ### Options ``` + -h, --help=false: help for port-forward -p, --pod="": Pod name ``` @@ -45,7 +46,6 @@ $ kubectl port-forward -p mypod 0:5000 --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 - -h, --help=false: help for kubectl --insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. --kubeconfig="": Path to the kubeconfig file to use for CLI requests. --log_backtrace_at=:0: when logging hits line file:N, emit a stack trace diff --git a/docs/kubectl-proxy.md b/docs/kubectl-proxy.md index e8f2a0d5c4..48f37e41b7 100644 --- a/docs/kubectl-proxy.md +++ b/docs/kubectl-proxy.md @@ -26,6 +26,7 @@ $ kubectl proxy --api-prefix=k8s-api ``` --api-prefix="/api/": Prefix to serve the proxied API under. + -h, --help=false: help for proxy -p, --port=8001: The port on which to run the proxy. -w, --www="": Also serve static files from the given directory under the specified prefix. -P, --www-prefix="/static/": Prefix to serve static files under, if static file directory is specified. @@ -42,7 +43,6 @@ $ kubectl proxy --api-prefix=k8s-api --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 - -h, --help=false: help for kubectl --insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. --kubeconfig="": Path to the kubeconfig file to use for CLI requests. --log_backtrace_at=:0: when logging hits line file:N, emit a stack trace diff --git a/docs/kubectl-resize.md b/docs/kubectl-resize.md index d528aecf1d..42a44a066a 100644 --- a/docs/kubectl-resize.md +++ b/docs/kubectl-resize.md @@ -30,6 +30,7 @@ $ kubectl resize --current-replicas=2 --replicas=3 replicationcontrollers foo ``` --current-replicas=-1: Precondition for current size. Requires that the current size of the replication controller match this value in order to resize. + -h, --help=false: help for resize --replicas=-1: The new desired number of replicas. Required. --resource-version="": Precondition for resource version. Requires that the current resource version match this value in order to resize. ``` @@ -45,7 +46,6 @@ $ kubectl resize --current-replicas=2 --replicas=3 replicationcontrollers foo --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 - -h, --help=false: help for kubectl --insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. --kubeconfig="": Path to the kubeconfig file to use for CLI requests. --log_backtrace_at=:0: when logging hits line file:N, emit a stack trace diff --git a/docs/kubectl-rollingupdate.md b/docs/kubectl-rollingupdate.md index 9f0c33a6dc..3e34d2242d 100644 --- a/docs/kubectl-rollingupdate.md +++ b/docs/kubectl-rollingupdate.md @@ -29,6 +29,7 @@ $ cat frontend-v2.json | kubectl rollingupdate frontend-v1 -f - ``` -f, --filename="": Filename or URL to file to use to create the new controller. + -h, --help=false: help for rollingupdate --poll-interval="3s": Time delay between polling controller status after update. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". --timeout="5m0s": Max time to wait for a controller to update before giving up. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". --update-period="1m0s": Time to wait between updating pods. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". @@ -45,7 +46,6 @@ $ cat frontend-v2.json | kubectl rollingupdate frontend-v1 -f - --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 - -h, --help=false: help for kubectl --insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. --kubeconfig="": Path to the kubeconfig file to use for CLI requests. --log_backtrace_at=:0: when logging hits line file:N, emit a stack trace diff --git a/docs/kubectl-run-container.md b/docs/kubectl-run-container.md index da469a69ce..dfbde8a8d1 100644 --- a/docs/kubectl-run-container.md +++ b/docs/kubectl-run-container.md @@ -33,6 +33,7 @@ $ kubectl run-container nginx --image=dockerfile/nginx --overrides='{ "apiVersio ``` --dry-run=false: If true, only print the object that would be sent, without sending it. --generator="run-container/v1": The name of the API generator to use. Default is 'run-container-controller/v1'. + -h, --help=false: help for run-container --image="": The image for the container to run. -l, --labels="": Labels to apply to the pod(s) created by this call to run-container. --no-headers=false: When using the default output, don't print headers. @@ -55,7 +56,6 @@ $ kubectl run-container nginx --image=dockerfile/nginx --overrides='{ "apiVersio --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 - -h, --help=false: help for kubectl --insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. --kubeconfig="": Path to the kubeconfig file to use for CLI requests. --log_backtrace_at=:0: when logging hits line file:N, emit a stack trace diff --git a/docs/kubectl-stop.md b/docs/kubectl-stop.md index 2a56f2ea19..4da057ad76 100644 --- a/docs/kubectl-stop.md +++ b/docs/kubectl-stop.md @@ -35,6 +35,7 @@ $ kubectl stop -f path/to/resources ``` --all=false: [-all] to select all the specified resources -f, --filename=[]: Filename, directory, or URL to file of resource(s) to be stopped + -h, --help=false: help for stop -l, --selector="": Selector (label query) to filter on ``` @@ -49,7 +50,6 @@ $ kubectl stop -f path/to/resources --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 - -h, --help=false: help for kubectl --insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. --kubeconfig="": Path to the kubeconfig file to use for CLI requests. --log_backtrace_at=:0: when logging hits line file:N, emit a stack trace diff --git a/docs/kubectl-update.md b/docs/kubectl-update.md index be76088fc6..52af1e12a5 100644 --- a/docs/kubectl-update.md +++ b/docs/kubectl-update.md @@ -30,6 +30,7 @@ $ kubectl update pods my-pod --patch='{ "apiVersion": "v1beta1", "desiredState": ``` -f, --filename=[]: Filename, directory, or URL to file to use to update the resource. + -h, --help=false: help for update --patch="": A JSON document to override the existing resource. The resource is downloaded, patched with the JSON, then updated. ``` @@ -44,7 +45,6 @@ $ kubectl update pods my-pod --patch='{ "apiVersion": "v1beta1", "desiredState": --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 - -h, --help=false: help for kubectl --insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. --kubeconfig="": Path to the kubeconfig file to use for CLI requests. --log_backtrace_at=:0: when logging hits line file:N, emit a stack trace diff --git a/docs/kubectl-version.md b/docs/kubectl-version.md index 9dadaa4910..a2c3f1ab29 100644 --- a/docs/kubectl-version.md +++ b/docs/kubectl-version.md @@ -15,6 +15,7 @@ kubectl version ``` -c, --client=false: Client version only (no server required). + -h, --help=false: help for version ``` ### Options inherrited from parent commands @@ -28,7 +29,6 @@ kubectl version --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 - -h, --help=false: help for kubectl --insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. --kubeconfig="": Path to the kubeconfig file to use for CLI requests. --log_backtrace_at=:0: when logging hits line file:N, emit a stack trace diff --git a/docs/man/man1/kubectl-clusterinfo.1 b/docs/man/man1/kubectl-clusterinfo.1 index a59393d0d3..9f0c6cc5b8 100644 --- a/docs/man/man1/kubectl-clusterinfo.1 +++ b/docs/man/man1/kubectl-clusterinfo.1 @@ -16,6 +16,12 @@ kubectl clusterinfo \- Display cluster info Display addresses of the master and services with label kubernetes.io/cluster\-service=true +.SH OPTIONS +.PP +\fB\-h\fP, \fB\-\-help\fP=false + help for clusterinfo + + .SH OPTIONS INHERITED FROM PARENT COMMANDS .PP \fB\-\-alsologtostderr\fP=false @@ -49,10 +55,6 @@ Display addresses of the master and services with label kubernetes.io/cluster\-s \fB\-\-context\fP="" The name of the kubeconfig context to use -.PP -\fB\-h\fP, \fB\-\-help\fP=false - help for kubectl - .PP \fB\-\-insecure\-skip\-tls\-verify\fP=false If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. diff --git a/docs/man/man1/kubectl-config-set-cluster.1 b/docs/man/man1/kubectl-config-set-cluster.1 index b10b169fc2..7eec68fd94 100644 --- a/docs/man/man1/kubectl-config-set-cluster.1 +++ b/docs/man/man1/kubectl-config-set-cluster.1 @@ -18,28 +18,40 @@ Specifying a name that already exists will merge new fields on top of existing v .SH OPTIONS +.PP +\fB\-\-api\-version\fP="" + api\-version for the cluster entry in .kubeconfig + +.PP +\fB\-\-certificate\-authority\fP="" + path to certificate\-authority for the cluster entry in .kubeconfig + .PP \fB\-\-embed\-certs\fP=false embed\-certs for the cluster entry in .kubeconfig +.PP +\fB\-h\fP, \fB\-\-help\fP=false + help for set\-cluster + +.PP +\fB\-\-insecure\-skip\-tls\-verify\fP=false + insecure\-skip\-tls\-verify for the cluster entry in .kubeconfig + +.PP +\fB\-\-server\fP="" + server for the cluster entry in .kubeconfig + .SH OPTIONS INHERITED FROM PARENT COMMANDS .PP \fB\-\-alsologtostderr\fP=false log to standard error as well as files -.PP -\fB\-\-api\-version\fP="" - The API version to use when talking to the server - .PP \fB\-a\fP, \fB\-\-auth\-path\fP="" Path to the auth info file. If missing, prompt the user. Only used if using https. -.PP -\fB\-\-certificate\-authority\fP="" - Path to a cert. file for the certificate authority. - .PP \fB\-\-client\-certificate\fP="" Path to a client key file for TLS. @@ -64,14 +76,6 @@ Specifying a name that already exists will merge new fields on top of existing v \fB\-\-global\fP=false use the .kubeconfig from /home/username -.PP -\fB\-h\fP, \fB\-\-help\fP=false - help for config - -.PP -\fB\-\-insecure\-skip\-tls\-verify\fP=false - If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. - .PP \fB\-\-kubeconfig\fP="" use a particular .kubeconfig file @@ -108,10 +112,6 @@ Specifying a name that already exists will merge new fields on top of existing v \fB\-\-password\fP="" Password for basic authentication to the API server. -.PP -\fB\-s\fP, \fB\-\-server\fP="" - The address and port of the Kubernetes API server - .PP \fB\-\-stderrthreshold\fP=2 logs at or above this threshold go to stderr diff --git a/docs/man/man1/kubectl-config-set-context.1 b/docs/man/man1/kubectl-config-set-context.1 index 5f2795b6f7..e8636e4bde 100644 --- a/docs/man/man1/kubectl-config-set-context.1 +++ b/docs/man/man1/kubectl-config-set-context.1 @@ -17,6 +17,24 @@ Sets a context entry in .kubeconfig Specifying a name that already exists will merge new fields on top of existing values for those fields. +.SH OPTIONS +.PP +\fB\-\-cluster\fP="" + cluster for the context entry in .kubeconfig + +.PP +\fB\-h\fP, \fB\-\-help\fP=false + help for set\-context + +.PP +\fB\-\-namespace\fP="" + namespace for the context entry in .kubeconfig + +.PP +\fB\-\-user\fP="" + user for the context entry in .kubeconfig + + .SH OPTIONS INHERITED FROM PARENT COMMANDS .PP \fB\-\-alsologtostderr\fP=false @@ -42,10 +60,6 @@ Specifying a name that already exists will merge new fields on top of existing v \fB\-\-client\-key\fP="" Path to a client key file for TLS. -.PP -\fB\-\-cluster\fP="" - The name of the kubeconfig cluster to use - .PP \fB\-\-context\fP="" The name of the kubeconfig context to use @@ -58,10 +72,6 @@ Specifying a name that already exists will merge new fields on top of existing v \fB\-\-global\fP=false use the .kubeconfig from /home/username -.PP -\fB\-h\fP, \fB\-\-help\fP=false - help for config - .PP \fB\-\-insecure\-skip\-tls\-verify\fP=false If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. @@ -94,10 +104,6 @@ Specifying a name that already exists will merge new fields on top of existing v \fB\-\-match\-server\-version\fP=false Require server version to match client version -.PP -\fB\-\-namespace\fP="" - If present, the namespace scope for this CLI request. - .PP \fB\-\-password\fP="" Password for basic authentication to the API server. @@ -114,10 +120,6 @@ Specifying a name that already exists will merge new fields on top of existing v \fB\-\-token\fP="" Bearer token for authentication to the API server. -.PP -\fB\-\-user\fP="" - The name of the kubeconfig user to use - .PP \fB\-\-username\fP="" Username for basic authentication to the API server. diff --git a/docs/man/man1/kubectl-config-set-credentials.1 b/docs/man/man1/kubectl-config-set-credentials.1 index 2774c47114..039bbc9d4d 100644 --- a/docs/man/man1/kubectl-config-set-credentials.1 +++ b/docs/man/man1/kubectl-config-set-credentials.1 @@ -33,10 +33,38 @@ Bearer token and basic auth are mutually exclusive. .SH OPTIONS +.PP +\fB\-\-auth\-path\fP="" + auth\-path for the user entry in .kubeconfig + +.PP +\fB\-\-client\-certificate\fP="" + path to client\-certificate for the user entry in .kubeconfig + +.PP +\fB\-\-client\-key\fP="" + path to client\-key for the user entry in .kubeconfig + .PP \fB\-\-embed\-certs\fP=false embed client cert/key for the user entry in .kubeconfig +.PP +\fB\-h\fP, \fB\-\-help\fP=false + help for set\-credentials + +.PP +\fB\-\-password\fP="" + password for the user entry in .kubeconfig + +.PP +\fB\-\-token\fP="" + token for the user entry in .kubeconfig + +.PP +\fB\-\-username\fP="" + username for the user entry in .kubeconfig + .SH OPTIONS INHERITED FROM PARENT COMMANDS .PP @@ -47,22 +75,10 @@ Bearer token and basic auth are mutually exclusive. \fB\-\-api\-version\fP="" The API version to use when talking to the server -.PP -\fB\-a\fP, \fB\-\-auth\-path\fP="" - Path to the auth info file. If missing, prompt the user. Only used if using https. - .PP \fB\-\-certificate\-authority\fP="" Path to a cert. file for the certificate authority. -.PP -\fB\-\-client\-certificate\fP="" - Path to a client key file for TLS. - -.PP -\fB\-\-client\-key\fP="" - Path to a client key file for TLS. - .PP \fB\-\-cluster\fP="" The name of the kubeconfig cluster to use @@ -79,10 +95,6 @@ Bearer token and basic auth are mutually exclusive. \fB\-\-global\fP=false use the .kubeconfig from /home/username -.PP -\fB\-h\fP, \fB\-\-help\fP=false - help for config - .PP \fB\-\-insecure\-skip\-tls\-verify\fP=false If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. @@ -119,10 +131,6 @@ Bearer token and basic auth are mutually exclusive. \fB\-\-namespace\fP="" If present, the namespace scope for this CLI request. -.PP -\fB\-\-password\fP="" - Password for basic authentication to the API server. - .PP \fB\-s\fP, \fB\-\-server\fP="" The address and port of the Kubernetes API server @@ -131,18 +139,10 @@ Bearer token and basic auth are mutually exclusive. \fB\-\-stderrthreshold\fP=2 logs at or above this threshold go to stderr -.PP -\fB\-\-token\fP="" - Bearer token for authentication to the API server. - .PP \fB\-\-user\fP="" The name of the kubeconfig user to use -.PP -\fB\-\-username\fP="" - Username for basic authentication to the API server. - .PP \fB\-\-v\fP=0 log level for V logs diff --git a/docs/man/man1/kubectl-config-set.1 b/docs/man/man1/kubectl-config-set.1 index eb854db0ff..5c9782b27c 100644 --- a/docs/man/man1/kubectl-config-set.1 +++ b/docs/man/man1/kubectl-config-set.1 @@ -18,6 +18,12 @@ PROPERTY\_NAME is a dot delimited name where each token represents either a attr PROPERTY\_VALUE is the new value you wish to set. +.SH OPTIONS +.PP +\fB\-h\fP, \fB\-\-help\fP=false + help for set + + .SH OPTIONS INHERITED FROM PARENT COMMANDS .PP \fB\-\-alsologtostderr\fP=false @@ -59,10 +65,6 @@ PROPERTY\_VALUE is the new value you wish to set. \fB\-\-global\fP=false use the .kubeconfig from /home/username -.PP -\fB\-h\fP, \fB\-\-help\fP=false - help for config - .PP \fB\-\-insecure\-skip\-tls\-verify\fP=false If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. diff --git a/docs/man/man1/kubectl-config-unset.1 b/docs/man/man1/kubectl-config-unset.1 index 76cf676c37..61786eb63d 100644 --- a/docs/man/man1/kubectl-config-unset.1 +++ b/docs/man/man1/kubectl-config-unset.1 @@ -17,6 +17,12 @@ Unsets an individual value in a .kubeconfig file PROPERTY\_NAME is a dot delimited name where each token represents either a attribute name or a map key. Map keys may not contain dots. +.SH OPTIONS +.PP +\fB\-h\fP, \fB\-\-help\fP=false + help for unset + + .SH OPTIONS INHERITED FROM PARENT COMMANDS .PP \fB\-\-alsologtostderr\fP=false @@ -58,10 +64,6 @@ PROPERTY\_NAME is a dot delimited name where each token represents either a attr \fB\-\-global\fP=false use the .kubeconfig from /home/username -.PP -\fB\-h\fP, \fB\-\-help\fP=false - help for config - .PP \fB\-\-insecure\-skip\-tls\-verify\fP=false If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. diff --git a/docs/man/man1/kubectl-config-use-context.1 b/docs/man/man1/kubectl-config-use-context.1 index dc03a9def7..f0c92ebecd 100644 --- a/docs/man/man1/kubectl-config-use-context.1 +++ b/docs/man/man1/kubectl-config-use-context.1 @@ -16,6 +16,12 @@ kubectl config use\-context \- Sets the current\-context in a .kubeconfig file Sets the current\-context in a .kubeconfig file +.SH OPTIONS +.PP +\fB\-h\fP, \fB\-\-help\fP=false + help for use\-context + + .SH OPTIONS INHERITED FROM PARENT COMMANDS .PP \fB\-\-alsologtostderr\fP=false @@ -57,10 +63,6 @@ Sets the current\-context in a .kubeconfig file \fB\-\-global\fP=false use the .kubeconfig from /home/username -.PP -\fB\-h\fP, \fB\-\-help\fP=false - help for config - .PP \fB\-\-insecure\-skip\-tls\-verify\fP=false If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. diff --git a/docs/man/man1/kubectl-config-view.1 b/docs/man/man1/kubectl-config-view.1 index 2d64119a44..934da061c1 100644 --- a/docs/man/man1/kubectl-config-view.1 +++ b/docs/man/man1/kubectl-config-view.1 @@ -20,6 +20,10 @@ You can use \-\-output=template \-\-template=TEMPLATE to extract specific values .SH OPTIONS +.PP +\fB\-h\fP, \fB\-\-help\fP=false + help for view + .PP \fB\-\-merge\fP=true merge together the full hierarchy of .kubeconfig files @@ -83,10 +87,6 @@ You can use \-\-output=template \-\-template=TEMPLATE to extract specific values \fB\-\-global\fP=false use the .kubeconfig from /home/username -.PP -\fB\-h\fP, \fB\-\-help\fP=false - help for config - .PP \fB\-\-insecure\-skip\-tls\-verify\fP=false If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. diff --git a/docs/man/man1/kubectl-config.1 b/docs/man/man1/kubectl-config.1 index bea2aca70a..0b2d55b16e 100644 --- a/docs/man/man1/kubectl-config.1 +++ b/docs/man/man1/kubectl-config.1 @@ -25,6 +25,14 @@ config modifies .kubeconfig files using subcommands like "kubectl config set cur \fB\-\-global\fP=false use the .kubeconfig from /home/username +.PP +\fB\-h\fP, \fB\-\-help\fP=false + help for config + +.PP +\fB\-\-kubeconfig\fP="" + use a particular .kubeconfig file + .PP \fB\-\-local\fP=false use the .kubeconfig in the current directory @@ -63,18 +71,10 @@ config modifies .kubeconfig files using subcommands like "kubectl config set cur \fB\-\-context\fP="" The name of the kubeconfig context to use -.PP -\fB\-h\fP, \fB\-\-help\fP=false - help for kubectl - .PP \fB\-\-insecure\-skip\-tls\-verify\fP=false If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. -.PP -\fB\-\-kubeconfig\fP="" - Path to the kubeconfig file to use for CLI requests. - .PP \fB\-\-log\_backtrace\_at\fP=:0 when logging hits line file:N, emit a stack trace diff --git a/docs/man/man1/kubectl-create.1 b/docs/man/man1/kubectl-create.1 index 18b4435c06..ca9b27364c 100644 --- a/docs/man/man1/kubectl-create.1 +++ b/docs/man/man1/kubectl-create.1 @@ -24,6 +24,10 @@ JSON and YAML formats are accepted. \fB\-f\fP, \fB\-\-filename\fP=[] Filename, directory, or URL to file to use to create the resource +.PP +\fB\-h\fP, \fB\-\-help\fP=false + help for create + .SH OPTIONS INHERITED FROM PARENT COMMANDS .PP @@ -58,10 +62,6 @@ JSON and YAML formats are accepted. \fB\-\-context\fP="" The name of the kubeconfig context to use -.PP -\fB\-h\fP, \fB\-\-help\fP=false - help for kubectl - .PP \fB\-\-insecure\-skip\-tls\-verify\fP=false If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. diff --git a/docs/man/man1/kubectl-delete.1 b/docs/man/man1/kubectl-delete.1 index 2ce3b2c4d0..73db055a68 100644 --- a/docs/man/man1/kubectl-delete.1 +++ b/docs/man/man1/kubectl-delete.1 @@ -37,6 +37,10 @@ will be lost along with the rest of the resource. \fB\-f\fP, \fB\-\-filename\fP=[] Filename, directory, or URL to a file containing the resource to delete +.PP +\fB\-h\fP, \fB\-\-help\fP=false + help for delete + .PP \fB\-l\fP, \fB\-\-selector\fP="" Selector (label query) to filter on @@ -75,10 +79,6 @@ will be lost along with the rest of the resource. \fB\-\-context\fP="" The name of the kubeconfig context to use -.PP -\fB\-h\fP, \fB\-\-help\fP=false - help for kubectl - .PP \fB\-\-insecure\-skip\-tls\-verify\fP=false If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. diff --git a/docs/man/man1/kubectl-describe.1 b/docs/man/man1/kubectl-describe.1 index 378e6d0955..c28d455f35 100644 --- a/docs/man/man1/kubectl-describe.1 +++ b/docs/man/man1/kubectl-describe.1 @@ -20,6 +20,12 @@ This command joins many API calls together to form a detailed description of a given resource. +.SH OPTIONS +.PP +\fB\-h\fP, \fB\-\-help\fP=false + help for describe + + .SH OPTIONS INHERITED FROM PARENT COMMANDS .PP \fB\-\-alsologtostderr\fP=false @@ -53,10 +59,6 @@ given resource. \fB\-\-context\fP="" The name of the kubeconfig context to use -.PP -\fB\-h\fP, \fB\-\-help\fP=false - help for kubectl - .PP \fB\-\-insecure\-skip\-tls\-verify\fP=false If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. diff --git a/docs/man/man1/kubectl-exec.1 b/docs/man/man1/kubectl-exec.1 index 31ed5cfa5f..5324972cbc 100644 --- a/docs/man/man1/kubectl-exec.1 +++ b/docs/man/man1/kubectl-exec.1 @@ -21,6 +21,10 @@ Execute a command in a container. \fB\-c\fP, \fB\-\-container\fP="" Container name +.PP +\fB\-h\fP, \fB\-\-help\fP=false + help for exec + .PP \fB\-p\fP, \fB\-\-pod\fP="" Pod name @@ -67,10 +71,6 @@ Execute a command in a container. \fB\-\-context\fP="" The name of the kubeconfig context to use -.PP -\fB\-h\fP, \fB\-\-help\fP=false - help for kubectl - .PP \fB\-\-insecure\-skip\-tls\-verify\fP=false If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. diff --git a/docs/man/man1/kubectl-expose.1 b/docs/man/man1/kubectl-expose.1 index 69087cdf48..ea02b3eee8 100644 --- a/docs/man/man1/kubectl-expose.1 +++ b/docs/man/man1/kubectl-expose.1 @@ -38,8 +38,13 @@ as the selector for a new Service on the specified port. The name of the API generator to use. Default is 'service/v1'. .PP +<<<<<<< HEAD \fB\-l\fP, \fB\-\-labels\fP="" Labels to apply to the service created by this call. +======= +\fB\-h\fP, \fB\-\-help\fP=false + help for expose +>>>>>>> Revert "Revert "Update cobra/pflag. Also update generated kubectl documentation."" .PP \fB\-\-no\-headers\fP=false @@ -116,10 +121,6 @@ as the selector for a new Service on the specified port. \fB\-\-context\fP="" The name of the kubeconfig context to use -.PP -\fB\-h\fP, \fB\-\-help\fP=false - help for kubectl - .PP \fB\-\-insecure\-skip\-tls\-verify\fP=false If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. diff --git a/docs/man/man1/kubectl-get.1 b/docs/man/man1/kubectl-get.1 index 2719398d9a..1c9cd2f059 100644 --- a/docs/man/man1/kubectl-get.1 +++ b/docs/man/man1/kubectl-get.1 @@ -25,6 +25,10 @@ of the \-\-template flag, you can filter the attributes of the fetched resource( .SH OPTIONS +.PP +\fB\-h\fP, \fB\-\-help\fP=false + help for get + .PP \fB\-\-no\-headers\fP=false When using the default output, don't print headers. @@ -88,10 +92,6 @@ of the \-\-template flag, you can filter the attributes of the fetched resource( \fB\-\-context\fP="" The name of the kubeconfig context to use -.PP -\fB\-h\fP, \fB\-\-help\fP=false - help for kubectl - .PP \fB\-\-insecure\-skip\-tls\-verify\fP=false If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. diff --git a/docs/man/man1/kubectl-label.1 b/docs/man/man1/kubectl-label.1 index c835a10254..704ac370dc 100644 --- a/docs/man/man1/kubectl-label.1 +++ b/docs/man/man1/kubectl-label.1 @@ -21,6 +21,10 @@ If \-\-resource\-version is specified, then updates will use this resource versi .SH OPTIONS +.PP +\fB\-h\fP, \fB\-\-help\fP=false + help for label + .PP \fB\-\-no\-headers\fP=false When using the default output, don't print headers. @@ -80,10 +84,6 @@ If \-\-resource\-version is specified, then updates will use this resource versi \fB\-\-context\fP="" The name of the kubeconfig context to use -.PP -\fB\-h\fP, \fB\-\-help\fP=false - help for kubectl - .PP \fB\-\-insecure\-skip\-tls\-verify\fP=false If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. diff --git a/docs/man/man1/kubectl-log.1 b/docs/man/man1/kubectl-log.1 index bf0bd6853e..3cea9c3278 100644 --- a/docs/man/man1/kubectl-log.1 +++ b/docs/man/man1/kubectl-log.1 @@ -21,6 +21,10 @@ Print the logs for a container in a pod. If the pod has only one container, the \fB\-f\fP, \fB\-\-follow\fP=false Specify if the logs should be streamed. +.PP +\fB\-h\fP, \fB\-\-help\fP=false + help for log + .PP \fB\-\-interactive\fP=true If true, prompt the user for input when required. Default true. @@ -59,10 +63,6 @@ Print the logs for a container in a pod. If the pod has only one container, the \fB\-\-context\fP="" The name of the kubeconfig context to use -.PP -\fB\-h\fP, \fB\-\-help\fP=false - help for kubectl - .PP \fB\-\-insecure\-skip\-tls\-verify\fP=false If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. diff --git a/docs/man/man1/kubectl-namespace.1 b/docs/man/man1/kubectl-namespace.1 index ca35a13e2d..6f0a0819c5 100644 --- a/docs/man/man1/kubectl-namespace.1 +++ b/docs/man/man1/kubectl-namespace.1 @@ -19,6 +19,12 @@ SUPERCEDED: Set and view the current Kubernetes namespace scope for command lin namespace has been superceded by the context.namespace field of .kubeconfig files. See 'kubectl config set\-context \-\-help' for more details. +.SH OPTIONS +.PP +\fB\-h\fP, \fB\-\-help\fP=false + help for namespace + + .SH OPTIONS INHERITED FROM PARENT COMMANDS .PP \fB\-\-alsologtostderr\fP=false @@ -52,10 +58,6 @@ namespace has been superceded by the context.namespace field of .kubeconfig file \fB\-\-context\fP="" The name of the kubeconfig context to use -.PP -\fB\-h\fP, \fB\-\-help\fP=false - help for kubectl - .PP \fB\-\-insecure\-skip\-tls\-verify\fP=false If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. diff --git a/docs/man/man1/kubectl-port-forward.1 b/docs/man/man1/kubectl-port-forward.1 index 912ce1e9e5..48d8fa16b8 100644 --- a/docs/man/man1/kubectl-port-forward.1 +++ b/docs/man/man1/kubectl-port-forward.1 @@ -17,6 +17,10 @@ Forward 1 or more local ports to a pod. .SH OPTIONS +.PP +\fB\-h\fP, \fB\-\-help\fP=false + help for port\-forward + .PP \fB\-p\fP, \fB\-\-pod\fP="" Pod name @@ -55,10 +59,6 @@ Forward 1 or more local ports to a pod. \fB\-\-context\fP="" The name of the kubeconfig context to use -.PP -\fB\-h\fP, \fB\-\-help\fP=false - help for kubectl - .PP \fB\-\-insecure\-skip\-tls\-verify\fP=false If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. diff --git a/docs/man/man1/kubectl-proxy.1 b/docs/man/man1/kubectl-proxy.1 index a7fda87976..5ac2fcd5a1 100644 --- a/docs/man/man1/kubectl-proxy.1 +++ b/docs/man/man1/kubectl-proxy.1 @@ -21,6 +21,10 @@ Run a proxy to the Kubernetes API server. \fB\-\-api\-prefix\fP="/api/" Prefix to serve the proxied API under. +.PP +\fB\-h\fP, \fB\-\-help\fP=false + help for proxy + .PP \fB\-p\fP, \fB\-\-port\fP=8001 The port on which to run the proxy. @@ -67,10 +71,6 @@ Run a proxy to the Kubernetes API server. \fB\-\-context\fP="" The name of the kubeconfig context to use -.PP -\fB\-h\fP, \fB\-\-help\fP=false - help for kubectl - .PP \fB\-\-insecure\-skip\-tls\-verify\fP=false If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. diff --git a/docs/man/man1/kubectl-resize.1 b/docs/man/man1/kubectl-resize.1 index 4e84205af0..9d2d25ab5c 100644 --- a/docs/man/man1/kubectl-resize.1 +++ b/docs/man/man1/kubectl-resize.1 @@ -27,6 +27,10 @@ resize is sent to the server. \fB\-\-current\-replicas\fP=\-1 Precondition for current size. Requires that the current size of the replication controller match this value in order to resize. +.PP +\fB\-h\fP, \fB\-\-help\fP=false + help for resize + .PP \fB\-\-replicas\fP=\-1 The new desired number of replicas. Required. @@ -69,10 +73,6 @@ resize is sent to the server. \fB\-\-context\fP="" The name of the kubeconfig context to use -.PP -\fB\-h\fP, \fB\-\-help\fP=false - help for kubectl - .PP \fB\-\-insecure\-skip\-tls\-verify\fP=false If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. diff --git a/docs/man/man1/kubectl-rollingupdate.1 b/docs/man/man1/kubectl-rollingupdate.1 index 7b65625322..103cfc1062 100644 --- a/docs/man/man1/kubectl-rollingupdate.1 +++ b/docs/man/man1/kubectl-rollingupdate.1 @@ -26,6 +26,10 @@ existing controller and overwrite at least one (common) label in its replicaSele \fB\-f\fP, \fB\-\-filename\fP="" Filename or URL to file to use to create the new controller. +.PP +\fB\-h\fP, \fB\-\-help\fP=false + help for rollingupdate + .PP \fB\-\-poll\-interval\fP="3s" Time delay between polling controller status after update. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". @@ -72,10 +76,6 @@ existing controller and overwrite at least one (common) label in its replicaSele \fB\-\-context\fP="" The name of the kubeconfig context to use -.PP -\fB\-h\fP, \fB\-\-help\fP=false - help for kubectl - .PP \fB\-\-insecure\-skip\-tls\-verify\fP=false If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. diff --git a/docs/man/man1/kubectl-run-container.1 b/docs/man/man1/kubectl-run-container.1 index f156496d80..2076d1debc 100644 --- a/docs/man/man1/kubectl-run-container.1 +++ b/docs/man/man1/kubectl-run-container.1 @@ -26,6 +26,10 @@ Creates a replication controller to manage the created container(s). \fB\-\-generator\fP="run\-container/v1" The name of the API generator to use. Default is 'run\-container\-controller/v1'. +.PP +\fB\-h\fP, \fB\-\-help\fP=false + help for run\-container + .PP \fB\-\-image\fP="" The image for the container to run. @@ -97,10 +101,6 @@ Creates a replication controller to manage the created container(s). \fB\-\-context\fP="" The name of the kubeconfig context to use -.PP -\fB\-h\fP, \fB\-\-help\fP=false - help for kubectl - .PP \fB\-\-insecure\-skip\-tls\-verify\fP=false If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. diff --git a/docs/man/man1/kubectl-stop.1 b/docs/man/man1/kubectl-stop.1 index 9ab05bbff1..029474cce0 100644 --- a/docs/man/man1/kubectl-stop.1 +++ b/docs/man/man1/kubectl-stop.1 @@ -29,6 +29,10 @@ If the resource is resizable it will be resized to 0 before deletion. \fB\-f\fP, \fB\-\-filename\fP=[] Filename, directory, or URL to file of resource(s) to be stopped +.PP +\fB\-h\fP, \fB\-\-help\fP=false + help for stop + .PP \fB\-l\fP, \fB\-\-selector\fP="" Selector (label query) to filter on @@ -67,10 +71,6 @@ If the resource is resizable it will be resized to 0 before deletion. \fB\-\-context\fP="" The name of the kubeconfig context to use -.PP -\fB\-h\fP, \fB\-\-help\fP=false - help for kubectl - .PP \fB\-\-insecure\-skip\-tls\-verify\fP=false If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. diff --git a/docs/man/man1/kubectl-update.1 b/docs/man/man1/kubectl-update.1 index 33660c234e..f400c93a6c 100644 --- a/docs/man/man1/kubectl-update.1 +++ b/docs/man/man1/kubectl-update.1 @@ -24,6 +24,10 @@ JSON and YAML formats are accepted. \fB\-f\fP, \fB\-\-filename\fP=[] Filename, directory, or URL to file to use to update the resource. +.PP +\fB\-h\fP, \fB\-\-help\fP=false + help for update + .PP \fB\-\-patch\fP="" A JSON document to override the existing resource. The resource is downloaded, patched with the JSON, then updated. @@ -62,10 +66,6 @@ JSON and YAML formats are accepted. \fB\-\-context\fP="" The name of the kubeconfig context to use -.PP -\fB\-h\fP, \fB\-\-help\fP=false - help for kubectl - .PP \fB\-\-insecure\-skip\-tls\-verify\fP=false If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. diff --git a/docs/man/man1/kubectl-version.1 b/docs/man/man1/kubectl-version.1 index 9b082d525d..1640fdd5b7 100644 --- a/docs/man/man1/kubectl-version.1 +++ b/docs/man/man1/kubectl-version.1 @@ -21,6 +21,10 @@ Print the client and server version information. \fB\-c\fP, \fB\-\-client\fP=false Client version only (no server required). +.PP +\fB\-h\fP, \fB\-\-help\fP=false + help for version + .SH OPTIONS INHERITED FROM PARENT COMMANDS .PP @@ -55,10 +59,6 @@ Print the client and server version information. \fB\-\-context\fP="" The name of the kubeconfig context to use -.PP -\fB\-h\fP, \fB\-\-help\fP=false - help for kubectl - .PP \fB\-\-insecure\-skip\-tls\-verify\fP=false If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. From a18ec3be8809e2f4082bf0baf539d6d35c43bbd5 Mon Sep 17 00:00:00 2001 From: Brendan Burns Date: Mon, 23 Mar 2015 15:09:20 -0700 Subject: [PATCH 2/2] Update spf13/cobra with recent commits. --- Godeps/Godeps.json | 2 +- .../src/github.com/spf13/cobra/cobra_test.go | 20 ++++++++++++------- .../src/github.com/spf13/cobra/command.go | 19 ++++++++++++++---- docs/kubectl-apiversions.md | 7 ++++++- docs/kubectl-expose.md | 5 +---- docs/man/man1/kubectl-apiversions.1 | 10 ++++++---- docs/man/man1/kubectl-expose.1 | 9 ++++----- 7 files changed, 46 insertions(+), 26 deletions(-) diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 286897ea16..8d630db54e 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -387,7 +387,7 @@ }, { "ImportPath": "github.com/spf13/cobra", - "Rev": "9e7273d5469dd5e04a35fd8823ba510117448c0b" + "Rev": "79bd93d369fb73d640179208d4e2b1a748915567" }, { "ImportPath": "github.com/spf13/pflag", diff --git a/Godeps/_workspace/src/github.com/spf13/cobra/cobra_test.go b/Godeps/_workspace/src/github.com/spf13/cobra/cobra_test.go index fa1192277c..120bc5c7ff 100644 --- a/Godeps/_workspace/src/github.com/spf13/cobra/cobra_test.go +++ b/Godeps/_workspace/src/github.com/spf13/cobra/cobra_test.go @@ -10,7 +10,7 @@ import ( var _ = fmt.Println var tp, te, tt, t1 []string -var flagb1, flagb2, flagb3, flagbr bool +var flagb1, flagb2, flagb3, flagbr, flagbp bool var flags1, flags2a, flags2b, flags3 string var flagi1, flagi2, flagi3, flagir int var globalFlag1 bool @@ -80,6 +80,7 @@ func flagInit() { cmdTimes.Flags().IntVarP(&flagi2, "inttwo", "j", 234, "help message for flag inttwo") cmdPrint.Flags().IntVarP(&flagi3, "intthree", "i", 345, "help message for flag intthree") cmdEcho.PersistentFlags().StringVarP(&flags1, "strone", "s", "one", "help message for flag strone") + cmdEcho.PersistentFlags().BoolVarP(&flagbp, "persistentbool", "p", false, "help message for flag persistentbool") cmdTimes.PersistentFlags().StringVarP(&flags2b, "strtwo", "t", "2", strtwoChildHelp) cmdPrint.PersistentFlags().StringVarP(&flags3, "strthree", "s", "three", "help message for flag strthree") cmdEcho.Flags().BoolVarP(&flagb1, "boolone", "b", true, "help message for flag boolone") @@ -417,19 +418,21 @@ func TestTrailingCommandFlags(t *testing.T) { } func TestPersistentFlags(t *testing.T) { - fullSetupTest("echo -s something more here") + fullSetupTest("echo -s something -p more here") // persistentFlag should act like normal flag on it's own command if strings.Join(te, " ") != "more here" { t.Errorf("flags didn't leave proper args remaining..%s given", te) } - - // persistentFlag should act like normal flag on it's own command if flags1 != "something" { t.Errorf("string flag didn't get correct value, had %v", flags1) } + if !flagbp { + t.Errorf("persistent bool flag not parsed correctly. Expected true, had %v", flagbp) + } - fullSetupTest("echo times -s again -c test here") + // persistentFlag should act like normal flag on it's own command + fullSetupTest("echo times -s again -c -p test here") if strings.Join(tt, " ") != "test here" { t.Errorf("flags didn't leave proper args remaining..%s given", tt) @@ -439,8 +442,11 @@ func TestPersistentFlags(t *testing.T) { t.Errorf("string flag didn't get correct value, had %v", flags1) } - if flagb2 != true { - t.Errorf("local flag not parsed correctly. Expected false, had %v", flagb2) + if !flagb2 { + t.Errorf("local flag not parsed correctly. Expected true, had %v", flagb2) + } + if !flagbp { + t.Errorf("persistent bool flag not parsed correctly. Expected true, had %v", flagbp) } } diff --git a/Godeps/_workspace/src/github.com/spf13/cobra/command.go b/Godeps/_workspace/src/github.com/spf13/cobra/command.go index 82368e2673..a7d90886c3 100644 --- a/Godeps/_workspace/src/github.com/spf13/cobra/command.go +++ b/Godeps/_workspace/src/github.com/spf13/cobra/command.go @@ -79,7 +79,7 @@ func (c *Command) SetArgs(a []string) { c.args = a } -func (c *Command) Out() io.Writer { +func (c *Command) getOut(def io.Writer) io.Writer { if c.output != nil { return *c.output } @@ -87,10 +87,18 @@ func (c *Command) Out() io.Writer { if c.HasParent() { return c.parent.Out() } else { - return os.Stderr + return def } } +func (c *Command) Out() io.Writer { + return c.getOut(os.Stderr) +} + +func (c *Command) getOutOrStdout() io.Writer { + return c.getOut(os.Stdout) +} + // SetOutput sets the destination for usage and error messages. // If output is nil, os.Stderr is used. func (c *Command) SetOutput(output io.Writer) { @@ -212,9 +220,11 @@ Usage: {{if .Runnable}} Aliases: {{.NameAndAliases}} {{end}}{{if .HasExample}} + Examples: {{ .Example }} {{end}}{{ if .HasSubCommands}} + Available Commands: {{range .Commands}}{{if .Runnable}} {{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}} {{end}} @@ -238,7 +248,7 @@ func (c *Command) HelpTemplate() string { if c.HasParent() { return c.parent.HelpTemplate() } else { - return `{{.Long | trim}} + return `{{with or .Long .Short }}{{. | trim}}{{end}} {{if or .Runnable .HasSubCommands}}{{.UsageString}}{{end}} ` } @@ -275,6 +285,7 @@ func stripFlags(args []string, c *Command) []string { if len(args) < 1 { return args } + c.mergePersistentFlags() commands := []string{} @@ -657,7 +668,7 @@ func (c *Command) Usage() error { // by the default HelpFunc in the commander func (c *Command) Help() error { c.mergePersistentFlags() - err := tmpl(c.Out(), c.HelpTemplate(), c) + err := tmpl(c.getOutOrStdout(), c.HelpTemplate(), c) return err } diff --git a/docs/kubectl-apiversions.md b/docs/kubectl-apiversions.md index bd597c6642..0108a53acd 100644 --- a/docs/kubectl-apiversions.md +++ b/docs/kubectl-apiversions.md @@ -11,6 +11,12 @@ Print available API versions. kubectl apiversions ``` +### Options + +``` + -h, --help=false: help for apiversions +``` + ### Options inherrited from parent commands ``` @@ -22,7 +28,6 @@ kubectl apiversions --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 - -h, --help=false: help for kubectl --insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. --kubeconfig="": Path to the kubeconfig file to use for CLI requests. --log_backtrace_at=:0: when logging hits line file:N, emit a stack trace diff --git a/docs/kubectl-expose.md b/docs/kubectl-expose.md index c548dedd19..c803873ad8 100644 --- a/docs/kubectl-expose.md +++ b/docs/kubectl-expose.md @@ -31,11 +31,8 @@ $ kubectl expose streamer --port=4100 --protocol=udp --service-name=video-stream --create-external-load-balancer=false: If true, create an external load balancer for this service. Implementation is cloud provider dependent. Default is 'false'. --dry-run=false: If true, only print the object that would be sent, without creating it. --generator="service/v1": The name of the API generator to use. Default is 'service/v1'. -<<<<<<< HEAD - -l, --labels="": Labels to apply to the service created by this call. -======= -h, --help=false: help for expose ->>>>>>> Revert "Revert "Update cobra/pflag. Also update generated kubectl documentation."" + -l, --labels="": Labels to apply to the service created by this call. --no-headers=false: When using the default output, don't print headers. -o, --output="": Output format. One of: json|yaml|template|templatefile. --output-version="": Output the formatted object with the given version (default api-version). diff --git a/docs/man/man1/kubectl-apiversions.1 b/docs/man/man1/kubectl-apiversions.1 index 0668b6d124..d46a9733e7 100644 --- a/docs/man/man1/kubectl-apiversions.1 +++ b/docs/man/man1/kubectl-apiversions.1 @@ -16,6 +16,12 @@ kubectl apiversions \- Print available API versions. Print available API versions. +.SH OPTIONS +.PP +\fB\-h\fP, \fB\-\-help\fP=false + help for apiversions + + .SH OPTIONS INHERITED FROM PARENT COMMANDS .PP \fB\-\-alsologtostderr\fP=false @@ -49,10 +55,6 @@ Print available API versions. \fB\-\-context\fP="" The name of the kubeconfig context to use -.PP -\fB\-h\fP, \fB\-\-help\fP=false - help for kubectl - .PP \fB\-\-insecure\-skip\-tls\-verify\fP=false If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. diff --git a/docs/man/man1/kubectl-expose.1 b/docs/man/man1/kubectl-expose.1 index ea02b3eee8..c1f04cfad4 100644 --- a/docs/man/man1/kubectl-expose.1 +++ b/docs/man/man1/kubectl-expose.1 @@ -38,13 +38,12 @@ as the selector for a new Service on the specified port. The name of the API generator to use. Default is 'service/v1'. .PP -<<<<<<< HEAD -\fB\-l\fP, \fB\-\-labels\fP="" - Labels to apply to the service created by this call. -======= \fB\-h\fP, \fB\-\-help\fP=false help for expose ->>>>>>> Revert "Revert "Update cobra/pflag. Also update generated kubectl documentation."" + +.PP +\fB\-l\fP, \fB\-\-labels\fP="" + Labels to apply to the service created by this call. .PP \fB\-\-no\-headers\fP=false