-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More cleanup for failures on missing commands. #2580
Conversation
Closes:#2530 |
Okay... I have no idea why, but am throwing this out in case it's obvious to anyone: this change slightly breaks the Usage format:
This breaks all the scripts I've written that rely on '[command]' to indicate 'this is a podman command with further subcommands'. I can find a workaround, I'm sure, but first: does anyone understand why this is happening, and is there an easy fix for it? (my guess is that Oh, and I think you missed |
Update: this edit to --- a/cmd/podman/common.go
+++ b/cmd/podman/common.go
@@ -525,7 +525,7 @@ func scrubServer(server string) string {
// This blocks the desplaying of the global options. The main podman
// command should not use this.
func UsageTemplate() string {
- return `Usage:{{if .Runnable}}
+ return `Usage:{{if (and .Runnable (not .HasAvailableSubCommands))}}
{{.UseLine}}{{end}}{{if .HasAvailableSubCommands}}
{{.CommandPath}} [command]{{end}}{{if gt (len .Aliases) 0}}
|
This is really exciting. Thank you for finding a way to address this. I hope you'll accept my refactored PR (and the warning comment therein) |
@rhatdan I need to head out soon but just want to make sure you saw my refactoring PR? There's a lot of unnecessary duplication here, and also a serious index dereferencing bug (which can be fixed in only one place, if you agree with my PR approach) |
Sure lets finish this up tomorrow, Hopefully your idea works. |
/retest |
Currently in podman if a user specifies a command that does not exist the tool shows the help information. This patch changes it to show information like: $ ./bin/podman foobar Error: unrecognized command 'podman foobar' Try 'podman --help' for more information. $ ./bin/podman volume foobar Error: unrecognized command `podman volume foobar` Try 'podman volume --help' for more information. $ ./bin/podman container foobar Error: unrecognized command `podman container foobar` Try 'podman container --help' for more information. Signed-off-by: Daniel J Walsh <[email protected]>
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: edsantiago, rhatdan The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/lgtm I'd still encourage you to consider a more descriptive name than |
Currently in podman if a user specifies a command that does not exist
the tool shows the help information. This patch changes it to show
information like:
$ ./bin/podman foobar
Error: unrecognized command 'podman foobar'
Try 'podman --help' for more information.
$ ./bin/podman volume foobar
Error: unrecognized command
podman volume foobar
Try 'podman volume --help' for more information.
$ ./bin/podman container foobar
Error: unrecognized command
podman container foobar
Try 'podman container --help' for more information.
Signed-off-by: Daniel J Walsh [email protected]