summaryrefslogtreecommitdiffstats
path: root/commands/genautocomplete.go
diff options
context:
space:
mode:
Diffstat (limited to 'commands/genautocomplete.go')
-rw-r--r--commands/genautocomplete.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/commands/genautocomplete.go b/commands/genautocomplete.go
index b7f74fd89..54dd7563b 100644
--- a/commands/genautocomplete.go
+++ b/commands/genautocomplete.go
@@ -31,16 +31,19 @@ or just source them in directly:
$ . /etc/bash_completion`,
- Run: func(cmd *cobra.Command, args []string) {
+ RunE: func(cmd *cobra.Command, args []string) error {
if autocompleteType != "bash" {
- jww.FATAL.Fatalln("Only Bash is supported for now")
+ return newUserError("Only Bash is supported for now")
}
+
err := cmd.Root().GenBashCompletionFile(autocompleteTarget)
+
if err != nil {
- jww.FATAL.Fatalln("Failed to generate shell completion file:", err)
+ return err
} else {
jww.FEEDBACK.Println("Bash completion file for Hugo saved to", autocompleteTarget)
}
+ return nil
},
}