mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 06:07:59 +01:00
Add -pentadactyl-remote command-line flag and CommandOption.STRINGMAP type.
--HG-- extra : rebase_source : a306ad6e8c2d019b92a6ff58414eb3ff8ab149b9
This commit is contained in:
@@ -40,8 +40,26 @@ CommandLineHandler.prototype = {
|
|||||||
QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsICommandLineHandler]),
|
QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsICommandLineHandler]),
|
||||||
|
|
||||||
handle: function (commandLine) {
|
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 {
|
try {
|
||||||
this.optionValue = commandLine.handleFlagWithParam(config.name, false);
|
this.optionValue = commandLine.handleFlagWithParam(config.name, false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ var MOW = Module("mow", {
|
|||||||
this.messages.push(data);
|
this.messages.push(data);
|
||||||
}
|
}
|
||||||
else {
|
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>;
|
this.lastOutput = <div class="ex-command-output" style={"white-space: " + style} highlight={highlightGroup}>{data}</div>;
|
||||||
|
|
||||||
var output = util.xmlToDom(this.lastOutput, this.document);
|
var output = util.xmlToDom(this.lastOutput, this.document);
|
||||||
|
|||||||
@@ -236,6 +236,7 @@ mow.contextMenu.selectAll = Select All
|
|||||||
|
|
||||||
option.noSuch = No such option
|
option.noSuch = No such option
|
||||||
option.noSuch-1 = No such option: %S
|
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.replaceExisting-1 = Warning: %S already exists: replacing existing option
|
||||||
option.intRequired = Integer value required
|
option.intRequired = Integer value required
|
||||||
option.operatorNotSupported-2 = Operator %S not supported for option type %S
|
option.operatorNotSupported-2 = Operator %S not supported for option type %S
|
||||||
|
|||||||
@@ -15,11 +15,16 @@
|
|||||||
<h2 tag="startup-options">Command-line options</h2>
|
<h2 tag="startup-options">Command-line options</h2>
|
||||||
|
|
||||||
<p>
|
<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.
|
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>
|
E.g., <tt>&dactyl.hostbin; -&dactyl.name; <str><t>++cmd</t> 'set exrc' <t>+u</t> 'tempRcFile' <t>++noplugin</t></str></tt>
|
||||||
</p>
|
</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>
|
<item>
|
||||||
<tags>+c</tags>
|
<tags>+c</tags>
|
||||||
<strut/>
|
<strut/>
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ defineModule("commands", {
|
|||||||
* @property {number} type The option's value type. This is one of:
|
* @property {number} type The option's value type. This is one of:
|
||||||
* (@link CommandOption.NOARG),
|
* (@link CommandOption.NOARG),
|
||||||
* (@link CommandOption.STRING),
|
* (@link CommandOption.STRING),
|
||||||
|
* (@link CommandOption.STRINGMAP),
|
||||||
* (@link CommandOption.BOOL),
|
* (@link CommandOption.BOOL),
|
||||||
* (@link CommandOption.INT),
|
* (@link CommandOption.INT),
|
||||||
* (@link CommandOption.FLOAT),
|
* (@link CommandOption.FLOAT),
|
||||||
@@ -72,6 +73,11 @@ update(CommandOption, {
|
|||||||
* @final
|
* @final
|
||||||
*/
|
*/
|
||||||
STRING: ArgType("string", function (val) val),
|
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.
|
* @property {object} The option accepts an integer argument.
|
||||||
* @final
|
* @final
|
||||||
@@ -765,7 +771,7 @@ var Commands = Module("commands", {
|
|||||||
let str = args.literalArg;
|
let str = args.literalArg;
|
||||||
if (str)
|
if (str)
|
||||||
res.push(!/\n/.test(str) ? 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(/.$/, "\\")));
|
: String.replace(str, /\n/g, "\n" + res[0].replace(/./g, " ").replace(/.$/, "\\")));
|
||||||
return res.join(" ");
|
return res.join(" ");
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -516,8 +516,11 @@ var Contexts = Module("contexts", {
|
|||||||
group.args = args["-args"];
|
group.args = args["-args"];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.context)
|
if (args.context) {
|
||||||
args.context.group = group;
|
args.context.group = group;
|
||||||
|
if (args.context.context)
|
||||||
|
args.context.context.group = group;
|
||||||
|
}
|
||||||
|
|
||||||
util.assert(!group.builtin ||
|
util.assert(!group.builtin ||
|
||||||
!["-description", "-locations", "-nopersist"]
|
!["-description", "-locations", "-nopersist"]
|
||||||
|
|||||||
@@ -853,6 +853,9 @@ var Options = Module("options", {
|
|||||||
*/
|
*/
|
||||||
add: function add(names, description, type, defaultValue, extraInfo) {
|
add: function add(names, description, type, defaultValue, extraInfo) {
|
||||||
const self = this;
|
const self = this;
|
||||||
|
util.assert(type in Option.types,
|
||||||
|
_("option.noSuchType", type),
|
||||||
|
true);
|
||||||
|
|
||||||
if (!extraInfo)
|
if (!extraInfo)
|
||||||
extraInfo = {};
|
extraInfo = {};
|
||||||
|
|||||||
@@ -71,6 +71,7 @@
|
|||||||
editing input fields with i_<C-i>. See :h 'editor'. [b4]
|
editing input fields with i_<C-i>. See :h 'editor'. [b4]
|
||||||
• Improved [macro-string] support, including automatic elision
|
• Improved [macro-string] support, including automatic elision
|
||||||
of optional elements, and array subscripts. [b4][b7]
|
of optional elements, and array subscripts. [b4][b7]
|
||||||
|
• Add -pentadactyl-remote command-line option. [b8]
|
||||||
• Improvements to marks:
|
• Improvements to marks:
|
||||||
- Marks are now stored as line and column ordinals rather than percentages. [b8]
|
- 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]
|
- Marks now store the marked element and ensure its visibility when followed. [b8]
|
||||||
|
|||||||
Reference in New Issue
Block a user