Update bash_completion (partially)
[minetest_update_translations.git] / bash-completion / completions / i18n
blob03dfd2d8b04058031670b4b68191e48f4b0841b2
1 #/usr/bin/env bash
2 _i18n_completions()
4         local cur OPTS_ALL
5         local hasInstalledModOpt hasRecursiveOpt hasVerboseOpt hasNoOldFileOpt
6         COMPREPLY=()
7         cur="${COMP_WORDS[COMP_CWORD]}"
8         for opt in "${COMP_WORDS[@]}"
9         do
10                 case $opt in
11                         '-h'|'--help')
12                                 return 0
13                                 ;;
14                         '-m'|'--installed-mods')
15                                 hasInstalledModOpt=1
16                                 ;;
17                         '-r'|'--recursive')
18                                 hasRecursiveOpt=1
19                                 ;;
20                         '-v'|'--verbose')
21                                 hasVerboseOpt=1
22                                 ;;
23                         '-O'|'--no-old-file')
24                                 hasNoOldFileOpt=1
25                                 ;;
27                 esac
28         done
29         case $cur in
30                 -*)
31                         if [ $hasRecursiveOpt ] || [ $hasInstalledModOpt ]
32                         then
33                                 if [ $hasVerboseOpt ] && [ $hasNoOldFileOpt ]
34                                 then
35                                         return 0
36                                 elif [ $hasNoOldFileOpt ]
37                                 then
38                                         OPTS_ALL="--verbose"
39                                 elif [ $hasVerboseOpt ]
40                                 then
41                                         OPTS_ALL="--no-old-file"
42                                 else
43                                         OPTS_ALL="--verbose
44                                                 --no-old-file"
45                                 fi
46                         else
47                                 if [ $hasVerboseOpt ] && [ $hasNoOldFileOpt ]
48                                 then
49                                         OPTS_ALL="--installed-mods
50                                         --recursive"
51                                 elif [ $hasNoOldFileOpt ]
52                                 then
53                                         OPTS_ALL="--help
54                                                 --verbose
55                                                 --installed-mods
56                                                 --recursive"
57                                 elif [ $hasVerboseOpt ]
58                                 then
59                                         OPTS_ALL="--help
60                                                 --installed-mods
61                                                 --no-old-file
62                                                 --recursive"
63                                 else
64                                         OPTS_ALL="--help
65                                                 --verbose
66                                                 --installed-mods
67                                                 --no-old-file
68                                                 --recursive"
69                                 fi
70                         fi
71                         COMPREPLY=( $(compgen -W "${OPTS_ALL[*]}" -- $cur) )
72                         return 0
73                         ;;
74         esac
75         COMPREPLY=( $(compgen -f -- $cur) )
76         return 0
78 complete -F _i18n_completions i18n.py