mirror of
https://github.com/linka-cloud/d2vm.git
synced 2025-07-04 02:22:27 +00:00
fix zsh completion not working with source
README.md: add shell completion installation instructions Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
This commit is contained in:
@ -56,6 +56,12 @@ var (
|
||||
logrus.SetLevel(logrus.TraceLevel)
|
||||
}
|
||||
exec.SetDebug(verbose)
|
||||
|
||||
// make the zsh completion work when sourced with `source <(d2vm completion zsh)`
|
||||
if cmd.Name() == "zsh" && cmd.Parent() != nil && cmd.Parent().Name() == "completion" {
|
||||
zshHead := fmt.Sprintf("#compdef %[1]s\ncompdef _%[1]s %[1]s\n", cmd.Root().Name())
|
||||
cmd.OutOrStdout().Write([]byte(zshHead))
|
||||
}
|
||||
},
|
||||
}
|
||||
)
|
||||
|
Reference in New Issue
Block a user