Skip to content

Commit cd98abd

Browse files
committed
refactor(_command): move the function before "complete -F _command"
1 parent c59655c commit cd98abd

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

bash_completion

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2193,25 +2193,6 @@ else
21932193
complete -F _cd -o nospace cd pushd
21942194
fi
21952195

2196-
# A _command_offset wrapper function for use when the offset is unknown.
2197-
# Only intended to be used as a completion function directly associated
2198-
# with a command, not to be invoked from within other completion functions.
2199-
#
2200-
_command()
2201-
{
2202-
local offset i
2203-
2204-
# find actual offset, as position of the first non-option
2205-
offset=1
2206-
for ((i = 1; i <= COMP_CWORD; i++)); do
2207-
if [[ ${COMP_WORDS[i]} != -* ]]; then
2208-
offset=$i
2209-
break
2210-
fi
2211-
done
2212-
_command_offset $offset
2213-
}
2214-
22152196
# Initialize regular expressions used by `_comp_command_offset__reduce_cur`.
22162197
_comp_command_offset__initialize_regex()
22172198
{
@@ -2375,6 +2356,25 @@ _command_offset()
23752356
done
23762357
fi
23772358
}
2359+
2360+
# A _command_offset wrapper function for use when the offset is unknown.
2361+
# Only intended to be used as a completion function directly associated
2362+
# with a command, not to be invoked from within other completion functions.
2363+
#
2364+
_command()
2365+
{
2366+
local offset i
2367+
2368+
# find actual offset, as position of the first non-option
2369+
offset=1
2370+
for ((i = 1; i <= COMP_CWORD; i++)); do
2371+
if [[ ${COMP_WORDS[i]} != -* ]]; then
2372+
offset=$i
2373+
break
2374+
fi
2375+
done
2376+
_command_offset $offset
2377+
}
23782378
complete -F _command aoss command "do" else eval exec ltrace nice nohup padsp \
23792379
"then" time tsocks vsound xargs
23802380

0 commit comments

Comments
 (0)