Comments (4)
+1 for this. The Digital Ocean CLI utility, doctl has completion built in where all you have to do is add source <(doctl completion bash)
to your .bashrc
from vultr-cli.
With the release of vultr-cli 2.6.0 the addition of shell completions was added just not documented yet.
If you run vultr-cli completion
you will get
vultr-cli completion
Generate the autocompletion script for vultr-cli for the specified shell.
See each sub-command's help for details on how to use the generated script.
Usage:
vultr-cli completion [command]
Available Commands:
bash generate the autocompletion script for bash
fish generate the autocompletion script for fish
powershell generate the autocompletion script for powershell
zsh generate the autocompletion script for zsh
These autocompletions will get printed to stdout and will require you to set them up.
Some guides
Bash:
$ source <(yourprogram completion bash)
# To load completions for each session, execute once:
# Linux:
$ yourprogram completion bash > /etc/bash_completion.d/yourprogram
# macOS:
$ yourprogram completion bash > /usr/local/etc/bash_completion.d/yourprogram
Zsh:
# If shell completion is not already enabled in your environment,
# you will need to enable it. You can execute the following once:
$ echo "autoload -U compinit; compinit" >> ~/.zshrc
# To load completions for each session, execute once:
$ yourprogram completion zsh > "${fpath[1]}/_yourprogram"
# You will need to start a new shell for this setup to take effect.
fish:
$ yourprogram completion fish | source
# To load completions for each session, execute once:
$ yourprogram completion fish > ~/.config/fish/completions/yourprogram.fish
PowerShell:
PS> yourprogram completion powershell | Out-String | Invoke-Expression
# To load completions for every new session, run:
PS> yourprogram completion powershell > yourprogram.ps1
# and source this file from your PowerShell profile.
from vultr-cli.
yo quick info, we're having trouble generating the shell completions in the Arch Linux package build because we build in a clean environment and there's no api key configured:
[kpcyrd@build vultr-cli-2.6.0]$ ./vultr-cli completion bash
Please export your VULTR API key as an environment variable or add `api-key` to your config file, eg:
export VULTR_API_KEY='<api_key_from_vultr_account>'
[kpcyrd@build vultr-cli-2.6.0]$
We're working around this by exporting a dummy value, but tab completion also requires a dummy value to work if no api key is already configured:
[user@localhost ~]% vultr-cli <tab>
export VULTR_API_KEY='<api_key_from_vultr_account>'
Please export your VULTR API key as an environment variable or add `api-key` to your config file, eg:
[user@localhost ~]% export VULTR_API_KEY=x
[user@localhost ~]%
[user@localhost ~]%
[user@localhost ~]% vultr-cli <tab>
account -- Retrieve information about your account
apps -- Display all available applications
backups -- Display backups
bare-metal -- bare-metal is used to access bare metal server commands
block-storage -- block storage commands
completion -- generate the autocompletion script for the specified shell
dns -- dns is used to access dns commands
firewall -- firewall is used to access firewall commands
help -- Help about any command
instance -- commands to interact with instances on vultr
iso -- iso is used to access iso commands
load-balancer -- load balancer commands
network -- network interacts with network actions
object-storage -- object storage commands
os -- os is used to access os commands
plans -- get information about Vultr plans
regions -- get regions
reserved-ip -- reserved-ip lets you interact with reserved-ip
script -- startup script commands
snapshot -- snapshot commands
ssh-key -- ssh-key commands
user -- user commands
version -- Display current version of Vultr-cli
from vultr-cli.
This is due to how the CLI is currently designed. One of the first things it checks when executing your command is to see if the API Token is set (doesn't validate it yet). What you are doing is the only way around the current design. Set a dummy value so that it passes initial checks.
We have a ongoing ticket that will fix this behavior and introduce new features (#155)
from vultr-cli.
Related Issues (20)
- [BUG] - CLI requires non-empty VULTR_API_KEY for "help [..]" and "version" subcommands HOT 4
- [Feature] - Omit the `-cli` suffix? (not the repository) HOT 1
- Can't create bare metal instance HOT 2
- [Feature] - iPXE
- Expose "enable firewall" option for kubernetes create command HOT 1
- [BUG] - read_write isn't being passed on Docker Credentials Create
- [BUG] - Listing region availabilities causes a panic HOT 1
- [BUG] - Unable to get cluster config from CLI HOT 2
- [BUG] cannot add firewall rule HOT 4
- [BUG] - Detaching VPC2 does not work, api issue? HOT 6
- [BUG] - vpc2 delete -> 404
- [BUG] - Config file isn't being used to authenticate
- [BUG] - First run of vultr-cli prints warning
- [BUG] - Proxy protocol flag error on load balancer create HOT 1
- [Feature] - Allow attaching VPC2 to instance upon creation
- [BUG] - Error when creating DNS record CAA HOT 2
- [TEST] - Test issue
- [Feature] - Support paging for repositories in container registry HOT 3
- [BUG] - Error: error parsing flag 'mysql-long-query-time' for database update : trying to get int value of flag of type string HOT 1
- [BUG] - creating A and CNAME records fail without setting priority HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vultr-cli.