Nathan Phillip Brink committed c208bd2

Add option -y (--noask) which causes a commit to occur without prompting the user.

Requested by floppym.

Comments (0)

Files changed (2)

 Enable verbose output. Useful mostly for debugging.
+.IP "\fB-y\fP, \fB--noask\fP"
+Do not ask for the user to confirm the commit. Assume that the user
+would type `\fIyes\fP' to any question. This allows the commit to be
+performed non-interactively.
 .IP "\fB-?\fP, \fB-h\fP, \fB--help\fP"
 Print a short help message and exit.
 	-m, --noformat		do not prepend the commit message with package names,
 	-q, --quiet		backwards compat (ignored),
 	-t, --trivial		trivial changes (do not add a ChangeLog entry),
-	-v, --verbose		enable verbose output.
+	-v, --verbose		enable verbose output,
+	-y, --noask		do not ask before committing (avoid interactivity).
 # Request confirmation before committing. Abort if it is not granted.
 confirm() {
+	${SC_NOASK+return}
 	while true; do
 		local answ
 		printf '\n%s' "${WHITE}Commit changes?${RESET} [${BGREEN}Yes${RESET}/${RED}No${RESET}] ${GREEN}" >&2
 main() {
 	local no_check_spelling commitmsg force monochrome noprepend noupdate \
 		trivial print_diff
 	# Command-line parsing.
 	while [ ${#} -gt 0 ]; do
+			-y|--noask)
+				SC_NOASK=
+				;;
 			sayv "Now, let's let repoman do its job..."
-			exec repoman commit ${old_repoman--a} ${force+-f} -m "${noprepend-${SC_CP}: }${commitmsg}"
+			exec repoman commit ${old_repoman-${SC_NOASK--a}} ${force+-f} -m "${noprepend-${SC_CP}: }${commitmsg}"
 		# Clean removal of a package set.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.