| 1 |
#!@BASH@ |
| 2 |
|
| 3 |
# |
| 4 |
# SPDX-License-Identifier: BSD-3-Clause |
| 5 |
# Copyright © 2024-2025 Inria. All rights reserved. |
| 6 |
# See COPYING in top-level directory. |
| 7 |
# |
| 8 |
|
| 9 |
set -e |
| 10 |
|
| 11 |
# the real _filedir() defined in /usr/share/bash-completion/bash_completion seems to fail here, |
| 12 |
# and we won't actually test it anyway, so just redefine it to empty |
| 13 |
_filedir() { |
| 14 |
return |
| 15 |
} |
| 16 |
|
| 17 |
# the real compopt doesn't work outside of actual completion |
| 18 |
compopt() { |
| 19 |
return |
| 20 |
} |
| 21 |
|
| 22 |
# load completions |
| 23 |
HWLOC_top_srcdir="@HWLOC_top_srcdir@" |
| 24 |
source $HWLOC_top_srcdir/contrib/completion/bash/hwloc |
| 25 |
|
| 26 |
COMP_WORDS=( "lstopo" "--o" ) |
| 27 |
COMP_CWORD=${#COMP_WORDS[*]}-1 |
| 28 |
echo "Completing ${COMP_WORDS[*]}<tab>" |
| 29 |
_lstopo |
| 30 |
echo "Got ${COMPREPLY[*]}" |
| 31 |
test "${COMPREPLY[*]}" == "--os-index-prefix --output-format --of --only" |
| 32 |
echo "OK" |
| 33 |
|
| 34 |
COMP_WORDS=( "lstopo" "--palette" "" ) |
| 35 |
COMP_CWORD=${#COMP_WORDS[*]}-1 |
| 36 |
echo "Completing ${COMP_WORDS[*]}<tab>" |
| 37 |
_lstopo |
| 38 |
echo "Got ${COMPREPLY[*]}" |
| 39 |
test "${COMPREPLY[*]}" == "grey greyscale default colors white none" |
| 40 |
echo "OK" |
| 41 |
|
| 42 |
COMP_WORDS=( "lstopo" "--filter" "i" ) |
| 43 |
COMP_CWORD=${#COMP_WORDS[*]}-1 |
| 44 |
echo "Completing ${COMP_WORDS[*]}<tab>" |
| 45 |
_lstopo |
| 46 |
echo "Got ${COMPREPLY[*]}" |
| 47 |
test "${COMPREPLY[*]}" == "icache: io:" |
| 48 |
echo "OK" |
| 49 |
|
| 50 |
# "--filter type:kind" must be split into "--filter" "type" ":" "kind" outside of actual completion |
| 51 |
COMP_WORDS=( "lstopo" "--filter" "io" ":" "" ) |
| 52 |
COMP_CWORD=${#COMP_WORDS[*]}-1 |
| 53 |
echo "Completing ${COMP_WORDS[*]}<tab>" |
| 54 |
_lstopo |
| 55 |
echo "Got ${COMPREPLY[*]}" |
| 56 |
test "${COMPREPLY[*]}" == "none all structure important" |
| 57 |
echo "OK" |
| 58 |
|
| 59 |
# "--foo=bar" must be split into "--foo" "=" "bar" outside of actual completion |
| 60 |
COMP_WORDS=( "lstopo" "--horiz" "=" "M" ) |
| 61 |
COMP_CWORD=${#COMP_WORDS[*]}-1 |
| 62 |
echo "Completing ${COMP_WORDS[*]}<tab>" |
| 63 |
_lstopo |
| 64 |
echo "Got ${COMPREPLY[*]}" |
| 65 |
test "${COMPREPLY[*]}" == "Machine Misc MemCache" |
| 66 |
echo "OK" |
| 67 |
|
| 68 |
COMP_WORDS=( "hwloc-info" "--ancestor" ) |
| 69 |
COMP_CWORD=${#COMP_WORDS[*]}-1 |
| 70 |
echo "Completing ${COMP_WORDS[*]}<tab>" |
| 71 |
_hwloc_info |
| 72 |
echo "Got ${COMPREPLY[*]}" |
| 73 |
test "${COMPREPLY[*]}" == "--ancestors --ancestor" |
| 74 |
echo "OK" |
| 75 |
|
| 76 |
COMP_WORDS=( "hwloc-info" "--ancestor" "P" ) |
| 77 |
COMP_CWORD=${#COMP_WORDS[*]}-1 |
| 78 |
echo "Completing ${COMP_WORDS[*]}<tab>" |
| 79 |
_hwloc_info |
| 80 |
echo "Got ${COMPREPLY[*]}" |
| 81 |
test "${COMPREPLY[*]}" == "Package PCIDev PU" |
| 82 |
echo "OK" |
| 83 |
|
| 84 |
COMP_WORDS=( "hwloc-bind" "--membind" "--get" "--cof" "" ) |
| 85 |
COMP_CWORD=${#COMP_WORDS[*]}-1 |
| 86 |
echo "Completing ${COMP_WORDS[*]}<tab>" |
| 87 |
_hwloc_bind |
| 88 |
echo "Got ${COMPREPLY[*]}" |
| 89 |
test "${COMPREPLY[*]}" == "hwloc list taskset" |
| 90 |
echo "OK" |
| 91 |
|
| 92 |
COMP_WORDS=( "hwloc-calc" "--cpukind" "" ) |
| 93 |
COMP_CWORD=${#COMP_WORDS[*]}-1 |
| 94 |
echo "Completing ${COMP_WORDS[*]}<tab>" |
| 95 |
_hwloc_calc |
| 96 |
echo "Got ${COMPREPLY[*]}" |
| 97 |
test "${COMPREPLY[*]}" == "<name>=<value> <n> " |
| 98 |
echo "OK" |
| 99 |
|
| 100 |
COMP_WORDS=( "hwloc-annotate" "-" ) |
| 101 |
COMP_CWORD=${#COMP_WORDS[*]}-1 |
| 102 |
echo "Completing ${COMP_WORDS[*]}<tab>" |
| 103 |
_hwloc_annotate |
| 104 |
echo "Got ${COMPREPLY[*]}" |
| 105 |
test "${COMPREPLY[*]}" = "--ci --ri --cu --cd --version -h --help" |
| 106 |
echo "OK" |
| 107 |
|
| 108 |
COMP_WORDS=( "hwloc-diff" "--re" ) |
| 109 |
COMP_CWORD=${#COMP_WORDS[*]}-1 |
| 110 |
echo "Completing ${COMP_WORDS[*]}<tab>" |
| 111 |
_hwloc_diff |
| 112 |
echo "Got ${COMPREPLY[*]}" |
| 113 |
test "${COMPREPLY[*]}" = "--refname" |
| 114 |
echo "OK" |
| 115 |
|
| 116 |
COMP_WORDS=( "hwloc-patch" "--" ) |
| 117 |
COMP_CWORD=${#COMP_WORDS[*]}-1 |
| 118 |
echo "Completing ${COMP_WORDS[*]}<tab>" |
| 119 |
_hwloc_patch |
| 120 |
echo "Got ${COMPREPLY[*]}" |
| 121 |
test "${COMPREPLY[*]}" = "--reverse --dry-run --version --help" |
| 122 |
echo "OK" |
| 123 |
|
| 124 |
COMP_WORDS=( "hwloc-compress-dir" "--v" ) |
| 125 |
COMP_CWORD=${#COMP_WORDS[*]}-1 |
| 126 |
echo "Completing ${COMP_WORDS[*]}<tab>" |
| 127 |
_hwloc_compress_dir |
| 128 |
echo "Got ${COMPREPLY[*]}" |
| 129 |
test "${COMPREPLY[*]}" = "--verbose --version" |
| 130 |
echo "OK" |
| 131 |
|
| 132 |
COMP_WORDS=( "hwloc-distrib" "--if" "" ) |
| 133 |
COMP_CWORD=${#COMP_WORDS[*]}-1 |
| 134 |
echo "Completing ${COMP_WORDS[*]}<tab>" |
| 135 |
_hwloc_distrib |
| 136 |
echo "Got ${COMPREPLY[*]}" |
| 137 |
test "${COMPREPLY[*]}" = "xml synthetic fsroot cpuid" |
| 138 |
echo "OK" |
| 139 |
|
| 140 |
COMP_WORDS=( "hwloc-ps" "--children-of-pid" "" ) |
| 141 |
COMP_CWORD=${#COMP_WORDS[*]}-1 |
| 142 |
echo "Completing ${COMP_WORDS[*]}<tab>" |
| 143 |
_hwloc_ps |
| 144 |
echo "Got ${COMPREPLY[*]}" |
| 145 |
test "${COMPREPLY[*]}" = "<pid> " |
| 146 |
echo "OK" |
| 147 |
|
| 148 |
COMP_WORDS=( "hwloc-gather-cpuid" "-c" "" ) |
| 149 |
COMP_CWORD=${#COMP_WORDS[*]}-1 |
| 150 |
echo "Completing ${COMP_WORDS[*]}<tab>" |
| 151 |
_hwloc_gather_cpuid |
| 152 |
echo "Got ${COMPREPLY[*]}" |
| 153 |
test "${COMPREPLY[*]}" = "<index of cpu to operate on> " |
| 154 |
echo "OK" |
| 155 |
|
| 156 |
COMP_WORDS=( "hwloc-gather-topology" "-" ) |
| 157 |
COMP_CWORD=${#COMP_WORDS[*]}-1 |
| 158 |
echo "Completing ${COMP_WORDS[*]}<tab>" |
| 159 |
_hwloc_gather_topology |
| 160 |
echo "Got ${COMPREPLY[*]}" |
| 161 |
test "${COMPREPLY[*]}" = "--io --dmi --dt --no-cpuid --keep --version -h --help" |
| 162 |
echo "OK" |