Skip to content
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

Correctly display help whe nthe users types an unknown command #367

Merged
merged 1 commit into from Jul 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG
Expand Up @@ -9,6 +9,7 @@ Changelog

* [logs] accepts filter for postdeploy and one-off container
* [authentication] use of the new authentication API `auth.scalingo.com`
* [help] fix missing help with unknown commsnds #365

### 1.7.0

Expand Down
5 changes: 2 additions & 3 deletions cmd/help.go
@@ -1,8 +1,8 @@
package cmd

import (
"github.com/urfave/cli"
"github.com/Scalingo/cli/cmd/autocomplete"
"github.com/urfave/cli"
)

var (
Expand All @@ -13,9 +13,8 @@ var (
args := c.Args()
if args.Present() {
cli.ShowCommandHelp(c, args.First())
} else {
cli.ShowAppHelp(c)
}
cli.ShowAppHelp(c)
},
BashComplete: func(c *cli.Context) {
autocomplete.CmdFlagsAutoComplete(c, "help")
Expand Down
3 changes: 2 additions & 1 deletion scalingo/main.go
Expand Up @@ -89,7 +89,8 @@ COMMANDS:{{range .VisibleCategories}}{{if .Name}}
{{end}}{{end}}{{if .VisibleFlags}}
GLOBAL OPTIONS:
{{range $index, $option := .VisibleFlags}}{{if $index}}
{{end}}{{$option}}{{end}}{{end}}{{if .Copyright}}
{{end}}{{$option}}{{end}}{{end}}
{{if .Copyright}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it valid to put the if statement on a new line?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we're in a template and I wanted to add a newline because the output was not great (really compacted)


COPYRIGHT:
{{.Copyright}}{{end}}
Expand Down