Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Commit fc135c4

Browse files
committed
Speed-up bash target auto-complete.
These speed-ups include: * Let compgen do the command substitution. Similar to https://lists.gnu.org/archive/html/bug-bash/2012-03/msg00115.html * Use "cut" instead of "awk" for separating fields.
1 parent 083b6b0 commit fc135c4

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

misc/bash-completion

+2-3
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,8 @@ _ninja_target() {
4949
C) eval dir="$OPTARG" ;;
5050
esac
5151
done;
52-
targets_command="eval ninja -C \"${dir}\" -t targets all"
53-
targets=$(${targets_command} 2>/dev/null | awk -F: '{print $1}')
54-
COMPREPLY=($(compgen -W "$targets" -- "$cur"))
52+
targets_command="eval ninja -C \"${dir}\" -t targets all 2>/dev/null | cut -d: -f1"
53+
COMPREPLY=($(compgen -W '`${targets_command}`' -- "$cur"))
5554
fi
5655
return
5756
}

0 commit comments

Comments
 (0)