This commit is contained in:
2022-05-27 22:06:26 +03:00

6
bake
View File

@@ -42,7 +42,7 @@ complete -F _bake_complete bake
# Run me as: source <( $BAKE __autocomplete__ )
'
exit; }
_flines() { cat "$BAKEFILE" | \
_flines() { cat "$BAKEFILE" 2>/dev/null | \
grep -E '^([^_][a-zA-Z0-9_\.\-]+)\(\) {.*'; }
_menu() { _flines | while read line; do
if [[ "$line" =~ ([a-zA-Z0-9_\.\-]+)\(\).\{[\ #]*(.*) ]]; then
@@ -113,6 +113,8 @@ _update_self() {
"https://raw.githubusercontent.com/moonq/bake/main/bake"
chmod +x "$0"
}
@() { echo +"$@" >&2; "$@"; } # Print command before running it
for (( i=1; i<=$#; i++ )); do
if [[ $i -eq 1 ]]; then
if [[ "${!i}" = "__list__" ]]; then _flines | sed 's/().*//'; exit; fi
@@ -156,7 +158,7 @@ else
"$@"
else
# but there is no defined completion
compgen -o plusdirs -f -- "${@: -1}"
compgen -f -d -- "${@: -1}"
fi
else
# no such command