autocomplete qbg

This commit is contained in:
2018-11-20 13:56:15 +02:00
parent 7b78f12f08
commit d8c6a73fab

View File

@@ -362,6 +362,19 @@ function qbg {
}
"$@" &> /dev/null &
}
_qbg()
{
local cur
cur=${COMP_WORDS[COMP_CWORD]}
if [[ "$COMP_CWORD" == 1 ]]; then
local executables
executables=$({ compgen -c; compgen -abkA function; } | sort | uniq -u )
COMPREPLY=( $( compgen -W "$executables" -- "$cur" ) )
return 0
fi
COMPREPLY=( $( compgen -fd -- "$cur" ) )
}
complete -F _qbg qbg
function set_term_title {
# set term in byobu/screen xterm etc..
@@ -393,6 +406,7 @@ function path_add_current {
path_remove_duplicates
echo PATH=$PATH
}
function path_remove_duplicates {
# Remove duplicates in PATH
PATH=$( echo $PATH | awk -F: '{for (i=1;i<=NF;i++) { if ( !x[$i]++ ) printf("%s:",$i); }}' | sed 's,:\+$,,g' )