Intégration de la feature branch completion
This commit is contained in:
commit
90772f0757
|
@ -0,0 +1,16 @@
|
||||||
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||||
|
|
||||||
|
function __nutools_host_completion() {
|
||||||
|
local cur prev
|
||||||
|
_get_comp_words_by_ref cur prev
|
||||||
|
if [ "$prev" == "-h" -o "$prev" == "-H" ]; then
|
||||||
|
_known_hosts_real "$cur"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -n "$BASH_COMPLETION_DIR" -a -f "$BASH_COMPLETION_DIR/ssh" ]; then
|
||||||
|
shopt -u hostcomplete
|
||||||
|
complete -F _ssh ussh cssh
|
||||||
|
fi
|
||||||
|
|
||||||
|
complete -F __nutools_host_completion -o default ruinst runs rruns
|
|
@ -0,0 +1,8 @@
|
||||||
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||||
|
|
||||||
|
function __pdev_branches() {
|
||||||
|
git for-each-ref --format='%(refname:short)' refs/heads |
|
||||||
|
grep -vF master |
|
||||||
|
grep -v '^release-' |
|
||||||
|
grep -v '^hotfix-'
|
||||||
|
}
|
|
@ -5,42 +5,21 @@ if [ -n "$UTOOLS_BASH_COMPLETION" ]; then
|
||||||
if [ -f /etc/debian_version ]; then
|
if [ -f /etc/debian_version ]; then
|
||||||
case "$(</etc/debian_version)" in
|
case "$(</etc/debian_version)" in
|
||||||
6*|squeeze*)
|
6*|squeeze*)
|
||||||
# le code suivant n'est compatible qu'avec debian squeeze
|
# le code suivant n'est compatible qu'avec debian squeeze (plus
|
||||||
if [ -z "$BASH_COMPLETION" -a "${BASH_VERSINFO[0]}" -ge 4 ]; then
|
# exactement, avec bash 4.0)
|
||||||
source "@@dest@@/lib/ulib/bash_completion"
|
source "@@dest@@/lib/ulib/bash40/bash_completion"
|
||||||
fi
|
|
||||||
if [ -n "$BASH_COMPLETION" ]; then
|
|
||||||
if [ -n "$BASH_COMPLETION_DIR" -a -f "$BASH_COMPLETION_DIR/ssh" ]; then
|
|
||||||
shopt -u hostcomplete
|
|
||||||
complete -F _ssh ussh cssh
|
|
||||||
fi
|
|
||||||
|
|
||||||
function _nutools_h() {
|
|
||||||
local cur prev
|
|
||||||
_get_comp_words_by_ref cur prev
|
|
||||||
if [ "$prev" == "-h" -o "$prev" == "-H" ]; then
|
|
||||||
_known_hosts_real "$cur"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
complete -F _nutools_h -o default ruinst runs rruns
|
|
||||||
|
|
||||||
function __pdev_branches() {
|
|
||||||
git for-each-ref --format='%(refname:short)' refs/heads |
|
|
||||||
grep -vF master |
|
|
||||||
grep -v '^release-' |
|
|
||||||
grep -v '^hotfix-'
|
|
||||||
}
|
|
||||||
function _pdev() {
|
|
||||||
local cur
|
|
||||||
_get_comp_words_by_ref cur
|
|
||||||
COMPREPLY=($(compgen -W "$(__pdev_branches)" "$cur"))
|
|
||||||
}
|
|
||||||
complete -F _pdev pdev
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
7*|wheezy*)
|
7*|wheezy*)
|
||||||
# le code suivant n'est compatible qu'avec debian wheezy
|
# le code suivant n'est compatible qu'avec debian wheezy (plus
|
||||||
|
# exactement, avec bash 4.1)
|
||||||
|
source "@@dest@@/lib/ulib/bash41/bash_completion"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
if [ -n "$BASH_COMPLETION" ]; then
|
||||||
|
for i in "@@dest@@/lib/bash_completion.d/"*; do
|
||||||
|
[ -f "$i" ] || continue
|
||||||
|
source "$i"
|
||||||
|
done
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -32,6 +32,12 @@ done
|
||||||
./udist --nutools-makelinks
|
./udist --nutools-makelinks
|
||||||
./ulink --nutools-makelinks
|
./ulink --nutools-makelinks
|
||||||
|
|
||||||
|
# complétion programmable
|
||||||
|
bcdir=lib/bash_completion.d
|
||||||
|
./pdev --nutools-completion >"$bcdir/pdev"
|
||||||
|
#./prel --nutools-completion >"$bcdir/prel"
|
||||||
|
#./pfix --nutools-completion >"$bcdir/pfix"
|
||||||
|
|
||||||
# copier le fichier .nutoolsrc
|
# copier le fichier .nutoolsrc
|
||||||
[ -f ~/.nutoolsrc ] || cp lib/nutoolsrc ~/.nutoolsrc
|
[ -f ~/.nutoolsrc ] || cp lib/nutoolsrc ~/.nutoolsrc
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,20 @@
|
||||||
##@cooked comments # -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
##@cooked comments # -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||||
## Fonctions pour l'autocomplétion bash, si le package bash-completion n'est pas installé
|
## Fonctions pour l'autocomplétion bash, si le package bash-completion n'est pas
|
||||||
## Attention! Ces fonctions ne sont testées que sur Debian Squeeze. Ce module
|
## installé. ATTENTION! Ces fonctions ont été pour la plupart récupérées de
|
||||||
## est incompatible avec bash_completion sur Debian Wheezy.
|
## l'implémentation sous Debian Squeeze, ce qui signifie qu'elles sont conçues
|
||||||
|
## pour fonctionner avec bash 4.0
|
||||||
##@cooked nocomments
|
##@cooked nocomments
|
||||||
##@require base
|
##@require base
|
||||||
uprovide bash_completion
|
uprovide bash_completion
|
||||||
|
|
||||||
if [ -z "$BASH_COMPLETION" ]; then
|
function __is_bash_completion_enabled() {
|
||||||
|
[ -n "$BASH_COMPLETION" ]
|
||||||
|
}
|
||||||
|
function __is_bash_completion_module_enabled() {
|
||||||
|
[ -n "$BASH_COMPLETION_DIR" -a -f "$BASH_COMPLETION_DIR/$1" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
if ! __is_bash_completion_enabled; then
|
||||||
BASH_COMPLETION=1
|
BASH_COMPLETION=1
|
||||||
shopt -s extglob progcomp
|
shopt -s extglob progcomp
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
##@cooked comments # -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||||
|
## Fonctions pour l'autocomplétion bash, si le package bash-completion n'est pas
|
||||||
|
## installé. ATTENTION! Ces fonctions ont été pour la plupart récupérées de
|
||||||
|
## l'implémentation sous Debian Wheezy, ce qui signifie qu'elles sont conçues
|
||||||
|
## pour fonctionner avec bash 4.1
|
||||||
|
##@cooked nocomments
|
||||||
|
##@require base
|
||||||
|
uprovide bash_completion
|
||||||
|
|
||||||
|
function __is_bash_completion_enabled() {
|
||||||
|
[ -n "$__NUTOOLS_BASH_COMPLETION" ] && return 0
|
||||||
|
grep -qE '^[ \t]*(\.|source)[ \t]*/usr/share/bash-completion/bash_completion' /etc/bash.bashrc && return 0
|
||||||
|
grep -qE '^[ \t]*(\.|source)[ \t]*/usr/share/bash-completion/bash_completion' ~/.bashrc && return 0
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
function __is_bash_completion_module_enabled() {
|
||||||
|
[ -f "/usr/share/bash-completion/completions/$1" ] && return 0
|
||||||
|
[ -n "$BASH_COMPLETION_COMPAT_DIR" -a -f "$BASH_COMPLETION_COMPAT_DIR/$1" ] && return 0
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
if ! __is_bash_completion_enabled; then
|
||||||
|
export __NUTOOLS_BASH_COMPLETION=1
|
||||||
|
fi
|
||||||
|
[ -n "$BASH_COMPLETION" ] || export BASH_COMPLETION=1
|
13
pdev
13
pdev
|
@ -1,5 +1,18 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||||
|
|
||||||
|
if [ $# -eq 1 -a "$1" == --nutools-completion ]; then
|
||||||
|
echo '
|
||||||
|
function __pdev_completion() {
|
||||||
|
local cur
|
||||||
|
_get_comp_words_by_ref cur
|
||||||
|
COMPREPLY=($(compgen -W "$(__pdev_branches)" "$cur"))
|
||||||
|
}
|
||||||
|
complete -F __pdev_completion pdev
|
||||||
|
'
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
||||||
urequire DEFAULTS ptools
|
urequire DEFAULTS ptools
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue