зеркало из 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}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче