1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 07:28:00 +01:00

Fix using :command from the command line. Closes issue #67.

This commit is contained in:
Kris Maglione
2010-10-12 13:41:01 -04:00
parent 6907ae130e
commit 2e3f47b19e
4 changed files with 10 additions and 8 deletions

View File

@@ -426,6 +426,7 @@ const Commands = Module("commands", {
*/
execute: function (string, tokens, silent, args, sourcing) {
io.withSavedValues(["readHeredoc", "sourcing"], function () {
sourcing = sourcing || { file: "[Command Line]", line: 1 };
this.sourcing = update({}, sourcing);
args = update({ setFrom: this.sourcing.file }, args || {});
@@ -460,9 +461,13 @@ const Commands = Module("commands", {
dactyl.execute(line, args);
}
catch (e) {
if (!silent) {
dactyl.echoerr("Error detected while processing " + this.sourcing.file);
dactyl.echomsg("line\t" + this.sourcing.line + ":");
if (!silent || silent === "loud") {
if (silent !== "loud")
e.message = this.sourcing.file + ":" + this.sourcing.line + ": " + e.message;
else {
dactyl.echoerr("Error detected while processing " + this.sourcing.file);
dactyl.echomsg("line\t" + this.sourcing.line + ":");
}
dactyl.reportError(e, true);
}
}