cmd/help, cmd/root: Parametrize the basename of the executable

... instead of hard coding it as 'toolbox'.

https://github.com/containers/toolbox/pull/318
This commit is contained in:
Debarshi Ray 2020-04-30 15:30:20 +02:00
parent e8d7f25e83
commit e8866f2db1
2 changed files with 3 additions and 3 deletions

View File

@ -82,7 +82,7 @@ func helpShowManual(args []string) error {
if len(args) == 0 {
manual = "toolbox"
} else if args[0] == "toolbox" {
} else if args[0] == executableBase {
manual = "toolbox"
} else {
manual = "toolbox-" + args[0]

View File

@ -151,14 +151,14 @@ func rootRun(cmd *cobra.Command, args []string) error {
fmt.Fprintf(&builder, "enter Enter an existing toolbox container\n")
fmt.Fprintf(&builder, "list List all existing toolbox containers and images\n")
fmt.Fprintf(&builder, "\n")
fmt.Fprintf(&builder, "Run 'toolbox --help' for usage.")
fmt.Fprintf(&builder, "Run '%s --help' for usage.", executableBase)
errMsg := builder.String()
return errors.New(errMsg)
}
func rootUsage(cmd *cobra.Command) error {
err := errors.New("Run 'toolbox --help' for usage.")
err := fmt.Errorf("Run '%s --help' for usage.", executableBase)
fmt.Fprintf(os.Stderr, "%s", err)
return err
}