Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Unified Diff: src/flags.cc

Issue 9420: Adds a --help option and usage message listing all flags to V8. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 12 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/flag-definitions.h ('k') | src/mksnapshot.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/flags.cc
===================================================================
--- src/flags.cc (revision 701)
+++ src/flags.cc (working copy)
@@ -317,7 +317,8 @@
// sense there.
continue;
} else {
- fprintf(stderr, "Error: unrecognized flag %s\n", arg);
+ fprintf(stderr, "Error: unrecognized flag %s\n"
+ "Try --help for options\n", arg);
return j;
}
}
@@ -327,7 +328,8 @@
if (i < *argc) {
value = argv[i++];
} else {
- fprintf(stderr, "Error: missing value for flag %s of type %s\n",
+ fprintf(stderr, "Error: missing value for flag %s of type %s\n"
+ "Try --help for options\n",
arg, Type2String(flag->type()));
return j;
}
@@ -354,7 +356,8 @@
if ((flag->type() == Flag::TYPE_BOOL && value != NULL) ||
(flag->type() != Flag::TYPE_BOOL && is_bool) ||
*endp != '\0') {
- fprintf(stderr, "Error: illegal value for flag %s of type %s\n",
+ fprintf(stderr, "Error: illegal value for flag %s of type %s\n"
+ "Try --help for options\n",
arg, Type2String(flag->type()));
return j;
}
@@ -376,6 +379,9 @@
*argc = j;
}
+ if (FLAG_help) {
+ PrintHelp();
+ }
// parsed all flags successfully
return 0;
}
@@ -447,10 +453,22 @@
// static
void FlagList::PrintHelp() {
+ printf("Usage:\n");
+ printf(" shell [options] -e string\n");
+ printf(" execute string in V8\n");
+ printf(" shell [options] file1 file2 ... filek\n");
+ printf(" run JavaScript scripts in file1, file2, ..., filek\n");
+ printf(" shell [options]\n");
+ printf(" shell [options] --shell\n");
+ printf(" run an interactive JavaScript shell");
+ printf(" d8 [options] file\n");
+ printf(" d8 [options]\n");
+ printf(" run the new debugging shell\n\n");
+ printf("Options:\n");
for (size_t i = 0; i < num_flags; ++i) {
Flag* f = &flags[i];
char* value = ToString(f);
- printf(" --%s (%s) type: %s default: %s\n",
+ printf(" --%s (%s)\n type: %s default: %s\n",
f->name(), f->comment(), Type2String(f->type()), value);
DeleteArray(value);
}
« no previous file with comments | « src/flag-definitions.h ('k') | src/mksnapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698