review: add -n flag to show commands without running them

Change-Id: Id38ca5deeb72ee53f3a62c6a925e66f065686b83
diff --git a/review.go b/review.go
index 9b4f4eb..e86f7fc 100644
--- a/review.go
+++ b/review.go
@@ -28,13 +28,14 @@
 var (
 	hookFile = filepath.FromSlash(".git/hooks/commit-msg")
 	verbose  = flag.Bool("v", false, "verbose output")
+	noRun    = flag.Bool("n", false, "print but do not run commands")
 )
 
-const usage = `Usage: %s [-v] <command>
+const usage = `Usage: %s [-n] [-v] <command>
 Type "%s help" for more information.
 `
 
-const help = `Usage: %s [-v] <command>
+const help = `Usage: %s [-n] [-v] <command>
 
 The review command is a wrapper for the git command that provides a simple
 interface to the "single-commit feature branch" development model.
@@ -347,9 +348,12 @@
 }
 
 func runErr(command string, args ...string) error {
-	if *verbose {
+	if *verbose || *noRun {
 		fmt.Fprintln(os.Stderr, commandString(command, args))
 	}
+	if *noRun {
+		return nil
+	}
 	cmd := exec.Command(command, args...)
 	cmd.Stdin = os.Stdin
 	cmd.Stdout = os.Stdout