Skip to Content.
Sympa Menu

sm-discuss - Re: [SM-Discuss] Spell branches

sm-discuss AT lists.ibiblio.org

Subject: Public SourceMage Discussion List

List archive

Chronological Thread  
  • From: flux <flux AT sourcemage.org>
  • To: sm-discuss AT lists.ibiblio.org
  • Subject: Re: [SM-Discuss] Spell branches
  • Date: Wed, 14 Sep 2011 07:19:44 +0900

Ismael Luceno (ismael.luceno AT gmail.com) wrote [11.09.14 00:58]:
> I mean that, past that line, $1 isn't $spell. E.g.:
>
> select_branch SPELL scm
>
> Then $spell would be "SPELL" and $1 "scm". So this version behaves
> quite differently.

That makes more sense. :) OK, so the new version would be:

function select_branch() {
local spell="$1" tmp &&
shift &&

if [[ "$#" > 1 ]]; then
config_query_list "$spell"_BRANCH \
"Select one of the available branches:" "$@"
else
eval "$spell"_BRANCH=\""$1"\"
fi &&

eval tmp=\"\$"$spell"_BRANCH\" &&

if [[ "${tmp/-*}" = "scm" ]]; then
config_query "$spell"_SCM_AUTOUPDATE \
'Update on every system update?' n
fi
}

Not so different from yours now of course, except the placement of the
tmp= line. I think there might need to be more error checking though.
For example, perhaps a tr '[A-Z]' '[a-z]' on $tmp to ensure a match even
if a spell writer uses SCM as the branch name. Maybe this isn't
technically needed right now, but if people start using this function it
may come out later. It would be really good if we could set a convention
on branches, but I have a feeling we won't reach a consensus any time
soon.

--
Justin "flux_control" Boffemmyer
Cauldron wizard and general mage
Source Mage GNU/Linux
http://www.sourcemage.org

Attachment: pgpG6flDPjobe.pgp
Description: PGP signature




Archive powered by MHonArc 2.6.24.

Top of Page