> #---
> ## @Synopsis used to edit spell files
> #---
> function quill_edit() {
> - message "Now invoking $EDITOR to edit spell files."
> + message "Now invoking ${EDITOR:-nano} to edit spell files."
> cd ${QUILL_SPELL_DIR}/${SPELL_NAME}
> for SPELL_FILE in .
> do
> - $EDITOR ${SPELL_FILE}
> + ${EDITOR:-nano} ${SPELL_FILE}
> done
> message "All modifications complete."
> }
> @@ -126,7 +126,7 @@ function quill_final_put_in_grimoire() {
We should modify/bullet-proof such env vars somewhere central in the
beggining, so later use in the code can be simpler. Anyway, EDITOR has such a
fallback in its profile.d script already, do you think this is necessary?
>- cp -r
${SPELL_NAME} /var/lib/sorcery/codex/${QUILL_GRIM_NAME}/${QUILL_SECT_NAME}/
>+ cp -r ${SPELL_NAME} ${QUILL_GRIM_NAME}/${QUILL_SECT_NAME}/
So much for clear variable names - QUILL_GRIM_NAME appears to have the path
to
the grim, not just the name. We should fix it sometime.
> @@ -6,12 +6,14 @@ function query_spell_dependencies() {
> message "${QUERY_COLOR}Please enter the dependencies(non optional) \
> of the spell if any:${DEFAULT_COLOR}"
> read "SPELL_DEPENDENCIES"
> + SPELL_DEPENDENCIES="$(echo $SPELL_DEPENDENCIES | sed -e 's,\W,,g' -e
> 's/./& /g')" }
>
> function query_spell_optional_dependencies() {
> message "${QUERY_COLOR}Please enter the optional dependencies of the \
> spell if any:${DEFAULT_COLOR}"
> read -a "SPELL_OPTIONAL_DEPENDENCIES"
> + SPELL_OPTIONAL_DEPENDENCIES="$(echo $SPELL_DEPENDENCIES | sed -e
> 's,\W,,g' -e 's/./& /g')" }
Uhm, did you actually try this? It is not the same case as with inputing
single characters.
navaden@lynxlynx delme $ message "${QUERY_COLOR}Please enter the
dependencies(non optional) of the spell if any:${DEFAULT_COLOR}"
Please enter the dependencies(non optional) of the spell if any:
navaden@lynxlynx delme $ read "SPELL_DEPENDENCIES"
gcc g++ expat
navaden@lynxlynx delme $ echo "$SPELL_DEPENDENCIES"
gcc g++ expat
navaden@lynxlynx delme $ SPELL_DEPENDENCIES="$(echo $SPELL_DEPENDENCIES |
sed -e 's,\W,,g' -e 's/./& /g')"
navaden@lynxlynx delme $ echo "$SPELL_DEPENDENCIES"
g c c g e x p a t
We can't just strip out non alphanumerical chars either, since they can be
part of spell names (++):
navaden@lynxlynx delme $ echo $SPELL_DEPENDENCIES | sed -e 's,\W, ,g'
gcc g expat
So I think it is simplest to leave it be and maybe add commas (not likely to
be in a spell name).
SPELL_DEPENDENCIES=$(tr ',' ' ' <<< "$SPELL_DEPENDENCIES")
> +function add_pre_build()
> +{
> + touch PRE_BUILD
> + chmod +x PRE_BUILD
> + if query "Do you want the default_pre_build function dumped into the
> PRE_BUILD file" "n" + then
> + (declare -f real_default_pre_build | tail -n -2 | head -n 1 | sed
> "s:&&:\&\&\n:g") > PRE_BUILD
more efficient:
declare -f real_default_pre_build | sed -n "4 s:^\s*\([^&]*\)&& \(.*\)$:\1
\&\&\n\2 \&\&:p" > PRE_BUILD
It's not tampering with the environment, so I see no reason to subshell it.
An
addition is to add && to the last line too (should be in the echo aswell).
Also made it remove leading whitespace.
Unrelated, but I also opt to move query_spell_pre_build to the mage level.
Adding patches is pretty common, more so than PREPARE or CONFLICTS probably.
--
We cannot command nature except by obeying her. --Sir Francis Bacon