pff: enregistrer les profils définis et les créer sans confirmation si nécessaire
This commit is contained in:
parent
86963ec09f
commit
a61452c816
16
pff
16
pff
|
@ -18,6 +18,7 @@ PFFCONFVARS=(
|
||||||
"VERSION//Version actuellement installée"
|
"VERSION//Version actuellement installée"
|
||||||
-a
|
-a
|
||||||
"PVERSIONS//Versions en attente d'intégration"
|
"PVERSIONS//Versions en attente d'intégration"
|
||||||
|
"PROFILES//Profils définis"
|
||||||
"ORIGEXTS=//Extensions origines"
|
"ORIGEXTS=//Extensions origines"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -268,7 +269,8 @@ function get_current_profile() {
|
||||||
function get_profiles() {
|
function get_profiles() {
|
||||||
# afficher tous les profils valides du projet pff $1
|
# afficher tous les profils valides du projet pff $1
|
||||||
local pffdir="$1"
|
local pffdir="$1"
|
||||||
list_dirs "$pffdir/pff" | grep -vxF Current
|
(for profile in "${PROFILES[@]}"; do echo "$profile"; done
|
||||||
|
list_dirs "$pffdir/pff") | sort -u | grep -vxF Current
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_first_profile() {
|
function get_first_profile() {
|
||||||
|
@ -339,6 +341,7 @@ function get_cfile() { get_pfile "$1" Current "$2"; }
|
||||||
function get_vlfiles() {
|
function get_vlfiles() {
|
||||||
# afficher tous les fichiers de version
|
# afficher tous les fichiers de version
|
||||||
local pffdir="$1" rfile="$2" profile="${3:-Base}"
|
local pffdir="$1" rfile="$2" profile="${3:-Base}"
|
||||||
|
[ -d "$pffdir/pff/$profile" ] || return
|
||||||
if [ -n "$rfile" ]; then
|
if [ -n "$rfile" ]; then
|
||||||
find "$pffdir/pff/$profile" \
|
find "$pffdir/pff/$profile" \
|
||||||
-type f -path "$pffdir/pff/$profile/${rfile}__pv-*__" -o \
|
-type f -path "$pffdir/pff/$profile/${rfile}__pv-*__" -o \
|
||||||
|
@ -879,8 +882,13 @@ function switch_cmd() {
|
||||||
autoinit "$pffdir"
|
autoinit "$pffdir"
|
||||||
setx -a profiles=get_profiles "$pffdir"
|
setx -a profiles=get_profiles "$pffdir"
|
||||||
if ! array_contains profiles "$profile"; then
|
if ! array_contains profiles "$profile"; then
|
||||||
ewarn "$profile: ce profil n'existe pas"
|
if ! array_contains PROFILES "$profile"; then
|
||||||
ask_yesno "Voulez-vous le créer?" O || return 1
|
ewarn "$profile: ce profil n'existe pas"
|
||||||
|
ask_yesno "Voulez-vous le créer?" O || return 1
|
||||||
|
|
||||||
|
array_addu PROFILES "$profile"
|
||||||
|
conf_update "$pffdir/$PFFCONF" PROFILES
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
enote "Sélection du profil $profile"
|
enote "Sélection du profil $profile"
|
||||||
select_profile "$profile" "$pffdir"
|
select_profile "$profile" "$pffdir"
|
||||||
|
@ -1092,7 +1100,7 @@ function infos_cmd() {
|
||||||
setx -a profiles=get_profiles "$pffdir"
|
setx -a profiles=get_profiles "$pffdir"
|
||||||
|
|
||||||
if [ ${#lfiles[*]} -gt 0 ]; then
|
if [ ${#lfiles[*]} -gt 0 ]; then
|
||||||
[ ${#lfiles[*]} -gt 1 ] && estep "${#lfiles[*]} fichiers locaux:" || estep "1 fichier local:"
|
[ ${#lfiles[*]} -gt 1 ] && estep "${#lfiles[*]} fichiers locaux" || estep "1 fichier local"
|
||||||
for rfile in "${lfiles[@]}"; do
|
for rfile in "${lfiles[@]}"; do
|
||||||
setx -a vlfiles=get_vlfiles "$pffdir" "$rfile" "$profile"
|
setx -a vlfiles=get_vlfiles "$pffdir" "$rfile" "$profile"
|
||||||
setx Pfile=get_pfile "$pffdir/$rfile" "$profile" "$pffdir"
|
setx Pfile=get_pfile "$pffdir/$rfile" "$profile" "$pffdir"
|
||||||
|
|
Loading…
Reference in New Issue