-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxrun
More file actions
executable file
·38 lines (31 loc) · 804 Bytes
/
xrun
File metadata and controls
executable file
·38 lines (31 loc) · 804 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
xcomplete() {
. /etc/bash_completion
if [[ "$#" -eq 1 ]]; then
if OUT="$(compgen -c -- "$1")"; then
echo "$OUT" | sort -u
exit 0
fi
set -- $*
fi
PROG="$(basename "$1")"
FN="$(complete -p "$PROG" | grep -oE -- '-F *[^ ]+' | sed -e 's/-F //')"
COMP_WORDS=($*)
COMP_LINE="$*"
COMP_COUNT="$(echo "$COMP_LINE" | wc -c)"
COMP_CWORD=$(( $# -1 ))
if [[ "$COMP_CWORD" -lt 1 ]]; then
COMP_CWORD=1
fi
$FN
for ((i=0;i<${#COMPREPLY[*]};i++)); do
echo ${COMPREPLY[i]}
done | sort -u
if [[ "${#COMPREPLY[*]}" -gt 0 ]]; then
exit 0
fi
compgen -f -d -- ${!#} | sort -u
}
export -f -- xcomplete
DIR="$(dirname "$0")"
$($DIR/xmenu -c "bash -c 'xcomplete \"%s\"'")