Skip to content

Commit

Permalink
Test the help command with an example
Browse files Browse the repository at this point in the history
  • Loading branch information
gsamokovarov committed Mar 13, 2017
1 parent a71a832 commit b577107
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/help.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Options:{{range .Options}}

func helpCmd(cli.Args, config.Config) {
tmpl := template.Must(template.New("--help").Parse(helpUsage))
tmpl.Execute(os.Stderr, cli.Registry)
tmpl.Execute(os.Stdout, cli.Registry)
}

func init() {
Expand Down
27 changes: 27 additions & 0 deletions cmd/help_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package cmd

import (
"github.com/gsamokovarov/jump/cli"
)

func ExampleHelpCmd() {
helpCmd(cli.Args{}, nil)

// Output:
// Usage: jump [COMMAND ...]
//
// Jump to a fuzzy-matched directory passed as an argument.
//
// Commands:
// cd Fuzzy match a directory to jump to.
// chdir Update the score of directory during chdir.
// clean Cleans the database of inexisting entries.
// hint Hints relevant paths for jumping.
// pin Pin a directory to a search term.
// shell Display a shell integration script.
// top List the directories as they are scored.
//
// Options:
// --help Show this screen.
// --version Show version.
}

0 comments on commit b577107

Please sign in to comment.