Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to master sorcery by Jaka Kranjc (942877ab43d1d1957441e022d3fe8af9593e72ac)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Jaka Kranjc <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to master sorcery by Jaka Kranjc (942877ab43d1d1957441e022d3fe8af9593e72ac)
  • Date: Wed, 3 Dec 2008 14:16:18 -0600

GIT changes to master sorcery by Jaka Kranjc <lynxlynxlynx AT sourcemage.org>:

ChangeLog | 1 +
usr/sbin/scribbler | 36 ++++++++++++++++++++++++------------
usr/share/man/man8/scribbler.8 | 8 ++++++--
3 files changed, 31 insertions(+), 14 deletions(-)

New commits:
commit 942877ab43d1d1957441e022d3fe8af9593e72ac
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

scribbler: added an option for creating local grimoires #14221

diff --git a/ChangeLog b/ChangeLog
index e31c495..ecb8ca5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,7 @@
* api2: fixed a build message
* libdispel: fixed a duplicate debug message in reap_state_files
* resurrect, dispel: implemented --nosustain #14877
+ * scribbler: added an option for creating local grimoires #14221

2008-10-07 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
* delve: redirect messages that should be shown with VOYEUR=off too
diff --git a/usr/sbin/scribbler b/usr/sbin/scribbler
index bebfc62..9d00ae3 100755
--- a/usr/sbin/scribbler
+++ b/usr/sbin/scribbler
@@ -29,11 +29,14 @@ Usage:
scribbler add spell from-grimoire to-grimoire [to-section]
copies a spell from one grimoire to
another grimoire into the specified section.
- The to-section is the same as the source section if unspecified
+ The to-section is the same as the source section if unspecified.
+ The to-grimoire is optionally created if it doesn't exist.

scribbler remove spell from-grimoire
removes a spell from a grimoire

+scribbler add-grimoire to-grimoire
+ creates a local grimoire to-grimoire
EOF
}

@@ -44,6 +47,16 @@ function scribbler_remove() {
scribe reindex $3
}

+function scribbler_add_grimoire() {
+ local grimoire=$1
+
+ TO_GRIMOIRE_DIRECTORY=$(codex_canonicalize_grimoire_name $grimoire) &&
+ mkdir -p $TO_GRIMOIRE_DIRECTORY &&
+ codex_add_grimoire $TO_GRIMOIRE_DIRECTORY 0 &&
+ message "Created grimoire $grimoire" &&
+ scribe localize $TO_GRIMOIRE_DIRECTORY
+}
+
function scribbler_add() {
## Set and validate (and possibly create) the to-grimoire name
if ! TO_GRIMOIRE_DIRECTORY=$(codex_find_grimoire $4) ; then
@@ -51,11 +64,7 @@ function scribbler_add() {
"(${SPELL_COLOR}${4}${PROBLEM_COLOR}) is not a" \
"valid grimoire.${DEFAULT_COLOR}"
if query "Shall I add it for you?" y; then
- TO_GRIMOIRE_DIRECTORY=$(codex_canonicalize_grimoire_name $4) &&
- ## is this still needed?
- mkdir -p $TO_GRIMOIRE_DIRECTORY &&
- codex_add_grimoire $TO_GRIMOIRE_DIRECTORY 0 &&
- scribe localize $TO_GRIMOIRE_DIRECTORY
+ scribbler_add_grimoire $4
else
return $?
fi || return $?
@@ -119,7 +128,9 @@ function validate_and_parse_args() {
exit 1
fi

- if [ "${3}" == "" ]; then
+ [[ $1 == add-grimoire ]] && return
+
+ if [[ -z $3 ]]; then
usage
exit 1
fi
@@ -133,7 +144,7 @@ function validate_and_parse_args() {


## Set and validate the from-grimoire name
- if ! FROM_GRIMOIRE_DIRECTORY=$(codex_find_grimoire $3) ; then
+ if ! FROM_GRIMOIRE_DIRECTORY=$(codex_find_grimoire $3); then
message "${PROBLEM_COLOR}The grimoire you specified" \
"(${SPELL_COLOR}${3}${PROBLEM_COLOR}) can not be" \
"found.${DEFAULT_COLOR}"
@@ -143,7 +154,7 @@ function validate_and_parse_args() {

## Set and validate the spell name
SPELL_DIRECTORY=$(codex_cache_spell_lookup $2 $FROM_GRIMOIRE_DIRECTORY)
- if [ "${SPELL_DIRECTORY}" == "" ]; then
+ if [[ -z $SPELL_DIRECTORY ]]; then
message "${PROBLEM_COLOR}The spell you specified" \
"(${SPELL_COLOR}${2}${PROBLEM_COLOR}) is not a" \
"valid spell of the specified grimoire" \
@@ -157,9 +168,10 @@ function main() {

## Get to the root of the issue
case $1 in
- add) scribbler_add "$@" ;;
- remove) scribbler_remove "$@" ;;
- *) usage ;;
+ add) scribbler_add "$@" ;;
+ add-grimoire) scribbler_add_grimoire "$2" ;;
+ remove) scribbler_remove "$@" ;;
+ *) usage ;;
esac
cleanup_tmp_dir $TMP_DIR
exit 0
diff --git a/usr/share/man/man8/scribbler.8 b/usr/share/man/man8/scribbler.8
index 1559777..d88153e 100644
--- a/usr/share/man/man8/scribbler.8
+++ b/usr/share/man/man8/scribbler.8
@@ -3,6 +3,8 @@
scribbler \- a utility for controlling the spells in your grimoires
.SH SYNOPSIS
.B scribbler add|remove spell from-grimoire to-grimoire [to-section]
+.PP
+.B scribbler add-grimoire to-grimoire
.SH "DESCRIPTION"
.I scribbler
is part of the
@@ -10,9 +12,11 @@ is part of the
source-code package management suite. Scribbler is a utility for controlling
the
spells in your private grimoire.
.SH "NOTE"
-The 'to-grimoire' optioin is not used for the remove command. If
'to-section'
+The 'to-grimoire' option is not used for the remove command. If 'to-section'
is not specified, then the spell will be placed in a section named the same
as
-the one it came from.
+the one it came from. If the to-grimoire grimoire doesn't exist, scribbler
will
+offer to create it. This can also be achieved manually by using the
add-grimoire
+subcommand.
.SH "AUTHOR"
The Source Mage GNU Linux Team (http://www.sourcemage.org)
.PP



  • [SM-Commit] GIT changes to master sorcery by Jaka Kranjc (942877ab43d1d1957441e022d3fe8af9593e72ac), Jaka Kranjc, 12/03/2008

Archive powered by MHonArc 2.6.24.

Top of Page