Add type switch
Signed-off-by: Sascha Grunert <sgrunert@suse.com>
This commit is contained in:
parent
38d0ac6296
commit
0c01922a12
26
fish.go
26
fish.go
@ -164,19 +164,21 @@ func fishAddFileFlag(
|
|||||||
flag Flag,
|
flag Flag,
|
||||||
completion *strings.Builder,
|
completion *strings.Builder,
|
||||||
) {
|
) {
|
||||||
addFileExclusionFlag := true
|
switch f := flag.(type) {
|
||||||
if f, ok := flag.(GenericFlag); ok && f.TakesFile {
|
case GenericFlag:
|
||||||
addFileExclusionFlag = false
|
if f.TakesFile {
|
||||||
}
|
return
|
||||||
if f, ok := flag.(StringFlag); ok && f.TakesFile {
|
}
|
||||||
addFileExclusionFlag = false
|
case StringFlag:
|
||||||
}
|
if f.TakesFile {
|
||||||
if f, ok := flag.(StringSliceFlag); ok && f.TakesFile {
|
return
|
||||||
addFileExclusionFlag = false
|
}
|
||||||
}
|
case StringSliceFlag:
|
||||||
if addFileExclusionFlag {
|
if f.TakesFile {
|
||||||
completion.WriteString(" -f")
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
completion.WriteString(" -f")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *App) fishSubcommandHelper(allCommands []string) string {
|
func (a *App) fishSubcommandHelper(allCommands []string) string {
|
||||||
|
Loading…
Reference in New Issue
Block a user