Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Oct 3, 2023
1 parent e9065c6 commit 3a072b1
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions example/cmd/action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,44 @@ func TestAction(t *testing.T) {
Expect(carapace.ActionMessage("values flag is not set").
Usage("ActionCallback()"))

s.Run("action", "--commands", "s").
Expect(carapace.ActionValuesDescribed(
"special", "",
"subcommand", "subcommand example",
).Suffix(" ").
NoSpace().
Tag("other commands").
Usage("ActionCommands()"))

s.Run("action", "--commands", "subcommand ").
Expect(carapace.Batch(
carapace.ActionValuesDescribed(
"a1", "subcommand with alias",
"a2", "subcommand with alias",
"alias", "subcommand with alias",
).Tag("other commands"),
carapace.ActionValuesDescribed(
"group", "subcommand with group",
).Style(style.Blue).Tag("group commands"),
).ToA().
Prefix("subcommand ").
Suffix(" ").
NoSpace().
Usage("ActionCommands()"))

s.Run("action", "--commands", "subcommand unknown ").
Expect(carapace.ActionMessage(`unknown subcommand "unknown" for "subcommand"`).NoSpace().
Usage("ActionCommands()"))

s.Run("action", "--commands", "subcommand hidden ").
Expect(carapace.ActionValuesDescribed(
"visible", "visible subcommand of a hidden command",
).Prefix("subcommand hidden ").
Suffix(" ").
NoSpace().
Tag("commands").
Usage("ActionCommands()"))

s.Run("action", "--values", "first", "--callback", "").
Expect(carapace.ActionMessage("values flag is set to: 'first'").
Usage("ActionCallback()"))
Expand Down

0 comments on commit 3a072b1

Please sign in to comment.