# bash completion for lw. Generated by make completion from lw's own tables: edit cmd/lw, not this file. _lw_reply() { compopt -o filenames 2>/dev/null; mapfile -t COMPREPLY < <(compgen "$@" -- "$cur"); } _lw() { local cur=${COMP_WORDS[COMP_CWORD]} prev='' i=$COMP_CWORD words ((i > 0)) && prev=${COMP_WORDS[i-1]} # bash splits --key=value at '=': complete the value of the key before it if [[ $cur == = ]]; then cur='' elif [[ $prev == = ]]; then prev=${COMP_WORDS[i-2]} fi case ${COMP_WORDS[1]}:$i in *:1) words='--auto_reload --check -t --color --config -c --dump --filter --format --heartbeat --help -h --logging.console.target --logging.file.directory --logging.file.max_size_mb --logging.file.max_total_size_mb --logging.file.name --logging.file.retention_hours --logging.format --logging.level --logging.output --logging.sanitization --pipeline --preset -p --quiet -q --rate-limit --schema --sink --source --status_reporter --version -V auth tls preset config help' ;; auth:2) words='add-user remove-user token stream' ;; auth:*) case ${COMP_WORDS[2]} in add-user) case $prev in --credentials|-credentials|--password-file|-password-file|--user|-user|-u) COMPREPLY=(); return ;; esac words='--credentials --generate --password-file --user -u --help -h' ;; remove-user) case $prev in --credentials|-credentials|--user|-user|-u) COMPREPLY=(); return ;; esac words='--credentials --user -u --help -h' ;; token) case $prev in --ca-file|-ca-file|--cert-file|-cert-file|--key-file|-key-file|--password-file|-password-file|--pin-sha256|-pin-sha256|--server-name|-server-name|--url|-url|--user|-user|-u) COMPREPLY=(); return ;; esac words='--ca-file --cert-file --key-file --password-file --pin-sha256 --server-name --unbound --url --user -u --help -h' ;; stream) case $prev in --addr|-addr|--ca-file|-ca-file|--cert-file|-cert-file|--key-file|-key-file|--password-file|-password-file|--pin-sha256|-pin-sha256|--server-name|-server-name|--user|-user|-u) COMPREPLY=(); return ;; esac words='--addr --ca-file --cert-file --key-file --password-file --pin-sha256 --server-name --user -u --help -h' ;; esac ;; tls:2) words='ca cert' ;; tls:*) case ${COMP_WORDS[2]} in ca) case $prev in --dir|-dir) _lw_reply -d; return ;; --days|-days|--name|-name) COMPREPLY=(); return ;; esac words='--days --dir --name --help -h' ;; cert) case $prev in --ca-dir|-ca-dir|--out|-out) _lw_reply -d; return ;; --days|-days|--hosts|-hosts|--name|-name) COMPREPLY=(); return ;; esac words='--ca-dir --client --days --hosts --name --out --server --help -h' ;; esac ;; preset:2) words='pipe tail serve edge aggregator' ;; preset:*) case ${COMP_WORDS[2]} in pipe) case $prev in --format|-format) COMPREPLY=(); return ;; esac words='--format --help -h' ;; tail) case $prev in --format|-format|--from|-from|--path|-path) COMPREPLY=(); return ;; esac words='--format --from --path --help -h' ;; serve) case $prev in --allow|-allow|--cert|-cert|--deny|-deny|--format|-format|--from|-from|--hosts|-hosts|--issuer_cert|-issuer_cert|--issuer_key|-issuer_key|--key|-key|--listen|-listen|--path|-path|--proxy|-proxy|--tls|-tls|--users|-users|--viewer|-viewer) COMPREPLY=(); return ;; esac words='--allow --cert --deny --format --from --hosts --issuer_cert --issuer_key --key --listen --path --proxy --tls --users --viewer --help -h' ;; edge) case $prev in --ca|-ca|--cert|-cert|--from|-from|--key|-key|--node|-node|--password_file|-password_file|--path|-path|--pin|-pin|--server_name|-server_name|--to|-to|--transport|-transport|--user|-user|-u) COMPREPLY=(); return ;; esac words='--ca --cert --from --key --node --password_file --path --pin --server_name --to --transport --user -u --help -h' ;; aggregator) case $prev in --allow|-allow|--cert|-cert|--client_ca|-client_ca|--deny|-deny|--format|-format|--hosts|-hosts|--issuer_cert|-issuer_cert|--issuer_key|-issuer_key|--key|-key|--listen|-listen|--out|-out|--tls|-tls|--transport|-transport|--users|-users) COMPREPLY=(); return ;; esac words='--allow --cert --client_ca --deny --format --hosts --issuer_cert --issuer_key --key --listen --out --tls --transport --users --help -h' ;; esac ;; config:2) words='init' ;; config:*) case ${COMP_WORDS[2]} in init) case $prev in --out|-out) COMPREPLY=(); return ;; esac words='--out --help -h' ;; esac ;; *) case $prev in --logging.file.directory) _lw_reply -d; return ;; --preset|-p) mapfile -t COMPREPLY < <(compgen -W 'pipe tail serve edge aggregator' -- "$cur"); return ;; --config|-c|--filter|--format|--heartbeat|--logging.console.target|--logging.file.max_size_mb|--logging.file.max_total_size_mb|--logging.file.name|--logging.file.retention_hours|--logging.format|--logging.level|--logging.output|--logging.sanitization|--pipeline|--rate-limit|--sink|--source) COMPREPLY=(); return ;; esac words='--auto_reload --check -t --color --config -c --dump --filter --format --heartbeat --help -h --logging.console.target --logging.file.directory --logging.file.max_size_mb --logging.file.max_total_size_mb --logging.file.name --logging.file.retention_hours --logging.format --logging.level --logging.output --logging.sanitization --pipeline --preset -p --quiet -q --rate-limit --schema --sink --source --status_reporter --version -V' ;; esac mapfile -t COMPREPLY < <(compgen -W "$words" -- "$cur") } # An empty reply falls back to file names, as without this script complete -o bashdefault -o default -F _lw lw