completion automatique
This commit is contained in:
parent
151e083a49
commit
4a8c5d1e3d
|
@ -48,7 +48,7 @@ bcdir=lib/completion.d
|
|||
./pdev --nutools-completion >"$bcdir/pdev"
|
||||
./prel --nutools-completion >"$bcdir/prel"
|
||||
#./pfix --nutools-completion >"$bcdir/pfix"
|
||||
#./pff --nutools-completion >"$bcdir/pff"
|
||||
./pff --nutools-completion >"$bcdir/pff"
|
||||
|
||||
# copier le fichier .nutoolsrc
|
||||
[ -f ~/.nutoolsrc ] || cp lib/nutoolsrc ~/.nutoolsrc
|
||||
|
|
59
pff
59
pff
|
@ -8,6 +8,18 @@ SCRIPT_ALIASES=(
|
|||
pfe:-e
|
||||
)
|
||||
|
||||
ORIGEXT=pff
|
||||
DEFAULT_ORIGEXTS=(".$ORIGEXT" .origine .default)
|
||||
PFFCONF=.pff.conf # ne pas modifier
|
||||
DEFAULT_PROTECTS=(/.git/ .svn/ /pff/ "/$PFFCONF")
|
||||
|
||||
PFFCONFVARS=(
|
||||
"VERSION//Version actuellement installée"
|
||||
-a
|
||||
"PVERSIONS//Versions en attente d'intégration"
|
||||
"ORIGEXTS=//Extensions origines"
|
||||
)
|
||||
|
||||
if [ "$#" -eq 1 -a "$1" == --nutools-makelinks ]; then
|
||||
# créer les liens
|
||||
scriptname="$(basename -- "$0")"
|
||||
|
@ -19,14 +31,45 @@ if [ "$#" -eq 1 -a "$1" == --nutools-makelinks ]; then
|
|||
elif [ $# -eq 1 -a "$1" == --nutools-completion ]; then
|
||||
echo '
|
||||
function __pff_profiles() {
|
||||
: #TODO
|
||||
local cwd="$(pwd)"
|
||||
local pffdir="$cwd"
|
||||
while true; do
|
||||
if [ -f "$pffdir/'"$PFFCONF"'" -a -d "$pffdir/pff" ]; then
|
||||
cd "$pffdir/pff"
|
||||
/bin/ls -1d * | while read f; do
|
||||
[ -d "$f" -a "$f" != Current ] || continue
|
||||
f="$1$f"
|
||||
if [[ "${f:0:2}" == -[eEn] ]]; then
|
||||
echo -n -
|
||||
echo "${f:1}"
|
||||
else
|
||||
echo "$f"
|
||||
fi
|
||||
done
|
||||
cd "$cwd"
|
||||
break
|
||||
fi
|
||||
[ "$pffdir" == / -o "$pffdir" == "$HOME" ] && break
|
||||
pffdir="$(dirname -- "$pffdir")"
|
||||
done
|
||||
}
|
||||
function __pfs_completion() {
|
||||
local cur
|
||||
_get_comp_words_by_ref cur
|
||||
COMPREPLY=($(compgen -W "$(__pff_profiles)" "$cur"))
|
||||
}
|
||||
complete -F __pfs_completion pfs
|
||||
complete -F __pfs_completion -o bashdefault -o default pfs
|
||||
function __pff_completion() {
|
||||
local cur prev opt comp
|
||||
_get_comp_words_by_ref cur prev
|
||||
if [[ "$prev" == -*s ]]; then
|
||||
COMPREPLY=($(compgen -W "$(__pff_profiles)" -- "$cur"))
|
||||
elif [[ "$cur" == -*s* ]]; then
|
||||
comp="${cur#-*s}"; opt="${cur:0:$((${#cur}-${#comp}))}"
|
||||
COMPREPLY=($(compgen -W "$(__pff_profiles "$opt")" -- "$cur"))
|
||||
fi
|
||||
}
|
||||
complete -F __pff_completion -o bashdefault -o default pff
|
||||
'
|
||||
exit 0
|
||||
fi
|
||||
|
@ -152,18 +195,6 @@ supportées sont:
|
|||
# clink: la destination du lien cfile
|
||||
# Plink: la destination du lien Pfile
|
||||
|
||||
ORIGEXT=pff
|
||||
DEFAULT_ORIGEXTS=(".$ORIGEXT" .origine .default)
|
||||
PFFCONF=.pff.conf # ne pas modifier
|
||||
DEFAULT_PROTECTS=(/.git/ .svn/ /pff/ "/$PFFCONF")
|
||||
|
||||
PFFCONFVARS=(
|
||||
"VERSION//Version actuellement installée"
|
||||
-a
|
||||
"PVERSIONS//Versions en attente d'intégration"
|
||||
"ORIGEXTS=//Extensions origines"
|
||||
)
|
||||
|
||||
function find_pffdir() {
|
||||
# trouver le répertoire du projet pff à partir du répertoire $2(=.) et
|
||||
# mettre le chemin absolu dans la variable $1(=pffdir)
|
||||
|
|
Loading…
Reference in New Issue