From 77b078b01f0a0262f5f0abe61ca73cd981fcd506 Mon Sep 17 00:00:00 2001 From: Evan Martin Date: Mon, 13 Aug 2012 11:39:32 -0700 Subject: rename -V to --version and clean up --help output --- src/ninja.cc | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/ninja.cc b/src/ninja.cc index b645b90..00bd104 100644 --- a/src/ninja.cc +++ b/src/ninja.cc @@ -77,14 +77,12 @@ void Usage(const BuildConfig& config) { "usage: ninja [options] [targets...]\n" "\n" "if targets are unspecified, builds the 'default' target (see manual).\n" -"targets are paths, with additional special syntax:\n" -" 'target^' means 'the first output that uses target'.\n" -" example: 'ninja foo.cc^' will likely build foo.o.\n" "\n" "options:\n" +" --version print ninja version (\"%s\")\n" +"\n" " -C DIR change to DIR before doing anything else\n" " -f FILE specify input build file [default=build.ninja]\n" -" -V print ninja version (\"%s\")\n" "\n" " -j N run N jobs in parallel [default=%d]\n" " -l N do not start new jobs if the load average is greater than N\n" @@ -92,13 +90,12 @@ void Usage(const BuildConfig& config) { " (not yet implemented on Windows)\n" #endif " -k N keep going until N jobs fail [default=1]\n" -" -n dry run (don't run commands but pretend they succeeded)\n" +" -n dry run (don't run commands but act like they succeeded)\n" " -v show all command lines while building\n" "\n" " -d MODE enable debugging (use -d list to list modes)\n" -" -t TOOL run a subtool\n" -" use '-t list' to list subtools.\n" -" terminates toplevel options; further flags are passed to the tool.\n", +" -t TOOL run a subtool (use -t list to list subtools)\n" +" terminates toplevel options; further flags are passed to the tool\n", kVersion, config.parallelism); } @@ -649,8 +646,10 @@ int NinjaMain(int argc, char** argv) { globals.config.parallelism = GuessParallelism(); + enum { OPT_VERSION = 1 }; const option kLongOptions[] = { { "help", no_argument, NULL, 'h' }, + { "version", no_argument, NULL, OPT_VERSION }, { NULL, 0, NULL, 0 } }; @@ -701,7 +700,7 @@ int NinjaMain(int argc, char** argv) { case 'C': working_dir = optarg; break; - case 'V': + case OPT_VERSION: printf("%s\n", kVersion); return 0; case 'h': -- cgit v0.12