Shell completion - acmesh-official/acme.sh GitHub Wiki
acme.sh ships a bash completion file (acme.sh.completion) that tab-completes commands, parameters and many parameter values. Available on the dev branch (releases after 3.1.4).
What it completes:
- Commands as the first argument:
acme.sh --i<TAB>offers--install --install-cert --issue ... - Parameters after the command:
acme.sh --issue --key<TAB>gives--keylength - Your existing cert domains after
-d/--domain,--challenge-alias,--domain-alias:acme.sh --renew -d <TAB>lists the domains found in your config home, including wildcard and ECC certs - DNS API names after
--dns:acme.sh --issue --dns dns_c<TAB>offersdns_cf dns_cx ... - Deploy hooks after
--deploy-hook, notify hooks after--notify-hook - CA short names after
--server:letsencrypt letsencrypt_test zerossl sslcom google google_test actalis - Key lengths after
--keylength/--accountkeylength:2048 3072 4096 8192 ec-256 ec-384 ec-521 - Enumerated values after
--debug,--log-level,--syslog,--notify-level,--notify-mode,--revoke-reason, ... - Files/directories after path parameters like
--cert-file,--key-file,--webroot,--config-home, ...
A fresh acme.sh --install copies the file to ~/.acme.sh/acme.sh.completion and sources it from ~/.acme.sh/acme.sh.env, which your .bashrc already sources for the acme.sh alias. So on new installations the completion just works in new shells - nothing to configure.
acme.sh --upgrade refreshes the file itself, but does not touch your profile. To wire it up once on an existing installation, either re-run the installer:
cd ~/acme.sh # your acme.sh source checkout
./acme.sh --installor add one line to ~/.bashrc yourself:
. "$HOME/.acme.sh/acme.sh.completion"Copy the file from the source tree to the standard bash-completion directory:
cp acme.sh.completion /usr/share/bash-completion/completions/acme.shThe bash completion file works in zsh through bashcompinit. Add to ~/.zshrc (after compinit if you load it):
autoload -U +X bashcompinit && bashcompinit
. "$HOME/.acme.sh/acme.sh.completion"Note: ~/.acme.sh/acme.sh.env is sourced by .zshrc on zsh installations too, but the completion only activates if bashcompinit was loaded before that point. The file silently does nothing in shells without the complete builtin, so sourcing it never breaks a non-bash shell.
- The completion reads
LE_WORKING_DIR/LE_CONFIG_HOMEif set (exported byacme.sh.env), so custom--home/--config-homeinstallations complete domains and hooks from the right place. - Domain completion lists the certs already present in your config home; it cannot suggest domains you have not issued yet.
- fish is not supported yet.