Skip to content

Commit

Permalink
CLI: add bash completion on start
Browse files Browse the repository at this point in the history
  • Loading branch information
mame82 committed Nov 15, 2018
1 parent 5a08364 commit d902080
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cli_client/cmd_root.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,17 @@ from the command line. The tool relies on RPC so it could be used
remotely.`,
}

func GenBashComplete() {
target := "/etc/bash_completion.d/p4wnp1.sh"
if _, err := os.Stat(target); os.IsNotExist(err) {
rootCmd.GenBashCompletionFile(target)
}
}

func Execute() {
// ToDo: this should be changed to a dedicated command which is sourced in in .bashrc to assure updates on start of bash
GenBashComplete()

if err := rootCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
Expand Down

0 comments on commit d902080

Please sign in to comment.