diff --git a/etc/shell/bash/bash_completion_custom b/etc/shell/bash/bash_completion_custom index f6b3b03..54b2166 100755 --- a/etc/shell/bash/bash_completion_custom +++ b/etc/shell/bash/bash_completion_custom @@ -1,9 +1,11 @@ #!/bin/bash ######################### # -# Изменён: Сб 01 июн 2019 23:24:01 +# Изменён: Ср 05 фев 2020 14:10:12 # #complete <что дополнять> <программа> +[ -f $BASHRC/bash_completion_surfraw ] && . $BASHRC/bash_completion_surfraw + complete -A alias {,un}alias complete -A hostname rsh rcp telnet rlogin r ftp ping disk complete -A export printenv @@ -67,14 +69,6 @@ complete -f -o default -X '!*.sh' sh bash complete -f -o default -X '!*.+(c|cpp)' gcc g++ mpp complete -f -o default -X '!*.hs' runghc ghc -#Запуск и остановка сервисов -_rcd () { - COMPREPLY=($(\ls /etc/rc.d/rc.$(echo $2 | \ - sed 's;/etc/rc.d/rc\.;;g')* 2> /dev/null)) -} - -complete -F _rcd start stop restart - _local-bins () { if [[ $2 == "" ]]; then COMPREPLY=($(\ls $SHELLRC/bin/scripts/ $SHELLRC/bin/dmenu \ @@ -100,36 +94,13 @@ _updirs() { complete -F _updirs up -#Дополнение пакетов -_slapt-r () { - if [[ $2 == "" ]]; then - COMPREPLY=($(slapt-get --available | cut -d ' ' -f 1)) - else - COMPREPLY=($(slapt-get --available | cut -d ' ' -f 1 | grep $2)) +_git-commit () { + if git rev-parse --git-dir 2>&1 >&-; then + if [[ $2 == "commit" ]] || [[ $2 == "cm" ]]; then + COMPREPLY=("$2 \"$(git log -1 --pretty=format:%B | grep -v "Merge" | grep : | cut -d : -f 1)") + fi fi } -complete -F _slapt-r slapt-get - -# cheat.sh -_cht_complete() -{ - local cur prev opts - _get_comp_words_by_ref -n : cur - - COMPREPLY=() - cur="${COMP_WORDS[COMP_CWORD]}" - prev="${COMP_WORDS[COMP_CWORD-1]}" - opts="$(curl -s cheat.sh/:list)" - - if [ ${COMP_CWORD} = 1 ]; then - COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) - __ltrim_colon_completions "$cur" - fi - return 0 -} - -complete -F _cht_complete cheat.sh - -[ -f $BASHRC/bash_completion_surfraw ] && . $BASHRC/bash_completion_surfraw +complete -F _git-commit git g