1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-04 04:44:20 +01:00

Add -pentadactyl-remote command-line flag and CommandOption.STRINGMAP type.

--HG--
extra : rebase_source : a306ad6e8c2d019b92a6ff58414eb3ff8ab149b9
This commit is contained in:
Kris Maglione
2011-08-12 17:27:46 -04:00
parent 0bcba9fb23
commit 5e86f4ed93
8 changed files with 42 additions and 5 deletions

View File

@@ -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(" ");
},