aboutsummaryrefslogtreecommitdiffstats
path: root/share/bash-completion
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-12-01 01:56:26 +0000
committertv <tv@krebsco.de>2026-12-01 01:56:26 +0000
commit1e3189bd8861ec224ca27a770499569c7dc1bae5 (patch)
tree349015edc2c8cb265ed6bdce13d06723c7dd23ab /share/bash-completion
parent0a32f2f57d9e928b7f657decd81c0658eb416e37 (diff)
enstate: a setting the command doesn't use, as an argument, is an error
--state-dir and --run-dir with --pack, --systemctl but with --apply and --migrate, --unit but with --apply. From a configuration file, which holds them for every command, they are fine. The completion offers each command the settings it uses.
Diffstat (limited to 'share/bash-completion')
-rw-r--r--share/bash-completion/completions/enstate18
1 files changed, 11 insertions, 7 deletions
diff --git a/share/bash-completion/completions/enstate b/share/bash-completion/completions/enstate
index 25a8976..2900ba1 100644
--- a/share/bash-completion/completions/enstate
+++ b/share/bash-completion/completions/enstate
@@ -1,11 +1,14 @@
# bash completion for enstate: a command until one is given, then the options it
-# takes (each once, but --config and --unset), and for PATH a submission (a
-# directory) or a source list (a file).
+# takes and the settings it uses (each once, but --config and --unset), and for
+# PATH a submission (a directory) or a source list (a file).
_enstate() {
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
local commands="--plan --apply --stage --status --materialize --migrate --pack"
- local settings="--config --unset --state-dir --run-dir --schema --unit --print-config"
+ # the settings, and those each command uses
+ local general="--config --unset --print-config"
+ local settings="$general --state-dir --run-dir --schema --unit"
+ local store="$general --state-dir --run-dir --schema"
local i w cmd= path= used=" "
# bash splits --option=VALUE into --option, =, VALUE
if [ "$prev" = = ] && [ "$COMP_CWORD" -ge 2 ]; then
@@ -36,10 +39,11 @@ _enstate() {
local options
case $cmd in
"") options="$commands -h --help $settings" ;;
- plan | apply | stage) options="--json $settings" ;;
- status | materialize) options="--json $settings" ;;
- migrate) options="--json --dry-run $settings" ;;
- pack) options="--out $settings" ;;
+ plan | stage) options="--json $store" ;;
+ apply) options="--json $store --unit" ;;
+ status | materialize) options="--json $store" ;;
+ migrate) options="--json --dry-run $store" ;;
+ pack) options="--out $general --schema" ;;
esac
local o candidates=
for o in $options; do