base16-schemes: unstable-2024-06-21 -> unstable-2024-11-12
[NixPkgs.git] / pkgs / by-name / ni / nixos-container / nixos-container-completion.sh
blob5298b5b12038fa695e435ab3becaa33cec091f15
1 #!/usr/bin/env bash
3 _nixos-container() {
4 local cur prev opts
5 COMPREPLY=()
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" ]]
13 then
14 COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
15 return 0
18 if [[ $(echo "$opts" | grep "$prev") ]]
19 then
20 if [[ "$prev" == "start" || "$prev" == "stop" ]]
21 then
22 COMPREPLY=( $(compgen -W "${startstop_opts}" -- ${cur}) )
23 return 0
24 elif [[ "$prev" == "update" ]]
25 then
26 COMPREPLY=( $(compgen -W "${update_opts}" -- ${cur}) )
27 return 0
32 complete -F _nixos-container nixos-container