Skip to content

Commit

Permalink
Merge pull request #25 from tamada/issue/update_rrh_list_options
Browse files Browse the repository at this point in the history
ref #21 update list options.
  • Loading branch information
tamada committed Mar 27, 2019
2 parents 331f6ba + 65c291e commit 96b8594
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
24 changes: 12 additions & 12 deletions list/list_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,14 @@ Help function shows the help message.
func (list *ListCommand) Help() string {
return `rrh list [OPTIONS] [GROUPS...]
OPTIONS
-a, --all print all entries of each repository.
-d, --desc print description of group.
-p, --path print local paths (default).
-r, --remote print remote urls.
if any options of above are specified, '-a' are specified.
-n, --no-omit print all repositories, no omittion.
-c, --csv print result as csv format.
-a, --all print all repositories, no omit repositories.
-d, --desc print description of group.
-p, --path print local paths (default).
-r, --remote print remote urls.
if any options of above are specified, '-a' are specified.
-A, --all-entries print all entries of each repository.
-c, --csv print result as csv format.
ARGUMENTS
GROUPS print managed repositories categorized in the groups.
if no groups are specified, all groups are printed.`
Expand All @@ -187,16 +187,16 @@ func (list *ListCommand) buildFlagSet() (*flag.FlagSet, *listOptions) {
var options = listOptions{false, false, false, false, false, false, []string{}}
flags := flag.NewFlagSet("list", flag.ContinueOnError)
flags.Usage = func() { fmt.Println(list.Help()) }
flags.BoolVar(&options.all, "a", false, "all flag")
flags.BoolVar(&options.all, "all", false, "all flag")
flags.BoolVar(&options.all, "A", false, "show all entries")
flags.BoolVar(&options.all, "all-entries", false, "show all entries")
flags.BoolVar(&options.description, "d", false, "description flag")
flags.BoolVar(&options.description, "desc", false, "description flag")
flags.BoolVar(&options.localPath, "p", false, "local path flag")
flags.BoolVar(&options.localPath, "path", false, "local path flag")
flags.BoolVar(&options.remoteURL, "r", false, "remote url flag")
flags.BoolVar(&options.remoteURL, "remote", false, "remote url flag")
flags.BoolVar(&options.noOmit, "n", false, "no omit repositories")
flags.BoolVar(&options.noOmit, "no-omit", false, "no omit repositories")
flags.BoolVar(&options.noOmit, "a", false, "no omit repositories")
flags.BoolVar(&options.noOmit, "all", false, "no omit repositories")
flags.BoolVar(&options.csv, "c", false, "print as csv format")
flags.BoolVar(&options.csv, "csv", false, "print as csv format")
return flags, &options
Expand Down
18 changes: 9 additions & 9 deletions list/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ func TestRunByCsvOutput(t *testing.T) {
os.Setenv(common.RrhDatabasePath, "../testdata/tmp.json")
var result, _ = common.CaptureStdout(func() {
var list, _ = ListCommandFactory()
list.Run([]string{"--all", "--csv"})
list.Run([]string{"--all-entries", "--csv"})
})
result = strings.TrimSpace(result)
var want = "group1,desc1,repo1,path1\ngroup3,desc3,repo2,path2"
if result != want {
t.Errorf("result did not match\ngot: %s\nwant: %s", result, want)
t.Errorf("result did not match\ngot: %s\nwont: %s", result, want)
}
}

Expand All @@ -56,14 +56,14 @@ func TestListCommandHelpAndSynopsis(t *testing.T) {
var list = ListCommand{&listOptions{}}
var helpMessage = `rrh list [OPTIONS] [GROUPS...]
OPTIONS
-a, --all print all entries of each repository.
-d, --desc print description of group.
-p, --path print local paths (default).
-r, --remote print remote urls.
if any options of above are specified, '-a' are specified.
-n, --no-omit print all repositories, no omittion.
-a, --all print all repositories, no omit repositories.
-d, --desc print description of group.
-p, --path print local paths (default).
-r, --remote print remote urls.
if any options of above are specified, '-a' are specified.
-A, --all-entries print all entries of each repository.
-c, --csv print result as csv format.
-c, --csv print result as csv format.
ARGUMENTS
GROUPS print managed repositories categorized in the groups.
if no groups are specified, all groups are printed.`
Expand Down

0 comments on commit 96b8594

Please sign in to comment.