Skip to content

Commit 93ca93d

Browse files
author
Damien Nadé
committed
argsparse-completion.sh: __argsparse_complete: handling positional arguments (default to files(?))
1 parent 0667b8a commit 93ca93d

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

argsparse-completion.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ __argsparse_complete() {
7474
longs=( "${!__argsparse_options_descriptions[@]}" )
7575
longs=( "${longs[@]/#/--}" )
7676
option=${prev#--}
77-
if __argsparse_index_of "$prev" "${longs[@]}" >/dev/null && \
77+
if __argsparse_index_of -- "${words[@]:0:${#words[@]}-1}" >/dev/null
78+
then
79+
# Complete positionnal arguments
80+
__argsparse_compgen -A file
81+
elif __argsparse_index_of "$prev" "${longs[@]}" >/dev/null && \
7882
argsparse_has_option_property "$option" value
7983
then
8084
__argsparse_complete_value "$option"

0 commit comments

Comments
 (0)