Using packet CLI tool with autocomplete - ebsarr/packet GitHub Wiki

Using packet CLI tool with autocomplete

You can generate a autocomplete script with packet. Here is how:

$ packet genautocomple

This command will generate a shell script named packet-autocomplete.sh. You'll need to install bash-completion in your system to enable it.

Installing bash-completion

Linux ( apt-get )

$ sudo apt-get install bash-completion

Linux ( yum )

$ sudo yum install bash-completion

Mac

$ brew install bash-completion

Place packet-autocomplete.sh in bash_completion.d

Linux

$ mv packet-autocomplete.sh /etc/bash_completion.d/

Mac

$ mv packet-autocomplete.sh $(brew --prefix)/etc/bash_completion.d/

Good to go. On your next login, you should be able autocomplete packet commands:

$ packet admin [TAB] [TAB]
add-profile          delete-profile       list-facilities      list-profiles        list-projects        update-project
create-project       delete-project       list-os              list-project         list-sshkey          update-sshkey
create-sshkey        delete-sshkey        list-plans           list-project-events  list-sshkeys
$ packet admin

Happy tabbing...