MCPcopy
hub / github.com/urfave/cli / TestFishCompletionShellComplete

Function TestFishCompletionShellComplete

fish_test.go:44–62  ·  fish_test.go::TestFishCompletionShellComplete
(t *testing.T)

Source from the content-addressed store, hash-verified

42}
43
44func TestFishCompletionShellComplete(t *testing.T) {
45 cmd := buildExtendedTestCommand()
46 cmd.ShellComplete = func(context.Context, *Command) {}
47
48 configCmd := cmd.Command("config")
49 configCmd.ShellComplete = func(context.Context, *Command) {}
50
51 subConfigCmd := configCmd.Command("sub-config")
52 subConfigCmd.ShellComplete = func(context.Context, *Command) {}
53
54 cmd.setupCommandGraph()
55
56 res, err := cmd.ToFishCompletion()
57 require.NoError(t, err)
58
59 assert.Contains(t, res, fmt.Sprintf("complete -c greet -n '__fish_greet_no_subcommand' -xa '(greet %s 2>/dev/null)'", completionFlag))
60 assert.Contains(t, res, fmt.Sprintf("complete -c greet -n '__fish_seen_subcommand_from config c' -xa '(greet config %s 2>/dev/null)'", completionFlag))
61 assert.Contains(t, res, fmt.Sprintf("complete -c greet -n '__fish_seen_subcommand_from config c; and __fish_seen_subcommand_from sub-config s ss' -xa '(greet config sub-config %s 2>/dev/null)'", completionFlag))
62}

Callers

nothing calls this directly

Calls 4

buildExtendedTestCommandFunction · 0.85
CommandMethod · 0.80
setupCommandGraphMethod · 0.80
ToFishCompletionMethod · 0.80

Tested by

no test coverage detected