Don't automagically add "[OPTIONS]" to usage
| ... | ... |
@@ -17,7 +17,7 @@ import ( |
| 17 | 17 |
// |
| 18 | 18 |
// Usage: docker exec [OPTIONS] CONTAINER COMMAND [ARG...] |
| 19 | 19 |
func (cli *DockerCli) CmdExec(args ...string) error {
|
| 20 |
- cmd := Cli.Subcmd("exec", []string{"CONTAINER COMMAND [ARG...]"}, Cli.DockerCommands["exec"].Description, true)
|
|
| 20 |
+ cmd := Cli.Subcmd("exec", []string{"[OPTIONS] CONTAINER COMMAND [ARG...]"}, Cli.DockerCommands["exec"].Description, true)
|
|
| 21 | 21 |
detachKeys := cmd.String([]string{"-detach-keys"}, "", "Override the key sequence for detaching a container")
|
| 22 | 22 |
|
| 23 | 23 |
execConfig, err := ParseExec(cmd, args) |
| ... | ... |
@@ -15,7 +15,7 @@ import ( |
| 15 | 15 |
// |
| 16 | 16 |
// Usage: docker inspect [OPTIONS] CONTAINER|IMAGE|TASK [CONTAINER|IMAGE|TASK...] |
| 17 | 17 |
func (cli *DockerCli) CmdInspect(args ...string) error {
|
| 18 |
- cmd := Cli.Subcmd("inspect", []string{"CONTAINER|IMAGE|TASK [CONTAINER|IMAGE|TASK...]"}, Cli.DockerCommands["inspect"].Description, true)
|
|
| 18 |
+ cmd := Cli.Subcmd("inspect", []string{"[OPTIONS] CONTAINER|IMAGE|TASK [CONTAINER|IMAGE|TASK...]"}, Cli.DockerCommands["inspect"].Description, true)
|
|
| 19 | 19 |
tmplStr := cmd.String([]string{"f", "-format"}, "", "Format the output using the given go template")
|
| 20 | 20 |
inspectType := cmd.String([]string{"-type"}, "", "Return JSON for specified type, (e.g image, container or task)")
|
| 21 | 21 |
size := cmd.Bool([]string{"s", "-size"}, false, "Display total file sizes if the type is container")
|
| ... | ... |
@@ -28,7 +28,7 @@ func newListCommand(dockerCli *client.DockerCli) *cobra.Command {
|
| 28 | 28 |
opts := listOptions{filter: opts.NewFilterOpt()}
|
| 29 | 29 |
|
| 30 | 30 |
cmd := &cobra.Command{
|
| 31 |
- Use: "ls", |
|
| 31 |
+ Use: "ls [OPTIONS]", |
|
| 32 | 32 |
Aliases: []string{"list"},
|
| 33 | 33 |
Short: "List nodes in the swarm", |
| 34 | 34 |
Args: cli.NoArgs, |
| ... | ... |
@@ -25,7 +25,7 @@ type pluginOptions struct {
|
| 25 | 25 |
func newInstallCommand(dockerCli *client.DockerCli) *cobra.Command {
|
| 26 | 26 |
var options pluginOptions |
| 27 | 27 |
cmd := &cobra.Command{
|
| 28 |
- Use: "install PLUGIN", |
|
| 28 |
+ Use: "install [OPTIONS] PLUGIN", |
|
| 29 | 29 |
Short: "Install a plugin", |
| 30 | 30 |
Args: cli.RequiresMinArgs(1), // TODO: allow for set args |
| 31 | 31 |
RunE: func(cmd *cobra.Command, args []string) error {
|
| ... | ... |
@@ -30,7 +30,7 @@ func newListCommand(dockerCli *client.DockerCli) *cobra.Command {
|
| 30 | 30 |
opts := listOptions{filter: opts.NewFilterOpt()}
|
| 31 | 31 |
|
| 32 | 32 |
cmd := &cobra.Command{
|
| 33 |
- Use: "ls", |
|
| 33 |
+ Use: "ls [OPTIONS]", |
|
| 34 | 34 |
Aliases: []string{"list"},
|
| 35 | 35 |
Short: "List services", |
| 36 | 36 |
Args: cli.NoArgs, |
| ... | ... |
@@ -18,7 +18,7 @@ func newLeaveCommand(dockerCli *client.DockerCli) *cobra.Command {
|
| 18 | 18 |
opts := leaveOptions{}
|
| 19 | 19 |
|
| 20 | 20 |
cmd := &cobra.Command{
|
| 21 |
- Use: "leave", |
|
| 21 |
+ Use: "leave [OPTIONS]", |
|
| 22 | 22 |
Short: "Leave a Swarm", |
| 23 | 23 |
Args: cli.NoArgs, |
| 24 | 24 |
RunE: func(cmd *cobra.Command, args []string) error {
|
| ... | ... |
@@ -16,7 +16,7 @@ func newUpdateCommand(dockerCli *client.DockerCli) *cobra.Command {
|
| 16 | 16 |
opts := swarmOptions{autoAccept: NewAutoAcceptOption()}
|
| 17 | 17 |
|
| 18 | 18 |
cmd := &cobra.Command{
|
| 19 |
- Use: "update", |
|
| 19 |
+ Use: "update [OPTIONS]", |
|
| 20 | 20 |
Short: "Update the Swarm", |
| 21 | 21 |
Args: cli.NoArgs, |
| 22 | 22 |
RunE: func(cmd *cobra.Command, args []string) error {
|
| ... | ... |
@@ -26,7 +26,7 @@ func newCreateCommand(dockerCli *client.DockerCli) *cobra.Command {
|
| 26 | 26 |
} |
| 27 | 27 |
|
| 28 | 28 |
cmd := &cobra.Command{
|
| 29 |
- Use: "create", |
|
| 29 |
+ Use: "create [OPTIONS]", |
|
| 30 | 30 |
Short: "Create a volume", |
| 31 | 31 |
Args: cli.NoArgs, |
| 32 | 32 |
RunE: func(cmd *cobra.Command, args []string) error {
|
| ... | ... |
@@ -155,11 +155,6 @@ func Subcmd(name string, synopses []string, description string, exitOnError bool |
| 155 | 155 |
} |
| 156 | 156 |
|
| 157 | 157 |
flags.ShortUsage = func() {
|
| 158 |
- options := "" |
|
| 159 |
- if flags.FlagCountUndeprecated() > 0 {
|
|
| 160 |
- options = " [OPTIONS]" |
|
| 161 |
- } |
|
| 162 |
- |
|
| 163 | 158 |
if len(synopses) == 0 {
|
| 164 | 159 |
synopses = []string{""}
|
| 165 | 160 |
} |
| ... | ... |
@@ -176,7 +171,7 @@ func Subcmd(name string, synopses []string, description string, exitOnError bool |
| 176 | 176 |
synopsis = " " + synopsis |
| 177 | 177 |
} |
| 178 | 178 |
|
| 179 |
- fmt.Fprintf(flags.Out(), "\n%sdocker %s%s%s", lead, name, options, synopsis) |
|
| 179 |
+ fmt.Fprintf(flags.Out(), "\n%sdocker %s%s", lead, name, synopsis) |
|
| 180 | 180 |
} |
| 181 | 181 |
|
| 182 | 182 |
fmt.Fprintf(flags.Out(), "\n\n%s\n", description) |
| ... | ... |
@@ -32,7 +32,7 @@ func NewCobraAdaptor(clientFlags *cliflags.ClientFlags) CobraAdaptor {
|
| 32 | 32 |
dockerCli := client.NewDockerCli(stdin, stdout, stderr, clientFlags) |
| 33 | 33 |
|
| 34 | 34 |
var rootCmd = &cobra.Command{
|
| 35 |
- Use: "docker", |
|
| 35 |
+ Use: "docker [OPTIONS]", |
|
| 36 | 36 |
SilenceUsage: true, |
| 37 | 37 |
SilenceErrors: true, |
| 38 | 38 |
} |
| ... | ... |
@@ -131,7 +131,7 @@ func (c CobraAdaptor) Command(name string) func(...string) error {
|
| 131 | 131 |
return nil |
| 132 | 132 |
} |
| 133 | 133 |
|
| 134 |
-var usageTemplate = `Usage: {{if not .HasSubCommands}}{{if .HasLocalFlags}}{{appendIfNotPresent .UseLine "[OPTIONS]"}}{{else}}{{.UseLine}}{{end}}{{end}}{{if .HasSubCommands}}{{ .CommandPath}} COMMAND{{end}}
|
|
| 134 |
+var usageTemplate = `Usage: {{if not .HasSubCommands}}{{.UseLine}}{{end}}{{if .HasSubCommands}}{{ .CommandPath}} COMMAND{{end}}
|
|
| 135 | 135 |
|
| 136 | 136 |
{{with or .Long .Short }}{{. | trim}}{{end}}{{if gt .Aliases 0}}
|
| 137 | 137 |
|