Change all cobra commands to use the example section

This will output the examples in their own section, rather than as part
of the 'long' synposis.
This commit is contained in:
Eric Paris
2015-02-20 16:28:43 -05:00
parent 781ca91a59
commit d508395828
15 changed files with 231 additions and 211 deletions

View File

@@ -25,28 +25,30 @@ import (
"github.com/spf13/cobra"
)
const (
stop_long = `Gracefully shut down a resource by id or filename.
Attempts to shut down and delete a resource that supports graceful termination.
If the resource is resizable it will be resized to 0 before deletion.`
stop_example = `// Shut down foo.
$ kubectl stop replicationcontroller foo
// Shut down the service defined in service.json
$ kubectl stop -f service.json
// Shut down all resources in the path/to/resources directory
$ kubectl stop -f path/to/resources`
)
func (f *Factory) NewCmdStop(out io.Writer) *cobra.Command {
flags := &struct {
Filenames util.StringList
}{}
cmd := &cobra.Command{
Use: "stop (<resource> <id>|-f filename)",
Short: "Gracefully shut down a resource by id or filename.",
Long: `Gracefully shut down a resource by id or filename.
Attempts to shut down and delete a resource that supports graceful termination.
If the resource is resizable it will be resized to 0 before deletion.
Examples:
// Shut down foo.
$ kubectl stop replicationcontroller foo
// Shut down the service defined in service.json
$ kubectl stop -f service.json
// Shut down all resources in the path/to/resources directory
$ kubectl stop -f path/to/resources`,
Use: "stop (<resource> <id>|-f filename)",
Short: "Gracefully shut down a resource by id or filename.",
Long: stop_long,
Example: stop_example,
Run: func(cmd *cobra.Command, args []string) {
cmdNamespace, err := f.DefaultNamespace(cmd)
checkErr(err)