summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2010-11-09 21:54:17 +0000
committerUlrich Müller <ulm@gentoo.org>2010-11-09 21:54:17 +0000
commit262ba32ce3990b0780610442d06b791c62ad87b0 (patch)
tree38cd15920b6e77eb0518f2ebb84e9b163cbfdf25
parentDefault argument for shift. (diff)
downloademacs-tools-262ba32ce3990b0780610442d06b791c62ad87b0.tar.gz
emacs-tools-262ba32ce3990b0780610442d06b791c62ad87b0.tar.bz2
emacs-tools-262ba32ce3990b0780610442d06b791c62ad87b0.zip
New option --batch|-b for non-interactive mode.
svn path=/emacs-updater/; revision=1586
-rw-r--r--ChangeLog6
-rwxr-xr-xemacs-updater28
-rw-r--r--emacs-updater.83
3 files changed, 23 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index f91c631..fd1607c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,8 +5,10 @@
(PM_EXTRAOPTS): New variable, saves any additional options after
the -- separator, so that they can be passed to the package
manager later on.
- (usage): Update.
- * emacs-updater.8: Update.
+ (OPTIONS): New option --batch|-b for non-interactive mode.
+ (BATCH): New variable.
+ (usage): Update help text.
+ * emacs-updater.8: Describe new options.
2010-01-04 Christian Faulhammer <fauli@gentoo.org>
diff --git a/emacs-updater b/emacs-updater
index e7e0813..d271a1d 100755
--- a/emacs-updater
+++ b/emacs-updater
@@ -19,6 +19,7 @@ PM_COMMAND=pm_auto
PM_EXTRAOPTS=( )
# Other default variable settings
+BATCH=
EXACT=
MAJOR=
NOCOLOUR=
@@ -40,6 +41,7 @@ usage() {
X 'all': rebuild all packages that have
X byte-compiled Elisp files
X (default: sitedir,rebuild)
+ X -b, --batch batch mode, don't ask any questions
X -e, --exact match exact versions when remerging packages
X -m, --major use only the major version when comparing
X Emacs version numbers
@@ -102,8 +104,8 @@ pm_auto() {
}
# Read in all command-line options and force English output
-OPTIONS=$(LC_ALL=C getopt -o a:ehmnopP: \
- --long action:,exact,help,major,nocolour,nocolor,orphans,pretend \
+OPTIONS=$(LC_ALL=C getopt -o a:behmnopP: \
+ --long action:,batch,exact,help,major,nocolour,nocolor,orphans,pretend \
--long package-manager:,package-manager-command:,version \
-n 'emacs-updater' -- "$@")
[ $? -eq 0 ] || usage 1
@@ -115,6 +117,7 @@ do
case "${1}" in
-h|--help) usage 0 ;;
--version) version ;;
+ -b|--batch) BATCH="true"; shift ;;
-e|--exact) EXACT="true"; shift ;;
-m|--major) MAJOR="true"; shift ;;
-o|--orphans) ORPHANS="true"; shift ;;
@@ -303,16 +306,17 @@ if [ "${PRETEND}" -o "${ORPHANS}" ]; then
fi
echo
-echo -n "${BOLD}Remerge packages?${NORMAL} [${GREEN}Yes${NORMAL}/${RED}No${NORMAL}] "
-read choice
-echo
-case "${choice}" in
- y*|Y*|"")
- ;;
- *)
- warning "Quitting."
- exit 10 ;;
-esac
+if [ "${BATCH}" ]; then
+ message "Remerging packages ..."
+else
+ echo -n "${BOLD}Remerge packages?${NORMAL} [${GREEN}Yes${NORMAL}/${RED}No${NORMAL}] "
+ read choice
+ echo
+ case "${choice}" in
+ y*|Y*|"") ;;
+ *) warning "Quitting."; exit 10 ;;
+ esac
+fi
${PM_COMMAND} "${PM_EXTRAOPTS[@]}" $(<"${PKGFILE}")
diff --git a/emacs-updater.8 b/emacs-updater.8
index f368662..0a033db 100644
--- a/emacs-updater.8
+++ b/emacs-updater.8
@@ -30,6 +30,9 @@ Rebuild all packages that have byte-compiled Elisp files.
.BR sitedir ,
.BR rebuild )
.TP
+.B -b, --batch
+Batch mode, don't ask the user any questions.
+.TP
.B -e, --exact
Match exact versions when remerging packages.
.TP