最后活跃于 1 month ago

nuno 修订了这个 Gist 1 month ago. 转到此修订

1 file changed, 21 insertions

gistfile1.txt(文件已创建)

@@ -0,0 +1,21 @@
1 + function command::_preprocess_flags() {
2 + local -n _args_ref="$1"
3 + local -a _filtered=()
4 +
5 + for _arg in "${_args_ref[@]:-}"; do
6 + local _consumed=false
7 + local _mixin
8 + for _mixin in "${_ACTIVE_MIXINS[@]:-}"; do
9 + local _process_fn="command::mixin::${_mixin}::process"
10 + if declare -f "$_process_fn" >/dev/null 2>&1; then
11 + if "$_process_fn" "$_arg"; then
12 + _consumed=true
13 + break
14 + fi
15 + fi
16 + done
17 + $_consumed || _filtered+=("$_arg")
18 + done
19 +
20 + _args_ref=("${_filtered[@]:-}")
21 + }
上一页 下一页