зеркало из https://github.com/mozilla/pjs.git
Fix bug 274311: Can you add all of the shell commands to the help() menu?
Patch from Roshan James <roshanj@google.com>.
This commit is contained in:
Родитель
dc21b18581
Коммит
fc308affdb
|
@ -53,16 +53,18 @@ msg.no-opt =\
|
|||
to compile to class files.
|
||||
|
||||
msg.shell.usage =\
|
||||
Didn''t understand "{0}". \n\
|
||||
Valid arguments are:\n\
|
||||
\ -w\n\
|
||||
Usage: java {0} [options...] [files]\n\
|
||||
Valid options are:\n\
|
||||
\ -?, -help Displays help messages.\n\
|
||||
\ -w Enable warnings.\n\
|
||||
\ -version 100|110|120|130|140|150|160\n\
|
||||
\ -opt [-1|0-9]\n\
|
||||
\ -f script-filename\n\
|
||||
\ -e script-source\n\
|
||||
\ -debug\n\
|
||||
\ -strict\n\
|
||||
\ -fatal-warnings
|
||||
\ Set a specific language version.\n\
|
||||
\ -opt [-1|0-9] Set optimization level.\n\
|
||||
\ -f script-filename Execute script file.\n\
|
||||
\ -e script-source Evaluate inline script.\n\
|
||||
\ -debug Generate debug code.\n\
|
||||
\ -strict Enable strict mode warnings.\n\
|
||||
\ -fatal-warnings Treat warnings as errors.
|
||||
|
||||
|
||||
msg.help =\
|
||||
|
@ -81,11 +83,28 @@ msg.help =\
|
|||
print([expr ...]) Evaluate and print expressions. \n\
|
||||
quit() Quit the shell. \n\
|
||||
version([number]) Get or set the JavaScript version number. \n\
|
||||
gc() Runs the garbage collector.\n\
|
||||
spawn(arg) Evaluate function or scriptname on a new thread \n\
|
||||
sync(function) Creates a synchronized version of the function, \n\
|
||||
\ where the synchronization object is "this" \n\
|
||||
readFile(fileName [, encoding])\n\
|
||||
\ Returns the content of the file as a string. \n\
|
||||
\ Encoding of the string can be optionally specified. \n\
|
||||
readUrl(url [, encoding]) \n\
|
||||
\ Similar to readFile, reads the contents of the url.\n\
|
||||
runCommand(name ...) Runs a specified shell command. Additional arguments are \n\
|
||||
\ passed to the command \n\
|
||||
seal(args ...) Seals the supplied objects \n\
|
||||
toint32(arg) Converts the argument into a 32-bit integer \n\
|
||||
serialize(obj, fileName) \n\
|
||||
\ Serializes an object and saves it to a file \n\
|
||||
deserialise(fileName) Reconstructs a serialized object \n\
|
||||
environment Returns the current environment object \n\
|
||||
history Displays the shell command history \n\
|
||||
\n\
|
||||
For full description of all available commands see shell.html in\n\
|
||||
the docs directory of Rhino distribution.\n\
|
||||
|
||||
|
||||
msg.warning =\
|
||||
warning: {0}
|
||||
|
||||
|
@ -118,16 +137,16 @@ Valid options are: \n\
|
|||
\ -debug, -g Include debug information.\n\
|
||||
\ -nosource Do not include source to function objects.\n\
|
||||
\ It makes f.toString() useless and violates ECMAScript\n\
|
||||
\ standard but makes generated classes smaller and\n\
|
||||
\ saves memory.\n\
|
||||
\ standard but makes generated classes smaller and\n\
|
||||
\ saves memory.\n\
|
||||
\ -o CLASSNAME Use specified name as the last component of the main\n\
|
||||
\ generated class name. When specified, only one script\n\
|
||||
\ SOURCE is allowed. If omitted, it defaults to source\n\
|
||||
\ name with stripped .js suffix.\n\
|
||||
\ SOURCE is allowed. If omitted, it defaults to source\n\
|
||||
\ name with stripped .js suffix.\n\
|
||||
\ -package PACKAHGE Place generated classes in the specified package.\n\
|
||||
\ -d DIRECTORY Use DIRECTORY as destination directory for generated\n\
|
||||
\ classes. If omitted, it defaults to parent directory\n\
|
||||
\ of SOURCE.\n\
|
||||
\ of SOURCE.\n\
|
||||
\ -extends CLASS The main generated class will extend the specified\n\
|
||||
\ class CLASS.\n\
|
||||
\ -implements INTERFACE1,INTERFACE2,... The main generated class will\n\
|
||||
|
|
|
@ -571,7 +571,7 @@ public class Global extends ImporterTopLevel
|
|||
}
|
||||
|
||||
/**
|
||||
* The readFile reads the given file context and convert it to a string
|
||||
* The readFile reads the given file content and convert it to a string
|
||||
* using the specified character coding or default character coding if
|
||||
* explicit coding argument is not given.
|
||||
* <p>
|
||||
|
|
|
@ -289,12 +289,21 @@ public class Main
|
|||
shellContextFactory.setGeneratingDebug(true);
|
||||
continue;
|
||||
}
|
||||
if (arg.equals("-?") ||
|
||||
arg.equals("-help")) {
|
||||
// print usage message
|
||||
global.getOut().println(
|
||||
ToolErrorReporter.getMessage("msg.shell.usage", Main.class.getName()));
|
||||
System.exit(1);
|
||||
}
|
||||
usageError = arg;
|
||||
break goodUsage;
|
||||
}
|
||||
// print usage message
|
||||
// print error and usage message
|
||||
global.getOut().println(
|
||||
ToolErrorReporter.getMessage("msg.shell.usage", usageError));
|
||||
ToolErrorReporter.getMessage("msg.shell.invalid", usageError));
|
||||
global.getOut().println(
|
||||
ToolErrorReporter.getMessage("msg.shell.usage", Main.class.getName()));
|
||||
System.exit(1);
|
||||
return null;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче