Fix default argument handling
This commit is contained in:
parent
3e129a1267
commit
0ebd7c228c
1 changed files with 10 additions and 1 deletions
11
q
11
q
|
@ -115,7 +115,16 @@ run_command() {
|
||||||
COMMAND="$2"
|
COMMAND="$2"
|
||||||
FIRST=${COMMAND%%" "*}
|
FIRST=${COMMAND%%" "*}
|
||||||
REST=${COMMAND#*" "}
|
REST=${COMMAND#*" "}
|
||||||
SCRIPTS="$(get_scripts_for_cmd "$INPUT")"
|
if [ ! -z "$REST" ]; then
|
||||||
|
# This branch is taken in most cases when an existing
|
||||||
|
# item is selected in fzf
|
||||||
|
SCRIPTS="$(get_scripts_for_cmd "$REST")"
|
||||||
|
else
|
||||||
|
# In case when zero items have matched, but a command
|
||||||
|
# has support for a default action to take (e.g. creating
|
||||||
|
# a new entry) - use the actual user's input
|
||||||
|
SCRIPTS="$(get_scripts_for_cmd "$INPUT")"
|
||||||
|
fi
|
||||||
if [ -z "$SCRIPTS" ] || \
|
if [ -z "$SCRIPTS" ] || \
|
||||||
[ "$(echo "$SCRIPTS" | wc -w)" -gt "1" ]; then
|
[ "$(echo "$SCRIPTS" | wc -w)" -gt "1" ]; then
|
||||||
echo "Scripts matched: $SCRIPTS"
|
echo "Scripts matched: $SCRIPTS"
|
||||||
|
|
Loading…
Reference in a new issue