aurutils: v17.2
[aurutils.git] / completions / command_opts.sh
blob59a06106754db1d8201a15a68e2a496f546a2a92
1 #!/bin/bash
3 have_optdump=('build' 'chroot' 'fetch' 'pkglist' 'repo' 'repo-filter'
4 'srcver' 'sync' 'vercmp' 'view')
5 no_optdump=('graph' 'format' 'repo-parse' 'query' 'depends' 'search')
7 default_opts() {
8 local cmd corecommands=() opts=()
10 for cmd in "${have_optdump[@]}"; do
11 mapfile -t opts < <(bash "../lib/aur-${cmd}" --dump-options | LC_ALL=C sort)
12 corecommands+=("default_cmds[${cmd}]='${opts[*]}'")
13 done
15 for cmd in "${no_optdump[@]}"; do
16 corecommands+=("default_cmds[${cmd}]=''")
17 done
19 printf ' %s\n' "${corecommands[@]}"