|
|
@ -50,11 +50,17 @@ func TestComplete(t *testing.T) {
|
|
|
|
cmd := &ffcli.Command{
|
|
|
|
cmd := &ffcli.Command{
|
|
|
|
Name: "ping",
|
|
|
|
Name: "ping",
|
|
|
|
FlagSet: newFlagSet("prog ping", flag.ContinueOnError, func(fs *flag.FlagSet) {
|
|
|
|
FlagSet: newFlagSet("prog ping", flag.ContinueOnError, func(fs *flag.FlagSet) {
|
|
|
|
fs.String("until", "", "when pinging should end")
|
|
|
|
fs.String("until", "", "when pinging should end\nline break!")
|
|
|
|
ffcomplete.Flag(fs, "until", ffcomplete.Fixed("forever", "direct"))
|
|
|
|
ffcomplete.Flag(fs, "until", ffcomplete.Fixed("forever", "direct"))
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ffcomplete.Args(cmd, ffcomplete.Fixed("jupiter", "neptune", "venus"))
|
|
|
|
ffcomplete.Args(cmd, ffcomplete.Fixed(
|
|
|
|
|
|
|
|
"jupiter\t5th planet\nand largets",
|
|
|
|
|
|
|
|
"neptune\t8th planet",
|
|
|
|
|
|
|
|
"venus\t2nd planet",
|
|
|
|
|
|
|
|
"\tonly description",
|
|
|
|
|
|
|
|
"\nonly line break",
|
|
|
|
|
|
|
|
))
|
|
|
|
return cmd
|
|
|
|
return cmd
|
|
|
|
}(),
|
|
|
|
}(),
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -170,9 +176,9 @@ func TestComplete(t *testing.T) {
|
|
|
|
showDescs: true,
|
|
|
|
showDescs: true,
|
|
|
|
wantComp: []string{
|
|
|
|
wantComp: []string{
|
|
|
|
"--until\twhen pinging should end",
|
|
|
|
"--until\twhen pinging should end",
|
|
|
|
"jupiter",
|
|
|
|
"jupiter\t5th planet",
|
|
|
|
"neptune",
|
|
|
|
"neptune\t8th planet",
|
|
|
|
"venus",
|
|
|
|
"venus\t2nd planet",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
wantDir: ffcomplete.ShellCompDirectiveNoFileComp,
|
|
|
|
wantDir: ffcomplete.ShellCompDirectiveNoFileComp,
|
|
|
|
},
|
|
|
|
},
|
|
|
|