Skip to content

Commit

Permalink
FL-184 adding set-flavor functon to eselect profile
Browse files Browse the repository at this point in the history
  • Loading branch information
psychopatch committed Dec 9, 2012
1 parent 68804ca commit 5debce1
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions app-admin/eselect/files/1.3.1.1_rc3/profile.eselect
Original file line number Diff line number Diff line change
Expand Up @@ -1016,3 +1016,42 @@ describe_show() {
do_show() {
show_profiles
}

#FL-184
#Adding a set-flavor function to allow an easier workflow
#to replace system flavors.
describe_set-flavor() {
echo "Changes flaver profile"
}

do_set-flavor() {
local pro_to_add="${1}"
#this code below is being used in 3 functions
#to be dry could proably put in it's own function
if $(is_number "${pro_to_add}")
then
pro_to_add="$(convert_list_number ${pro_to_add})"
else
pro_to_add="$(validate_profile_string ${pro_to_add})"
fi
local profile_type="$(get_profile_type ${pro_to_add})"
if [[ "${profile_type}" == "flavor" ]]
then
#this is where the work to swap out the flavors happen.
#get current flavor
local profiles=( $(get_currently_set_profiles) )
for i in "${profiles[@]}"
do

if [[ "$(get_profile_type ${i})" == "flavor" ]]
then
do_remove "${i}"
break
fi
done
#enable flavor
do_add "${1}"
else
die -q "Selection is not a flavor"
fi
}

0 comments on commit 5debce1

Please sign in to comment.