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

@@ -27,28 +27,27 @@ import (
)
const (
updatePeriod = "1m0s"
timeout = "5m0s"
pollInterval = "3s"
updatePeriod = "1m0s"
timeout = "5m0s"
pollInterval = "3s"
rollingupdate_long = `Perform a rolling update of the given ReplicationController.
Replaces the specified controller with new controller, updating one pod at a time to use the
new PodTemplate. The new-controller.json must specify the same namespace as the
existing controller and overwrite at least one (common) label in its replicaSelector.`
rollingupdate_example = `// Update pods of frontend-v1 using new controller data in frontend-v2.json.
$ kubectl rollingupdate frontend-v1 -f frontend-v2.json
// Update pods of frontend-v1 using JSON data passed into stdin.
$ cat frontend-v2.json | kubectl rollingupdate frontend-v1 -f -`
)
func (f *Factory) NewCmdRollingUpdate(out io.Writer) *cobra.Command {
cmd := &cobra.Command{
Use: "rollingupdate <old-controller-name> -f <new-controller.json>",
Short: "Perform a rolling update of the given ReplicationController.",
Long: `Perform a rolling update of the given ReplicationController.
Replaces the specified controller with new controller, updating one pod at a time to use the
new PodTemplate. The new-controller.json must specify the same namespace as the
existing controller and overwrite at least one (common) label in its replicaSelector.
Examples:
// Update pods of frontend-v1 using new controller data in frontend-v2.json.
$ kubectl rollingupdate frontend-v1 -f frontend-v2.json
// Update pods of frontend-v1 using JSON data passed into stdin.
$ cat frontend-v2.json | kubectl rollingupdate frontend-v1 -f -`,
Use: "rollingupdate <old-controller-name> -f <new-controller.json>",
Short: "Perform a rolling update of the given ReplicationController.",
Long: rollingupdate_long,
Example: rollingupdate_example,
Run: func(cmd *cobra.Command, args []string) {
filename := util.GetFlagString(cmd, "filename")
if len(filename) == 0 {