Merge pull request #1033 from AladW/view-prefix
[aurutils.git] / completions / command_opts.sh
blob37a5099646a7b66df0b64c29a88f899cfe24e7b4
1 #!/bin/bash
3 have_optdump=('build' 'chroot' 'depends' 'fetch' 'pkglist' 'repo' 'repo-filter'
4 'search' 'srcver' 'sync' 'vercmp' 'view')
5 no_optdump=('graph' 'format' 'repo-parse' 'query')
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[@]}"