From 798f9e69fce34aa7f1eb437d9a223b63957bec47 Mon Sep 17 00:00:00 2001 From: Maxim Likhachev Date: Wed, 5 Feb 2020 14:11:10 +0300 Subject: [PATCH] =?UTF-8?q?bash,=20git:=20=D0=B4=D0=BE=D0=BF=D0=BE=D0=BB?= =?UTF-8?q?=D0=BD=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BE=D0=BC=D0=BC=D0=B8?= =?UTF-8?q?=D1=82=D0=B0=20=D0=BC=D0=B5=D1=82=D0=BA=D0=BE=D0=B9=20=D0=BF?= =?UTF-8?q?=D0=BE=D1=81=D0=BB=D0=B5=D0=B4=D0=BD=D0=B5=D0=B3=D0=BE=20=D1=81?= =?UTF-8?q?=D0=BE=D0=BE=D0=B1=D1=89=D0=B5=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- etc/shell/bash/bash_completion_custom | 47 +++++++---------------------------- 1 file changed, 9 insertions(+), 38 deletions(-) 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