6 cur
="${COMP_WORDS[COMP_CWORD]}"
7 prev
="${COMP_WORDS[COMP_CWORD-1]}"
8 opts
="list create destroy restart start stop status update login root-login run show-ip show-host-key"
9 startstop_opts
=$
(nixos-container list
)
10 update_opts
="--config"
12 if [[ "$prev" == "nixos-container" ]]
14 COMPREPLY
=( $
(compgen
-W "${opts}" -- ${cur}) )
18 if [[ $
(echo "$opts" |
grep "$prev") ]]
20 if [[ "$prev" == "start" ||
"$prev" == "stop" ]]
22 COMPREPLY
=( $
(compgen
-W "${startstop_opts}" -- ${cur}) )
24 elif [[ "$prev" == "update" ]]
26 COMPREPLY
=( $
(compgen
-W "${update_opts}" -- ${cur}) )
32 complete
-F _nixos-container nixos-container