From fc9a8601e87699bf3aef510c397c02e19f76bd97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20K=C5=82oczko?= Date: Tue, 4 Aug 2020 07:16:27 +0100 Subject: [PATCH 1/4] Rename bash completion file to hwloc --- contrib/completion/Makefile.am | 2 +- contrib/completion/{hwloc-completion.bash => hwloc} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename contrib/completion/{hwloc-completion.bash => hwloc} (100%) diff --git a/contrib/completion/Makefile.am b/contrib/completion/Makefile.am index 63a5a902b5..d2699a2369 100644 --- a/contrib/completion/Makefile.am +++ b/contrib/completion/Makefile.am @@ -5,4 +5,4 @@ # This makefile is only reached when building in standalone mode bashcompdir = $(sysconfdir)/bash_completion.d -dist_bashcomp_DATA = hwloc-completion.bash +dist_bashcomp_DATA = hwloc diff --git a/contrib/completion/hwloc-completion.bash b/contrib/completion/hwloc similarity index 100% rename from contrib/completion/hwloc-completion.bash rename to contrib/completion/hwloc From c5c654cca606ed4ea250d38ae751ac81f6994c31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20K=C5=82oczko?= Date: Wed, 5 Aug 2020 02:55:41 +0100 Subject: [PATCH 2/4] Reformat to use only tabs --- contrib/completion/hwloc | 857 ++++++++++++++++++++------------------- 1 file changed, 429 insertions(+), 428 deletions(-) diff --git a/contrib/completion/hwloc b/contrib/completion/hwloc index 66b231d84b..9d43d92601 100644 --- a/contrib/completion/hwloc +++ b/contrib/completion/hwloc @@ -11,486 +11,487 @@ _lstopo() { - local INPUT_FORMAT=(xml synthetic fsroot cpuid) - local OUTPUT_FORMAT=(console ascii fig pdf ps png svg xml synthetic) - local TYPES=("Machine" "Misc" "Group" "NUMANode" "MemCache" "Package" "Die" "L1" "L2" "L3" "L4" "L5" "L1i" "L2i" "L3i" "Core" "Bridge" "PCIDev" "OSDev" "PU") - local FILTERKINDS=("none" "all" "structure" "important") - local OPTIONS=(-l --logical - -p --physical - --output-format --of - -f --force - --only - -v --verbose - -s --silent - --distances - -c --cpuset - -C --cpuset-only - --taskset - --filter --ignore - --no-caches - --no-useless-caches - --no-icaches - --merge - --no-collapse - --factorize --factorize= - --no-factorize --no-factorize= - --restrict - --restrict-flags - --no-io - --no-bridges - --whole-io - --input -i - --input-format --if - --no-smt - --thissystem - --pid - --disallowed --whole-system - --allow - --children-order - --fontsize - --gridsize - --linespacing - --horiz --horiz= - --vert --vert= - --rect --rect= - --text --text= - --no-text --no-text= - --index --index= - --no-index --no-index= - --attrs --attrs= - --no-attrs --no-attrs= - --no-legend - --append-legend - --binding-color - --disallowed-color - --top-color - --export-xml-flags - --export-synthetic-flags - --ps --top - --version - -h --help - ) - local cur=${COMP_WORDS[COMP_CWORD]} - local prev=${COMP_WORDS[COMP_CWORD-1]} - - if [[ $COMP_CWORD == 1 || $cur == -* ]] ; then - COMPREPLY=( `compgen -W "${OPTIONS[*]}" -- "$cur"` ) - elif [[ $COMP_CWORD -ge 3 && "${COMP_WORDS[COMP_CWORD-2]}" == "--filter" && "$cur" == ":" ]] ; then - COMPREPLY=( `compgen -W "${FILTERKINDS[*]}"` ) - elif [[ $COMP_CWORD -ge 4 && "${COMP_WORDS[COMP_CWORD-3]}" == "--filter" && "$prev" == ":" ]] ; then - COMPREPLY=( `compgen -W "${FILTERKINDS[*]}" -- "$cur"` ) - elif [[ "$cur" == "=" && " --horiz --vert --rect --text --no-text --index --no-index --attrs --no-attrs --no-factorize " =~ " $prev " ]] ; then - COMPREPLY=( `compgen -W "${TYPES[*]}"` ) - # we could also support ",,..." for --index/attrs/text but "," is not a completion word separator - elif [[ $COMP_CWORD -ge 3 && "$prev" == "=" && " --horiz --vert --rect --text --no-text --index --no-index --attrs --no-attrs --no-factorize --factorize " =~ " ${COMP_WORDS[COMP_CWORD-2]} " ]] ; then - COMPREPLY=( `compgen -W "${TYPES[*]}" -- "$cur"` ) - elif [[ "$cur" == "=" && "--factorize" = "$prev" ]] ; then - COMPREPLY=( `compgen -W "${TYPES[*]}"` "" "" ) - else - case "$prev" in - --of | --output-format) - COMPREPLY=( `compgen -W "${OUTPUT_FORMAT[*]}" -- "$cur"` ) - ;; - --only | --ignore) + local INPUT_FORMAT=(xml synthetic fsroot cpuid) + local OUTPUT_FORMAT=(console ascii fig pdf ps png svg xml synthetic) + local TYPES=("Machine" "Misc" "Group" "NUMANode" "MemCache" "Package" "Die" "L1" "L2" "L3" "L4" "L5" "L1i" "L2i" "L3i" "Core" "Bridge" "PCIDev" "OSDev" "PU") + local FILTERKINDS=("none" "all" "structure" "important") + local OPTIONS=( + -l --logical + -p --physical + --output-format --of + -f --force + --only + -v --verbose + -s --silent + --distances + -c --cpuset + -C --cpuset-only + --taskset + --filter --ignore + --no-caches + --no-useless-caches + --no-icaches + --merge + --no-collapse + --factorize --factorize= + --no-factorize --no-factorize= + --restrict + --restrict-flags + --no-io + --no-bridges + --whole-io + --input -i + --input-format --if + --no-smt + --thissystem + --pid + --disallowed --whole-system + --allow + --children-order + --fontsize + --gridsize + --linespacing + --horiz --horiz= + --vert --vert= + --rect --rect= + --text --text= + --no-text --no-text= + --index --index= + --no-index --no-index= + --attrs --attrs= + --no-attrs --no-attrs= + --no-legend + --append-legend + --binding-color + --disallowed-color + --top-color + --export-xml-flags + --export-synthetic-flags + --ps --top + --version + -h --help + ) + local cur=${COMP_WORDS[COMP_CWORD]} + local prev=${COMP_WORDS[COMP_CWORD-1]} + + if [[ $COMP_CWORD == 1 || $cur == -* ]] ; then + COMPREPLY=( `compgen -W "${OPTIONS[*]}" -- "$cur"` ) + elif [[ $COMP_CWORD -ge 3 && "${COMP_WORDS[COMP_CWORD-2]}" == "--filter" && "$cur" == ":" ]] ; then + COMPREPLY=( `compgen -W "${FILTERKINDS[*]}"` ) + elif [[ $COMP_CWORD -ge 4 && "${COMP_WORDS[COMP_CWORD-3]}" == "--filter" && "$prev" == ":" ]] ; then + COMPREPLY=( `compgen -W "${FILTERKINDS[*]}" -- "$cur"` ) + elif [[ "$cur" == "=" && " --horiz --vert --rect --text --no-text --index --no-index --attrs --no-attrs --no-factorize " =~ " $prev " ]] ; then + COMPREPLY=( `compgen -W "${TYPES[*]}"` ) + # we could also support ",,..." for --index/attrs/text but "," is not a completion word separator + elif [[ $COMP_CWORD -ge 3 && "$prev" == "=" && " --horiz --vert --rect --text --no-text --index --no-index --attrs --no-attrs --no-factorize --factorize " =~ " ${COMP_WORDS[COMP_CWORD-2]} " ]] ; then COMPREPLY=( `compgen -W "${TYPES[*]}" -- "$cur"` ) - ;; - --filter) - COMPREPLY=( `compgen -W "${TYPES[*]/%/:} cache: icache: io:" -- "$cur"` ) && compopt -o nospace - ;; - --restrict) - COMPREPLY=( `compgen -W "binding " -- "$cur"` ) - ;; - -i | --input) - _filedir xml - ;; - --if | --input-format) - COMPREPLY=( `compgen -W "${INPUT_FORMAT[*]}" -- "$cur"` ) - ;; - --pid) - COMPREPLY=( "" "" ) - ;; - --allow) - COMPREPLY=( `compgen -W "all local nodeset=" -- "$cur"` ) - ;; - --restrict-flags | --export-xml-flags | --export-synthetic-flags | --fontsize | --gridsize | --linespacing) - COMPREPLY=( "" "" ) - ;; - --append-legend) - COMPREPLY=( "" "" ) - ;; - --binding-color | --disallowed-color) - COMPREPLY=( `compgen -W "none" -- "$cur"` ) - ;; - --top-color) - COMPREPLY=( `compgen -W "none <#xxyyzz>" -- "$cur"` ) - ;; - --children-order) - COMPREPLY=( `compgen -W "plain memoryabove" -- "$cur"` ) - ;; - esac - fi + elif [[ "$cur" == "=" && "--factorize" = "$prev" ]] ; then + COMPREPLY=( `compgen -W "${TYPES[*]}"` "" "" ) + else + case "$prev" in + --of | --output-format) + COMPREPLY=( `compgen -W "${OUTPUT_FORMAT[*]}" -- "$cur"` ) + ;; + --only | --ignore) + COMPREPLY=( `compgen -W "${TYPES[*]}" -- "$cur"` ) + ;; + --filter) + COMPREPLY=( `compgen -W "${TYPES[*]/%/:} cache: icache: io:" -- "$cur"` ) && compopt -o nospace + ;; + --restrict) + COMPREPLY=( `compgen -W "binding " -- "$cur"` ) + ;; + -i | --input) + _filedir xml + ;; + --if | --input-format) + COMPREPLY=( `compgen -W "${INPUT_FORMAT[*]}" -- "$cur"` ) + ;; + --pid) + COMPREPLY=( "" "" ) + ;; + --allow) + COMPREPLY=( `compgen -W "all local nodeset=" -- "$cur"` ) + ;; + --restrict-flags | --export-xml-flags | --export-synthetic-flags | --fontsize | --gridsize | --linespacing) + COMPREPLY=( "" "" ) + ;; + --append-legend) + COMPREPLY=( "" "" ) + ;; + --binding-color | --disallowed-color) + COMPREPLY=( `compgen -W "none" -- "$cur"` ) + ;; + --top-color) + COMPREPLY=( `compgen -W "none <#xxyyzz>" -- "$cur"` ) + ;; + --children-order) + COMPREPLY=( `compgen -W "plain memoryabove" -- "$cur"` ) + ;; + esac + fi } complete -F _lstopo lstopo complete -F _lstopo lstopo-no-graphics complete -F _lstopo hwloc-ls - _hwloc_info(){ - local TYPES=("Machine" "Misc" "Group" "NUMANode" "MemCache" "Package" "Die" "L1" "L2" "L3" "L4" "L5" "L1i" "L2i" "L3i" "Core" "Bridge" "PCIDev" "OSDev" "PU") - local FILTERKINDS=("none" "all" "structure" "important") - local OPTIONS=(--objects - --topology - --support - -v --verbose - -s --silent - --ancestors - --ancestor - --children - --descendants - -n - --restrict - --filter - --no-icaches - --no-io - --no-bridges - --whole-io - --input -i - --input-format --if - --thissystem - --pid - --disallowed --whole-system - -l --logical - -p --physical - --version - -h --help - ) - local cur=${COMP_WORDS[COMP_CWORD]} - local prev=${COMP_WORDS[COMP_CWORD-1]} - - if [[ $COMP_CWORD == 1 || $cur == -* ]] ; then - COMPREPLY=( `compgen -W "${OPTIONS[*]}" -- "$cur"` ) - elif [[ $COMP_CWORD -ge 3 && "${COMP_WORDS[COMP_CWORD-2]}" == "--filter" && "$cur" == ":" ]] ; then - COMPREPLY=( `compgen -W "${FILTERKINDS[*]}"` ) - elif [[ $COMP_CWORD -ge 4 && "${COMP_WORDS[COMP_CWORD-3]}" == "--filter" && "$prev" == ":" ]] ; then - COMPREPLY=( `compgen -W "${FILTERKINDS[*]}" -- "$cur"` ) - else - case "$prev" in - --restrict) - COMPREPLY=( `compgen -W "binding " -- "$cur"` ) - ;; - -i | --input) - _filedir xml - ;; - --if | --input-format) - COMPREPLY=( `compgen -W "${INPUT_FORMAT[*]}" -- "$cur"` ) - ;; - --pid) - COMPREPLY=( "" "" ) - ;; - --filter) - COMPREPLY=( `compgen -W "${TYPES[*]/%/:} cache: icache: io:" -- "$cur"` ) && compopt -o nospace - ;; - --ancestor | --descendants) - COMPREPLY=( `compgen -W "${TYPES[*]}" -- "$cur"` ) - ;; - esac - fi + local TYPES=("Machine" "Misc" "Group" "NUMANode" "MemCache" "Package" "Die" "L1" "L2" "L3" "L4" "L5" "L1i" "L2i" "L3i" "Core" "Bridge" "PCIDev" "OSDev" "PU") + local FILTERKINDS=("none" "all" "structure" "important") + local OPTIONS=( + --objects + --topology + --support + -v --verbose + -s --silent + --ancestors + --ancestor + --children + --descendants + -n + --restrict + --filter + --no-icaches + --no-io + --no-bridges + --whole-io + --input -i + --input-format --if + --thissystem + --pid + --disallowed --whole-system + -l --logical + -p --physical + --version + -h --help + ) + local cur=${COMP_WORDS[COMP_CWORD]} + local prev=${COMP_WORDS[COMP_CWORD-1]} + + if [[ $COMP_CWORD == 1 || $cur == -* ]] ; then + COMPREPLY=( `compgen -W "${OPTIONS[*]}" -- "$cur"` ) + elif [[ $COMP_CWORD -ge 3 && "${COMP_WORDS[COMP_CWORD-2]}" == "--filter" && "$cur" == ":" ]] ; then + COMPREPLY=( `compgen -W "${FILTERKINDS[*]}"` ) + elif [[ $COMP_CWORD -ge 4 && "${COMP_WORDS[COMP_CWORD-3]}" == "--filter" && "$prev" == ":" ]] ; then + COMPREPLY=( `compgen -W "${FILTERKINDS[*]}" -- "$cur"` ) + else + case "$prev" in + --restrict) + COMPREPLY=( `compgen -W "binding " -- "$cur"` ) + ;; + -i | --input) + _filedir xml + ;; + --if | --input-format) + COMPREPLY=( `compgen -W "${INPUT_FORMAT[*]}" -- "$cur"` ) + ;; + --pid) + COMPREPLY=( "" "" ) + ;; + --filter) + COMPREPLY=( `compgen -W "${TYPES[*]/%/:} cache: icache: io:" -- "$cur"` ) && compopt -o nospace + ;; + --ancestor | --descendants) + COMPREPLY=( `compgen -W "${TYPES[*]}" -- "$cur"` ) + ;; + esac + fi } complete -F _hwloc_info hwloc-info - _hwloc_bind(){ - local OPTIONS=(--cpubind - --membind - --mempolicy - --logical -l - --physical -p - --single - --strict - --get - -e --get-last-cpu-location - --nodeset - --pid - --tid - --taskset - --restrict - --disallowed --whole-system - --hbm - --no-hbm - --no-smt --no-smt=N - -f --force - -q --quiet - -v --verbose - --version - -h --help - ) - local cur=${COMP_WORDS[COMP_CWORD]} - local prev=${COMP_WORDS[COMP_CWORD-1]} - - if [[ $COMP_CWORD == 1 || $cur == -* ]] ; then - COMPREPLY=( `compgen -W "${OPTIONS[*]}" -- "$cur"` ) - else - case "$prev" in - --mempolicy) - COMPREPLY=( `compgen -W "default firsttouch bind interleave nexttouch" -- "$cur"` ) - ;; - --pid) - COMPREPLY=( "" "" ) - ;; - --tid) - COMPREPLY=( "" "" ) - ;; - --restrict) - COMPREPLY=( "" "" ) - ;; - esac - fi + local OPTIONS=(--cpubind + --membind + --mempolicy + --logical -l + --physical -p + --single + --strict + --get + -e --get-last-cpu-location + --nodeset + --pid + --tid + --taskset + --restrict + --disallowed --whole-system + --hbm + --no-hbm + --no-smt --no-smt=N + -f --force + -q --quiet + -v --verbose + --version + -h --help + ) + local cur=${COMP_WORDS[COMP_CWORD]} + local prev=${COMP_WORDS[COMP_CWORD-1]} + + if [[ $COMP_CWORD == 1 || $cur == -* ]] ; then + COMPREPLY=( `compgen -W "${OPTIONS[*]}" -- "$cur"` ) + else + case "$prev" in + --mempolicy) + COMPREPLY=( `compgen -W "default firsttouch bind interleave nexttouch" -- "$cur"` ) + ;; + --pid) + COMPREPLY=( "" "" ) + ;; + --tid) + COMPREPLY=( "" "" ) + ;; + --restrict) + COMPREPLY=( "" "" ) + ;; + esac + fi } complete -F _hwloc_bind hwloc-bind - _hwloc_calc(){ - local TYPES=("Machine" "Misc" "Group" "NUMANode" "MemCache" "Package" "Die" "L1" "L2" "L3" "L4" "L5" "L1i" "L2i" "L3i" "Core" "Bridge" "PCIDev" "OSDev" "PU") - local OPTIONS=(-N --number-of - -I --intersect - -H --hierarchical - --largest - -l --logical - -p --physical - --li --logical-input - --lo --logical-output - --pi --physical-input - --po --physical-output - -n --nodeset - --ni --nodeset-input - --no --nodeset-output - --sep - --taskset - --single - --restrict - --disallowed --whole-system - --input -i - --input-format --if - --no-smt --no-smt=N - -q --quiet - -v --verbose - --version - -h --help - ) - local cur=${COMP_WORDS[COMP_CWORD]} - local prev=${COMP_WORDS[COMP_CWORD-1]} - - if [[ $COMP_CWORD == 1 || $cur == -* ]] ; then - COMPREPLY=( `compgen -W "${OPTIONS[*]}" -- "$cur"` ) - else - case "$prev" in - -N | --number-of | -I | --intersect) - COMPREPLY=( `compgen -W "${TYPES[*]}" -- "$cur"` ) - ;; - -H | --hierarchical) - COMPREPLY=( "...." "" ) - ;; - --sep) - COMPREPLY=( "" "" ) - ;; - -i | --input) - _filedir xml - ;; - --if | --input-format) - COMPREPLY=( `compgen -W "${INPUT_FORMAT[*]}" -- "$cur"` ) - ;; - --restrict) - COMPREPLY=( "" "" ) - ;; - esac - fi + local TYPES=("Machine" "Misc" "Group" "NUMANode" "MemCache" "Package" "Die" "L1" "L2" "L3" "L4" "L5" "L1i" "L2i" "L3i" "Core" "Bridge" "PCIDev" "OSDev" "PU") + local OPTIONS=( + -N --number-of + -I --intersect + -H --hierarchical + --largest + -l --logical + -p --physical + --li --logical-input + --lo --logical-output + --pi --physical-input + --po --physical-output + -n --nodeset + --ni --nodeset-input + --no --nodeset-output + --sep + --taskset + --single + --restrict + --disallowed --whole-system + --input -i + --input-format --if + --no-smt --no-smt=N + -q --quiet + -v --verbose + --version + -h --help + ) + local cur=${COMP_WORDS[COMP_CWORD]} + local prev=${COMP_WORDS[COMP_CWORD-1]} + + if [[ $COMP_CWORD == 1 || $cur == -* ]] ; then + COMPREPLY=( `compgen -W "${OPTIONS[*]}" -- "$cur"` ) + else + case "$prev" in + -N | --number-of | -I | --intersect) + COMPREPLY=( `compgen -W "${TYPES[*]}" -- "$cur"` ) + ;; + -H | --hierarchical) + COMPREPLY=( "...." "" ) + ;; + --sep) + COMPREPLY=( "" "" ) + ;; + -i | --input) + _filedir xml + ;; + --if | --input-format) + COMPREPLY=( `compgen -W "${INPUT_FORMAT[*]}" -- "$cur"` ) + ;; + --restrict) + COMPREPLY=( "" "" ) + ;; + esac + fi } complete -F _hwloc_calc hwloc-calc _hwloc_annotate(){ - local OPTIONS=(--ci --ri --cu --cd -h --help) - local cur=${COMP_WORDS[COMP_CWORD]} + local OPTIONS=(--ci --ri --cu --cd -h --help) + local cur=${COMP_WORDS[COMP_CWORD]} - if [[ $COMP_CWORD == 1 || $cur == -* ]] ; then - COMPREPLY=( `compgen -W "${OPTIONS[*]}" -- "$cur"`) - fi - _filedir xml + if [[ $COMP_CWORD == 1 || $cur == -* ]] ; then + COMPREPLY=( `compgen -W "${OPTIONS[*]}" -- "$cur"`) + fi + _filedir xml } complete -F _hwloc_annotate hwloc-annotate _hwloc_diff(){ - local OPTIONS=(--refname - --version - -h --help - ) - local cur=${COMP_WORDS[COMP_CWORD]} - local prev=${COMP_WORDS[COMP_CWORD-1]} - - if [[ $COMP_CWORD == 1 || $cur == -* ]] ; then - COMPREPLY=( `compgen -W "${OPTIONS[*]}" -- "$cur"` ) - else - case "$prev" in - --refname) - COMPREPLY=( "" "") - ;; - esac - fi - _filedir xml + local OPTIONS=(--refname + --version + -h --help + ) + local cur=${COMP_WORDS[COMP_CWORD]} + local prev=${COMP_WORDS[COMP_CWORD-1]} + + if [[ $COMP_CWORD == 1 || $cur == -* ]] ; then + COMPREPLY=( `compgen -W "${OPTIONS[*]}" -- "$cur"` ) + else + case "$prev" in + --refname) + COMPREPLY=( "" "") + ;; + esac + fi + _filedir xml } complete -F _hwloc_diff hwloc-diff - _hwloc_patch(){ - local OPTIONS=(--R --reverse - --version - -h --help - ) - local cur=${COMP_WORDS[COMP_CWORD]} - - if [[ $COMP_CWORD == 1 || $cur == -* ]] ; then - COMPREPLY=( `compgen -W "${OPTIONS[*]}" -- "$cur"` ) - fi - _filedir xml + local OPTIONS=(--R --reverse + --version + -h --help + ) + local cur=${COMP_WORDS[COMP_CWORD]} + + if [[ $COMP_CWORD == 1 || $cur == -* ]] ; then + COMPREPLY=( `compgen -W "${OPTIONS[*]}" -- "$cur"` ) + fi + _filedir xml } complete -F _hwloc_patch hwloc-patch _hwloc_compress_dir(){ - local OPTIONS=(-R --reverse - -v --verbose - -h --help - ) - local cur=${COMP_WORDS[COMP_CWORD]} - - if [[ $COMP_CWORD == 1 || $cur == -* ]] ; then - COMPREPLY=( `compgen -W "${OPTIONS[*]}" -- "$cur"` ) - fi - _filedir -d + local OPTIONS=(-R --reverse + -v --verbose + -h --help + ) + local cur=${COMP_WORDS[COMP_CWORD]} + + if [[ $COMP_CWORD == 1 || $cur == -* ]] ; then + COMPREPLY=( `compgen -W "${OPTIONS[*]}" -- "$cur"` ) + fi + _filedir -d } complete -F _hwloc_compress_dir hwloc-compress-dir - _hwloc_distrib(){ - local TYPES=("Machine" "Misc" "Group" "NUMANode" "MemCache" "Package" "Die" "L1" "L2" "L3" "L4" "L5" "L1i" "L2i" "L3i" "Core" "Bridge" "PCIDev" "OSDev" "PU") - local OPTIONS=(--ignore - --from - --to - --at - --reverse - --restrict - --disallowed --whole-system - --input -i - --input-format --if - --single - --taskset - -v --verbose - --version - -h --help - ) - local cur=${COMP_WORDS[COMP_CWORD]} - local prev=${COMP_WORDS[COMP_CWORD-1]} - - if [[ $COMP_CWORD == 1 || $cur == -* ]] ; then - COMPREPLY=( `compgen -W "${OPTIONS[*]}" -- "$cur"` ) - else - case "$prev" in - --ignore | --from | --to | --at) - COMPREPLY=( `compgen -W "${TYPES[*]}" -- "$cur"` ) - ;; - -i | --input) - _filedir xml - ;; - --if | --input-format) - COMPREPLY=( `compgen -W "${INPUT_FORMAT[*]}" -- "$cur"` ) - ;; - --restrict) - COMPREPLY=( "" "" ) - ;; - esac - fi + local TYPES=("Machine" "Misc" "Group" "NUMANode" "MemCache" "Package" "Die" "L1" "L2" "L3" "L4" "L5" "L1i" "L2i" "L3i" "Core" "Bridge" "PCIDev" "OSDev" "PU") + local OPTIONS=( + --ignore + --from + --to + --at + --reverse + --restrict + --disallowed --whole-system + --input -i + --input-format --if + --single + --taskset + -v --verbose + --version + -h --help + ) + local cur=${COMP_WORDS[COMP_CWORD]} + local prev=${COMP_WORDS[COMP_CWORD-1]} + + if [[ $COMP_CWORD == 1 || $cur == -* ]] ; then + COMPREPLY=( `compgen -W "${OPTIONS[*]}" -- "$cur"` ) + else + case "$prev" in + --ignore | --from | --to | --at) + COMPREPLY=( `compgen -W "${TYPES[*]}" -- "$cur"` ) + ;; + -i | --input) + _filedir xml + ;; + --if | --input-format) + COMPREPLY=( `compgen -W "${INPUT_FORMAT[*]}" -- "$cur"` ) + ;; + --restrict) + COMPREPLY=( "" "" ) + ;; + esac + fi } complete -F _hwloc_distrib hwloc-distrib _hwloc_ps(){ - local OPTIONS=(-a - --pid - --name - -l --logical - -p --physical - -c --cpuset - -t --threads - -e --get-last-cpu-location - --pid-cmd - --uid - --disallowed --whole-system - --json-server - --json-port - -v --verbose - -h --help - ) - local cur=${COMP_WORDS[COMP_CWORD]} - local prev=${COMP_WORDS[COMP_CWORD-1]} - - if [[ $COMP_CWORD == 1 || $cur == -* ]] ; then - COMPREPLY=( `compgen -W "${OPTIONS[*]}" -- "$cur"` ) - else - case "$prev" in - --name) - COMPREPLY=( "" "" ) - ;; - --uid) - COMPREPLY=( "" "all" "" ) - ;; - --pid) - COMPREPLY=( "" "" ) - ;; - --pid-cmd) - _filedir - ;; - --json-port) - COMPREPLY=( "" "" ) - ;; - esac - fi + local OPTIONS=( + -a + --pid + --name + -l --logical + -p --physical + -c --cpuset + -t --threads + -e --get-last-cpu-location + --pid-cmd + --uid + --disallowed --whole-system + --json-server + --json-port + -v --verbose + -h --help + ) + local cur=${COMP_WORDS[COMP_CWORD]} + local prev=${COMP_WORDS[COMP_CWORD-1]} + + if [[ $COMP_CWORD == 1 || $cur == -* ]] ; then + COMPREPLY=( `compgen -W "${OPTIONS[*]}" -- "$cur"` ) + else + case "$prev" in + --name) + COMPREPLY=( "" "" ) + ;; + --uid) + COMPREPLY=( "" "all" "" ) + ;; + --pid) + COMPREPLY=( "" "" ) + ;; + --pid-cmd) + _filedir + ;; + --json-port) + COMPREPLY=( "" "" ) + ;; + esac + fi } complete -F _hwloc_ps hwloc-ps - _hwloc_gather_cpuid(){ - local OPTIONS=(-c - -s --silent - -h --help - ) - local cur=${COMP_WORDS[COMP_CWORD]} - local prev=${COMP_WORDS[COMP_CWORD-1]} - - if [[ $COMP_CWORD == 1 || $cur == -* ]] ; then - COMPREPLY=( `compgen -W "${OPTIONS[*]}" -- "$cur"` ) - else - case "$prev" in - -c) - COMPREPLY=( "" "" ) - ;; - esac - fi + local OPTIONS=( + -c + -s --silent + -h --help + ) + local cur=${COMP_WORDS[COMP_CWORD]} + local prev=${COMP_WORDS[COMP_CWORD-1]} + + if [[ $COMP_CWORD == 1 || $cur == -* ]] ; then + COMPREPLY=( `compgen -W "${OPTIONS[*]}" -- "$cur"` ) + else + case "$prev" in + -c) + COMPREPLY=( "" "" ) + ;; + esac + fi } complete -F _hwloc_gather_cpuid hwloc-gather-cpuid _hwloc_gather_topology(){ - local OPTIONS=(--io - --dmi - --no-cpuid - --keep - -h --help - ) - local cur=${COMP_WORDS[COMP_CWORD]} - - if [[ $COMP_CWORD == 1 || $cur == -* ]] ; then - COMPREPLY=( `compgen -W "${OPTIONS[*]}" -- "$cur"` ) - fi + local OPTIONS=( + --io + --dmi + --no-cpuid + --keep + -h --help + ) + local cur=${COMP_WORDS[COMP_CWORD]} + + if [[ $COMP_CWORD == 1 || $cur == -* ]] ; then + COMPREPLY=( `compgen -W "${OPTIONS[*]}" -- "$cur"` ) + fi } complete -F _hwloc_gather_topology hwloc-gather-topology From a230fa2c81831f9a4dc78d09345dbeb8f32dcb6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20K=C5=82oczko?= Date: Wed, 5 Aug 2020 02:56:22 +0100 Subject: [PATCH 3/4] Sort OPTIONS --- contrib/completion/hwloc | 236 ++++++++++++++++++++------------------- 1 file changed, 122 insertions(+), 114 deletions(-) diff --git a/contrib/completion/hwloc b/contrib/completion/hwloc index 9d43d92601..5010c99081 100644 --- a/contrib/completion/hwloc +++ b/contrib/completion/hwloc @@ -16,60 +16,60 @@ _lstopo() { local TYPES=("Machine" "Misc" "Group" "NUMANode" "MemCache" "Package" "Die" "L1" "L2" "L3" "L4" "L5" "L1i" "L2i" "L3i" "Core" "Bridge" "PCIDev" "OSDev" "PU") local FILTERKINDS=("none" "all" "structure" "important") local OPTIONS=( - -l --logical - -p --physical - --output-format --of - -f --force - --only - -v --verbose - -s --silent - --distances + --allow + --append-legend + --attrs --attrs= + --binding-color -c --cpuset -C --cpuset-only - --taskset + --children-order + --disallowed-color + --disallowed --whole-system + --distances + --export-synthetic-flags + --export-xml-flags + --factorize --factorize= + -f --force --filter --ignore - --no-caches - --no-useless-caches - --no-icaches + --fontsize + --gridsize + -h --help + --horiz --horiz= + --index --index= + --input-format --if + --input -i + --linespacing + -l --logical --merge + --no-attrs --no-attrs= + --no-bridges + --no-caches --no-collapse - --factorize --factorize= --no-factorize --no-factorize= - --restrict - --restrict-flags + --no-icaches + --no-index --no-index= --no-io - --no-bridges - --whole-io - --input -i - --input-format --if + --no-legend --no-smt - --thissystem + --no-text --no-text= + --no-useless-caches + --only + --output-format --of --pid - --disallowed --whole-system - --allow - --children-order - --fontsize - --gridsize - --linespacing - --horiz --horiz= - --vert --vert= + -p --physical + --ps --top --rect --rect= + --restrict + --restrict-flags + -s --silent + --taskset --text --text= - --no-text --no-text= - --index --index= - --no-index --no-index= - --attrs --attrs= - --no-attrs --no-attrs= - --no-legend - --append-legend - --binding-color - --disallowed-color + --thissystem --top-color - --export-xml-flags - --export-synthetic-flags - --ps --top --version - -h --help + --vert --vert= + -v --verbose + --whole-io ) local cur=${COMP_WORDS[COMP_CWORD]} local prev=${COMP_WORDS[COMP_CWORD-1]} @@ -139,31 +139,31 @@ _hwloc_info(){ local TYPES=("Machine" "Misc" "Group" "NUMANode" "MemCache" "Package" "Die" "L1" "L2" "L3" "L4" "L5" "L1i" "L2i" "L3i" "Core" "Bridge" "PCIDev" "OSDev" "PU") local FILTERKINDS=("none" "all" "structure" "important") local OPTIONS=( - --objects - --topology - --support - -v --verbose - -s --silent - --ancestors --ancestor + --ancestors --children --descendants - -n - --restrict + --disallowed --whole-system --filter + -h --help + --input-format --if + --input -i + -l --logical + -n + --no-bridges --no-icaches --no-io - --no-bridges - --whole-io - --input -i - --input-format --if - --thissystem + --objects --pid - --disallowed --whole-system - -l --logical -p --physical + --restrict + -s --silent + --support + --thissystem + --topology --version - -h --help + -v --verbose + --whole-io ) local cur=${COMP_WORDS[COMP_CWORD]} local prev=${COMP_WORDS[COMP_CWORD-1]} @@ -201,28 +201,28 @@ complete -F _hwloc_info hwloc-info _hwloc_bind(){ local OPTIONS=(--cpubind + --disallowed --whole-system + -e --get-last-cpu-location + -f --force + --get + --hbm + -h --help + --logical -l --membind --mempolicy - --logical -l - --physical -p - --single - --strict - --get - -e --get-last-cpu-location --nodeset - --pid - --tid - --taskset - --restrict - --disallowed --whole-system - --hbm --no-hbm --no-smt --no-smt=N - -f --force + --physical -p + --pid -q --quiet - -v --verbose + --restrict + --single + --strict + --taskset + --tid --version - -h --help + -v --verbose ) local cur=${COMP_WORDS[COMP_CWORD]} local prev=${COMP_WORDS[COMP_CWORD-1]} @@ -251,31 +251,31 @@ complete -F _hwloc_bind hwloc-bind _hwloc_calc(){ local TYPES=("Machine" "Misc" "Group" "NUMANode" "MemCache" "Package" "Die" "L1" "L2" "L3" "L4" "L5" "L1i" "L2i" "L3i" "Core" "Bridge" "PCIDev" "OSDev" "PU") local OPTIONS=( - -N --number-of - -I --intersect + --disallowed --whole-system + -h --help -H --hierarchical + -I --intersect + --input-format --if + --input -i --largest - -l --logical - -p --physical --li --logical-input + -l --logical --lo --logical-output - --pi --physical-input - --po --physical-output - -n --nodeset --ni --nodeset-input + -n --nodeset + -N --number-of --no --nodeset-output - --sep - --taskset - --single - --restrict - --disallowed --whole-system - --input -i - --input-format --if --no-smt --no-smt=N + --pi --physical-input + --po --physical-output + -p --physical -q --quiet - -v --verbose + --restrict + --sep + --single + --taskset --version - -h --help + -v --verbose ) local cur=${COMP_WORDS[COMP_CWORD]} local prev=${COMP_WORDS[COMP_CWORD-1]} @@ -309,7 +309,13 @@ complete -F _hwloc_calc hwloc-calc _hwloc_annotate(){ - local OPTIONS=(--ci --ri --cu --cd -h --help) + local OPTIONS=( + --cd + --ci + --cu + -h --help + --ri + ) local cur=${COMP_WORDS[COMP_CWORD]} if [[ $COMP_CWORD == 1 || $cur == -* ]] ; then @@ -321,9 +327,10 @@ complete -F _hwloc_annotate hwloc-annotate _hwloc_diff(){ - local OPTIONS=(--refname - --version + local OPTIONS=( -h --help + --refname + --version ) local cur=${COMP_WORDS[COMP_CWORD]} local prev=${COMP_WORDS[COMP_CWORD-1]} @@ -342,9 +349,10 @@ _hwloc_diff(){ complete -F _hwloc_diff hwloc-diff _hwloc_patch(){ - local OPTIONS=(--R --reverse - --version + local OPTIONS=( -h --help + --R --reverse + --version ) local cur=${COMP_WORDS[COMP_CWORD]} @@ -373,20 +381,20 @@ complete -F _hwloc_compress_dir hwloc-compress-dir _hwloc_distrib(){ local TYPES=("Machine" "Misc" "Group" "NUMANode" "MemCache" "Package" "Die" "L1" "L2" "L3" "L4" "L5" "L1i" "L2i" "L3i" "Core" "Bridge" "PCIDev" "OSDev" "PU") local OPTIONS=( - --ignore - --from - --to --at - --reverse - --restrict --disallowed --whole-system - --input -i + --from + -h --help + --ignore --input-format --if + --input -i + --restrict + --reverse --single --taskset - -v --verbose + --to --version - -h --help + -v --verbose ) local cur=${COMP_WORDS[COMP_CWORD]} local prev=${COMP_WORDS[COMP_CWORD-1]} @@ -416,20 +424,20 @@ complete -F _hwloc_distrib hwloc-distrib _hwloc_ps(){ local OPTIONS=( -a - --pid - --name - -l --logical - -p --physical -c --cpuset - -t --threads + --disallowed --whole-system -e --get-last-cpu-location + -h --help + --json-port + --json-server + -l --logical + --name + --pid --pid-cmd + -p --physical + -t --threads --uid - --disallowed --whole-system - --json-server - --json-port -v --verbose - -h --help ) local cur=${COMP_WORDS[COMP_CWORD]} local prev=${COMP_WORDS[COMP_CWORD-1]} @@ -461,8 +469,8 @@ complete -F _hwloc_ps hwloc-ps _hwloc_gather_cpuid(){ local OPTIONS=( -c - -s --silent -h --help + -s --silent ) local cur=${COMP_WORDS[COMP_CWORD]} local prev=${COMP_WORDS[COMP_CWORD-1]} @@ -482,11 +490,11 @@ complete -F _hwloc_gather_cpuid hwloc-gather-cpuid _hwloc_gather_topology(){ local OPTIONS=( - --io --dmi - --no-cpuid - --keep -h --help + --io + --keep + --no-cpuid ) local cur=${COMP_WORDS[COMP_CWORD]} From bd01fd328f88da82b0547a21780f8009753452b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20K=C5=82oczko?= Date: Wed, 5 Aug 2020 03:03:21 +0100 Subject: [PATCH 4/4] Move hwloc bash completion file to $(datadir)/bash-completion/completions --- contrib/completion/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/completion/Makefile.am b/contrib/completion/Makefile.am index d2699a2369..ae02ca85c4 100644 --- a/contrib/completion/Makefile.am +++ b/contrib/completion/Makefile.am @@ -4,5 +4,5 @@ # This makefile is only reached when building in standalone mode -bashcompdir = $(sysconfdir)/bash_completion.d +bashcompdir = $(datadir)/bash-completion/completions dist_bashcomp_DATA = hwloc