-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #890 from fabianofranz/fix_more_help_issues
Merged by openshift-bot
- Loading branch information
Showing
8 changed files
with
91 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package cmd | ||
|
||
import ( | ||
"io" | ||
|
||
"github.com/openshift/origin/pkg/cmd/templates" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func NewCmdOptions(f *Factory, out io.Writer) *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "options", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
cmd.Help() | ||
}, | ||
} | ||
|
||
cmd.SetUsageTemplate(templates.OptionsUsageTemplate) | ||
cmd.SetHelpTemplate("") | ||
|
||
return cmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package templates | ||
|
||
const ( | ||
MainHelpTemplate = `{{.Long | trim}} | ||
{{if or .Runnable .HasSubCommands}}{{.UsageString}}{{end}} | ||
` | ||
|
||
MainUsageTemplate = `{{ $cmd := . }} | ||
Usage: {{if .Runnable}} | ||
{{.UseLine}}{{if .HasFlags}} [options]{{end}}{{end}}{{if .HasSubCommands}} | ||
{{ .CommandPath}} [command]{{end}}{{if gt .Aliases 0}} | ||
Aliases: | ||
{{.NameAndAliases}}{{end}} | ||
{{ if .HasSubCommands}} | ||
Available Commands: {{range .Commands}}{{if .Runnable}} | ||
{{rpad .Use .UsagePadding }} {{.Short}}{{end}}{{end}} | ||
{{end}} | ||
{{ if .HasLocalFlags}}Options: | ||
{{.LocalFlags.FlagUsages}}{{end}} | ||
{{ if .HasAnyPersistentFlags}}Global Options: | ||
{{.AllPersistentFlags.FlagUsages}}{{end}}{{ if .HasSubCommands }} | ||
Use "{{.Root.Name}} help [command]" for more information about that command.{{end}}` | ||
|
||
CliHelpTemplate = `{{.Long | trim}} | ||
{{if or .Runnable .HasSubCommands}}{{.UsageString}}{{end}} | ||
` | ||
CliUsageTemplate = `{{ $cmd := . }}{{ if .HasSubCommands}} | ||
Available Commands: {{range .Commands}}{{if .Runnable}}{{if ne .Name "options"}} | ||
{{rpad .Use .UsagePadding }} {{.Short}}{{end}}{{end}}{{end}} | ||
{{end}} | ||
{{ if .HasLocalFlags}}Options: | ||
{{.LocalFlags.FlagUsages}}{{end}}{{ if .HasSubCommands }} | ||
Use "{{.Root.Name}} help [command]" for more information about that command.{{end}}{{ if .HasAnyPersistentFlags}} | ||
Use "{{.Root.Name}} options" for a list of global command-line options.{{end}}` | ||
|
||
OptionsUsageTemplate = `{{ if .HasAnyPersistentFlags}}The following options can be passed to any command: | ||
{{.AllPersistentFlags.FlagUsages}}{{end}}` | ||
) |