diff options
-rw-r--r-- | common/components/commandline-handler.js | 20 | ||||
-rw-r--r-- | common/content/mow.js | 2 | ||||
-rw-r--r-- | common/locale/en-US/messages.properties | 1 | ||||
-rw-r--r-- | common/locale/en-US/starting.xml | 7 | ||||
-rw-r--r-- | common/modules/commands.jsm | 8 | ||||
-rw-r--r-- | common/modules/contexts.jsm | 5 | ||||
-rw-r--r-- | common/modules/options.jsm | 3 | ||||
-rw-r--r-- | pentadactyl/NEWS | 1 |
8 files changed, 42 insertions, 5 deletions
diff --git a/common/components/commandline-handler.js b/common/components/commandline-handler.js index 918d7bf3..e4362d97 100644 --- a/common/components/commandline-handler.js +++ b/common/components/commandline-handler.js @@ -40,8 +40,26 @@ CommandLineHandler.prototype = { QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsICommandLineHandler]), handle: function (commandLine) { + try { + var remote = commandLine.handleFlagWithParam(config.name + "-remote", false); + } + catch (e) { + util.dump("option '-" + config.name + "-remote' requires an argument\n"); + } + + try { + if (remote) { + commandLine.preventDefault = true; + require(global, "services"); + let win = services.windowMediator.getMostRecentWindow("navigator:browser"); + if (win && win.dactyl) + win.dactyl.execute(remote); + } + } + catch(e) { + util.reportError(e) + }; - // TODO: handle remote launches differently? try { this.optionValue = commandLine.handleFlagWithParam(config.name, false); } diff --git a/common/content/mow.js b/common/content/mow.js index 5c7a28c6..bd055746 100644 --- a/common/content/mow.js +++ b/common/content/mow.js @@ -135,7 +135,7 @@ var MOW = Module("mow", { this.messages.push(data); } else { - let style = isString(data) ? "pre" : "nowrap"; + let style = isString(data) ? "pre-wrap" : "nowrap"; this.lastOutput = <div class="ex-command-output" style={"white-space: " + style} highlight={highlightGroup}>{data}</div>; var output = util.xmlToDom(this.lastOutput, this.document); diff --git a/common/locale/en-US/messages.properties b/common/locale/en-US/messages.properties index e9c29911..2c373047 100644 --- a/common/locale/en-US/messages.properties +++ b/common/locale/en-US/messages.properties @@ -236,6 +236,7 @@ mow.contextMenu.selectAll = Select All option.noSuch = No such option option.noSuch-1 = No such option: %S +option.noSuchType-1 = No such option type: %S option.replaceExisting-1 = Warning: %S already exists: replacing existing option option.intRequired = Integer value required option.operatorNotSupported-2 = Operator %S not supported for option type %S diff --git a/common/locale/en-US/starting.xml b/common/locale/en-US/starting.xml index 38935504..39e1c40e 100644 --- a/common/locale/en-US/starting.xml +++ b/common/locale/en-US/starting.xml @@ -15,11 +15,16 @@ <h2 tag="startup-options">Command-line options</h2> <p> - Command-line options can be passed to &dactyl.appName; via the -&dactyl.name; &dactyl.host; + Command-line options can be passed to &dactyl.appName; via the <em>-&dactyl.name;</em> &dactyl.host; option. These are passed as single string argument. E.g., <tt>&dactyl.hostbin; -&dactyl.name; <str><t>++cmd</t> 'set exrc' <t>+u</t> 'tempRcFile' <t>++noplugin</t></str></tt> </p> +<p> + The <em>-&dactyl.name;-remote</em> command-line option can be used to + execute a single Ex command in an already running Pentadactyl instance. +</p> + <item> <tags>+c</tags> <strut/> diff --git a/common/modules/commands.jsm b/common/modules/commands.jsm index 206dc902..95d4b2eb 100644 --- a/common/modules/commands.jsm +++ b/common/modules/commands.jsm @@ -26,6 +26,7 @@ defineModule("commands", { * @property {number} type The option's value type. This is one of: * (@link CommandOption.NOARG), * (@link CommandOption.STRING), + * (@link CommandOption.STRINGMAP), * (@link CommandOption.BOOL), * (@link CommandOption.INT), * (@link CommandOption.FLOAT), @@ -73,6 +74,11 @@ update(CommandOption, { */ STRING: ArgType("string", function (val) val), /** + * @property {object} The option accepts a stringmap argument. + * @final + */ + STRINGMAP: ArgType("stringmap", function (val, quoted) Option.parse.stringmap(quoted)), + /** * @property {object} The option accepts an integer argument. * @final */ @@ -765,7 +771,7 @@ var Commands = Module("commands", { let str = args.literalArg; if (str) res.push(!/\n/.test(str) ? str : - this.hereDoc && false ? "<<EOF\n" + String.replace(str, /\n$/, "") + "\nEOF" + this.serializeHereDoc ? "<<EOF\n" + String.replace(str, /\n$/, "") + "\nEOF" : String.replace(str, /\n/g, "\n" + res[0].replace(/./g, " ").replace(/.$/, "\\"))); return res.join(" "); }, diff --git a/common/modules/contexts.jsm b/common/modules/contexts.jsm index d7b8d7d9..9dad270b 100644 --- a/common/modules/contexts.jsm +++ b/common/modules/contexts.jsm @@ -516,8 +516,11 @@ var Contexts = Module("contexts", { group.args = args["-args"]; } - if (args.context) + if (args.context) { args.context.group = group; + if (args.context.context) + args.context.context.group = group; + } util.assert(!group.builtin || !["-description", "-locations", "-nopersist"] diff --git a/common/modules/options.jsm b/common/modules/options.jsm index b7545ec7..5b0a398b 100644 --- a/common/modules/options.jsm +++ b/common/modules/options.jsm @@ -853,6 +853,9 @@ var Options = Module("options", { */ add: function add(names, description, type, defaultValue, extraInfo) { const self = this; + util.assert(type in Option.types, + _("option.noSuchType", type), + true); if (!extraInfo) extraInfo = {}; diff --git a/pentadactyl/NEWS b/pentadactyl/NEWS index 7270e29b..dc3a1b37 100644 --- a/pentadactyl/NEWS +++ b/pentadactyl/NEWS @@ -71,6 +71,7 @@ editing input fields with i_<C-i>. See :h 'editor'. [b4] • Improved [macro-string] support, including automatic elision of optional elements, and array subscripts. [b4][b7] + • Add -pentadactyl-remote command-line option. [b8] • Improvements to marks: - Marks are now stored as line and column ordinals rather than percentages. [b8] - Marks now store the marked element and ensure its visibility when followed. [b8] |