2
2
mirror of https://github.com/octoleo/restic.git synced 2024-12-23 03:18:55 +00:00

Correct bash completion file path

This commit is contained in:
Alexander Neumann 2017-09-15 20:45:16 +02:00
parent 5b1e4df177
commit 81c5d8a968

View File

@ -4,8 +4,6 @@ import (
"github.com/spf13/cobra"
)
var autocompleteTarget string
var cmdAutocomplete = &cobra.Command{
Use: "autocomplete",
Short: "Generate shell autocompletion script",
@ -28,10 +26,12 @@ $ sudo restic autocomplete`,
},
}
var autocompleteTarget string
func init() {
cmdRoot.AddCommand(cmdAutocomplete)
cmdAutocomplete.Flags().StringVarP(&autocompleteTarget, "completionfile", "", "/etc/bash_completion.d/restic.sh", "autocompletion file")
cmdAutocomplete.Flags().StringVarP(&autocompleteTarget, "completionfile", "", "/usr/share/bash-completion/completions/restic", "autocompletion file")
// For bash-completion
cmdAutocomplete.Flags().SetAnnotation("completionfile", cobra.BashCompFilenameExt, []string{})
}