mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-03-23 08:23:32 +01:00
Add -pentadactyl-remote command-line flag and CommandOption.STRINGMAP type.
--HG-- extra : rebase_source : a306ad6e8c2d019b92a6ff58414eb3ff8ab149b9
This commit is contained in:
@@ -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),
|
||||
@@ -72,6 +73,11 @@ update(CommandOption, {
|
||||
* @final
|
||||
*/
|
||||
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(" ");
|
||||
},
|
||||
|
||||
@@ -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"]
|
||||
|
||||
@@ -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 = {};
|
||||
|
||||
Reference in New Issue
Block a user