diff --git a/lib/bash_completion.d/nutools b/lib/bash_completion.d/nutools new file mode 100644 index 0000000..1df64fb --- /dev/null +++ b/lib/bash_completion.d/nutools @@ -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 diff --git a/lib/bash_completion.d/ptools b/lib/bash_completion.d/ptools new file mode 100644 index 0000000..41b14d3 --- /dev/null +++ b/lib/bash_completion.d/ptools @@ -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-' +} diff --git a/lib/bashrc.d/bash_completion.nutools b/lib/bashrc.d/bash_completion.nutools index 35ac9a5..2f97b73 100644 --- a/lib/bashrc.d/bash_completion.nutools +++ b/lib/bashrc.d/bash_completion.nutools @@ -5,42 +5,21 @@ if [ -n "$UTOOLS_BASH_COMPLETION" ]; then if [ -f /etc/debian_version ]; then case "$("$bcdir/pdev" +#./prel --nutools-completion >"$bcdir/prel" +#./pfix --nutools-completion >"$bcdir/pfix" + # copier le fichier .nutoolsrc [ -f ~/.nutoolsrc ] || cp lib/nutoolsrc ~/.nutoolsrc diff --git a/lib/ulib/bash_completion b/lib/ulib/bash40/completion similarity index 100% rename from lib/ulib/bash_completion rename to lib/ulib/bash40/completion diff --git a/pdev b/pdev index e050b6b..7fdce59 100755 --- a/pdev +++ b/pdev @@ -1,5 +1,17 @@ #!/bin/bash # -*- 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 +' +fi + source "$(dirname "$0")/lib/ulib/ulib" || exit 1 urequire DEFAULTS ptools