type genautocompleteCmd struct {
autocompleteTarget string
- // bash, zsh or fish
+
+ // bash, zsh, fish or powershell
autocompleteType string
+
*baseCmd
}
Add ` + "`--completionfile=/path/to/file`" + ` flag to set alternative
file-path and name.
-Add ` + "`--type={bash, zsh or fish}`" + ` flag to set alternative
+Add ` + "`--type={bash, zsh, fish or powershell}`" + ` flag to set alternative
shell type.
Logout and in again to reload the completion scripts,
}
switch cc.autocompleteType {
- case "zsh":
- err = cmd.Root().GenZshCompletion(target)
case "bash":
err = cmd.Root().GenBashCompletion(target)
+ case "zsh":
+ err = cmd.Root().GenZshCompletion(target)
case "fish":
err = cmd.Root().GenFishCompletion(target, true)
+ case "powershell":
+ err = cmd.Root().GenPowerShellCompletion(target)
default:
return newUserError("Unsupported completion type")
}
})
cc.cmd.PersistentFlags().StringVarP(&cc.autocompleteTarget, "completionfile", "f", "", "autocompletion file, defaults to stdout")
- cc.cmd.PersistentFlags().StringVarP(&cc.autocompleteType, "type", "t", "bash", "autocompletion type (zsh, bash or fish)")
+ cc.cmd.PersistentFlags().StringVarP(&cc.autocompleteType, "type", "t", "bash", "autocompletion type (bash, zsh, fish, or powershell)")
return cc
}