/usr/share/bash-completion/completions/ldc2 is in ldc 1:1.8.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | # bash completion for ldc2
function elementExists(){
local i isRunning result
i=0
isRunning=1
result=0
#~ for i in ${opts_with_equal[@]}; do
while [ "$isRunning" -eq 1 ]; do
if [ "$i" -ge "${#opts_with_equal[@]}" ]; then
isRunning=0
elif [ "${opts_with_equal[$i]}" == "$1" ]; then
result=1
isRunning=0
fi
((i++))
done
echo $result
}
function _ldc(){
local prev cur opts opts_with_equal isEqualOptions
opts="\
-D -Df -H \
-Hd -Hf -I -J \
-L -X -Xf -annotate \
-asm-verbose -c -check-printf-calls -code-model \
-d -d-debug -d-version -debuglib \
-defaultlib -deps -enable-asserts -enable-boundscheck \
-disable-d-passes -disable-excess-fp-precision -disable-fp-elim -disable-gc \
-disable-non-leaf-fp-elim -enable-preconditions -disable-red-zone -disable-simplify-drtcalls \
-disable-spill-fusing -enable-contracts -enable-correct-eh-support -enable-fp-mad \
-enable-inlining -enable-invariants -enable-load-pre -enable-no-infs-fp-math \
-enable-no-nans-fp-math -enable-objc-arc-opts -enable-postconditions -enable-tbaa \
-enable-unsafe-fp-math -fatal-assembler-warnings -fdata-sections -ffunction-sections \
-float-abi -help -ignore -internalize-public-api-file \
-internalize-public-api-list -jit-emit-debug -jit-enable-eh -join-liveintervals \
-lib -limit-float-precision -linkonce-templates -m32 \
-m64 -march -mattr -mc-x86-disable-arith-relaxation\
-mcpu -mtriple -nested-ctx -noasm \
-nodefaultlib -noruntime -noverify -nozero-initialized-in-bss \
-O -O0 -O1 -O2 \
-O3 -O4 -O5 -o- \
-od -of -op -oq \
-output-bc -output-ll -output-o -output-s \
-pre-RA-sched -print-after-all -print-before-all -print-machineinstrs \
-profile-estimator-loop-weight -profile-info-file -profile-verifier-noassert -realign-stack \
-regalloc -release -relocation-model -rewriter \
-run -schedule-spills -segmented-stacks -shared \
-shrink-wrap -singleobj -soft-float -spiller \
-stack-alignment -stack-protector-buffer-size -stats -tailcallopt \
-time-passes -unittest -v -v-cg \
-verify-dom-info -verify-loop-info -verify-regalloc -verify-region-info \
-version -vv -w -x86-asm-syntax \
-x86-use-vzeroupper
"
opts_with_equal=(-Df Hd -Hf -I -J -Xf -code-model -d-version -debuglib -defaultlib -deps \
-internalize-public-api-file -float-abi -limit-float-precision -march -mtriple -mattr \
-mcpu -mtriple -nested-ctx -od -pre-RA-sched -regalloc relocation-model -rewriter \
-run -spiller -spiller )
COMPREPLY=()
_get_comp_words_by_ref -n : cur prev
case ${cur} in
#~ -*=*[0-9])
#~ prev="${cur%%=*}="
#~ cur=${cur#*=} # add an =<uint>
#~ COMPREPLY=( ${prev}$(compgen -W "0 1 2 3 4 5 6 7 8 9" -- "${cur}") )
#~ return 0
#~ ;;
'-code-model='*)
prev="${cur%%=*}="
cur=${cur#*=}
COMPREPLY=( ${prev}$(compgen -W "default small kernel medium large" -- "${cur}") )
return 0
;;
'-float-abi='*)
prev="${cur%%=*}="
cur=${cur#*=}
COMPREPLY=( ${prev}$(compgen -W "default smolt hard" -- "${cur}") )
return 0
;;
'-nested-ctx='*)
prev="${cur%%=*}="
cur=${cur#*=}
COMPREPLY=( ${prev}$(compgen -W "array hybrid" -- "${cur}") )
return 0
;;
'-pre-RA-sched='*)
prev="${cur%%=*}="
cur=${cur#*=}
COMPREPLY=( ${prev}$(compgen -W "default list-td list-burr list-tdrr source list-hybrid list-ilp" -- "${cur}") )
return 0
;;
'-regalloc='*)
prev="${cur%%=*}="
cur=${cur#*=}
COMPREPLY=(${prev} $(compgen -W "default fast greedy linearscan basic" -- "${cur}") )
return 0
;;
'-relocation-model='*)
prev="${cur%%=*}="
cur=${cur#*=}
COMPREPLY=( ${prev}$(compgen -W "default static pic dynamic-no-pic" -- "${cur}") )
return 0
;;
'-rewriter'*)
prev="${cur%%=*}="
cur=${cur#*=}
COMPREPLY=( ${prev}$(compgen -W "local trivial" -- "${cur}") )
return 0
;;
'-spiller='*)
COMPREPLY=( ${prev}$(compgen -W "trivial standard inline" -- "${cur}") )
return 0
;;
'-x86-asm-syntax='*)
prev="${cur%%=*}="
cur=${cur#*=}
COMPREPLY=( ${prev}$(compgen -W "att intel" -- "${cur}") )
return 0
;;
'-Dd='*|'-Hd='*|'-I='*|'-J='*|'-od='*) # add an =<dir>
prev="${cur%%=*}="
cur=${cur#*=}
COMPREPLY=( ${prev}$(compgen -S '/' -d "${cur}") )
return 0
;;
-'Df='*|'-Hf='*|'-deps='*|'-internalize-public-api-file='*|'-of='*|'-Xf='*) # add an =<file>
prev="${cur%%=*}="
cur=${cur#*=}
COMPREPLY=( ${prev}$(compgen -f "${cur}") )
return 0
;;
-'internalize-public-api-list'*|'-mattr'*|'-d-debug'*|'-d-version'*|'-debuglib'*|-'defaultlib'*|'-march'*|'-mattr'*|'-mcpu'*|'-mtriple'*|'-run'*) # add an =
prev="${cur%%=*}="
cur=${cur#*=}
COMPREPLY=( ${prev}$(compgen "${cur}") )
return 0
;;
'-limit-float-precision='*|'-stack-alignment='*|'-stack-protector-buffer-size='*) # add an =<uint>
prev="${cur%%=*}="
cur=${cur#*=}
COMPREPLY=( ${prev}$(compgen -W "0 1 2 3 4 5 6 7 8 9" -- "${cur}") )
return 0
;;
esac
if [[ "${cur}" != -* ]]; then
_filedir '@(d|di|o)'
else
isEqualOptions=$(elementExists "${cur}")
if [ "${isEqualOptions:-0}" -eq 1 ]; then
COMPREPLY=( $(compgen -W "${opts}" -S '=' -- "${cur}") )
else
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
fi
fi
}
complete -o nospace -F _ldc ldc2
# Local variables:
# mode: shell-script
# sh-basic-offset: 4
# sh-indent-comment: t
# indent-tabs-mode: nil
# End:
# ex: ts=4 sw=4 et filetype=sh
|