change command format to move request to being an implementation detail
This commit is contained in:
parent
d80f0fe66e
commit
2d43ddd047
3 changed files with 59 additions and 59 deletions
|
|
@ -59,7 +59,7 @@ require(deps, function() {
|
|||
var env = require("ace/environment").create();
|
||||
catalog.startupPlugins({ env: env }).then(function() {
|
||||
var gcli = require("cockpit/index");
|
||||
new gcli.CliView(env);
|
||||
new gcli.CliView({ env: env });
|
||||
|
||||
require("demo/demo").launch(env);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -57,18 +57,18 @@ function bindKey(win, mac) {
|
|||
exports.startup = function() {
|
||||
gcli.addCommand({
|
||||
name: "null",
|
||||
exec: function(env, args, request) { }
|
||||
exec: function(env, args) { }
|
||||
});
|
||||
|
||||
gcli.addCommand({
|
||||
name: "selectall",
|
||||
bindKey: bindKey("Ctrl-A", "Command-A"),
|
||||
exec: function(env, args, request) { env.editor.selectAll(); }
|
||||
exec: function(env, args) { env.editor.selectAll(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "removeline",
|
||||
bindKey: bindKey("Ctrl-D", "Command-D"),
|
||||
exec: function(env, args, request) { env.editor.removeLines(); }
|
||||
exec: function(env, args) { env.editor.removeLines(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "gotoline",
|
||||
|
|
@ -77,7 +77,7 @@ exports.startup = function() {
|
|||
params: [
|
||||
{ name: "line", type: "number", description: "The line number to jump to" }
|
||||
],
|
||||
exec: function(env, args, request) {
|
||||
exec: function(env, args) {
|
||||
// TODO: manual params should not be needed
|
||||
if (!args.line) {
|
||||
while (!isNaN(args.line)) {
|
||||
|
|
@ -90,17 +90,17 @@ exports.startup = function() {
|
|||
gcli.addCommand({
|
||||
name: "togglecomment",
|
||||
bindKey: bindKey("Ctrl-7", "Command-7"),
|
||||
exec: function(env, args, request) { env.editor.toggleCommentLines(); }
|
||||
exec: function(env, args) { env.editor.toggleCommentLines(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "findnext",
|
||||
bindKey: bindKey("Ctrl-K", "Command-G"),
|
||||
exec: function(env, args, request) { env.editor.findNext(); }
|
||||
exec: function(env, args) { env.editor.findNext(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "findprevious",
|
||||
bindKey: bindKey("Ctrl-Shift-K", "Command-Shift-G"),
|
||||
exec: function(env, args, request) { env.editor.findPrevious(); }
|
||||
exec: function(env, args) { env.editor.findPrevious(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "find",
|
||||
|
|
@ -109,7 +109,7 @@ exports.startup = function() {
|
|||
params: [
|
||||
{ name: "findWhat", type: "string", description: "The text to search for" }
|
||||
],
|
||||
exec: function(env, args, request) {
|
||||
exec: function(env, args) {
|
||||
// TODO: manual params should not be needed
|
||||
if (!args.findWhat) {
|
||||
args.findWhat = prompt("Find:");
|
||||
|
|
@ -125,7 +125,7 @@ exports.startup = function() {
|
|||
{ name: "findWhat", type: "string", description: "The text to search for" },
|
||||
{ name: "replacement", type: "string", description: "The replacement text" }
|
||||
],
|
||||
exec: function(env, args, request) {
|
||||
exec: function(env, args) {
|
||||
// TODO: manual params should not be needed
|
||||
if (!args.findWhat) {
|
||||
args.findWhat = prompt("Find:");
|
||||
|
|
@ -148,7 +148,7 @@ exports.startup = function() {
|
|||
{ name: "findWhat", type: "string", description: "The text to search for" },
|
||||
{ name: "replacement", type: "string", description: "The replacement text" }
|
||||
],
|
||||
exec: function(env, args, request) {
|
||||
exec: function(env, args) {
|
||||
// TODO: manual params should not be needed
|
||||
if (!args.findWhat) {
|
||||
args.findWhat = prompt("Find:");
|
||||
|
|
@ -166,182 +166,182 @@ exports.startup = function() {
|
|||
gcli.addCommand({
|
||||
name: "undo",
|
||||
bindKey: bindKey("Ctrl-Z", "Command-Z"),
|
||||
exec: function(env, args, request) { env.editor.undo(); }
|
||||
exec: function(env, args) { env.editor.undo(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "redo",
|
||||
bindKey: bindKey("Ctrl-Shift-Z|Ctrl-Y", "Command-Shift-Z|Command-Y"),
|
||||
exec: function(env, args, request) { env.editor.redo(); }
|
||||
exec: function(env, args) { env.editor.redo(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "overwrite",
|
||||
bindKey: bindKey("Insert", "Insert"),
|
||||
exec: function(env, args, request) { env.editor.toggleOverwrite(); }
|
||||
exec: function(env, args) { env.editor.toggleOverwrite(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "copylinesup",
|
||||
bindKey: bindKey("Ctrl-Alt-Up", "Command-Option-Up"),
|
||||
exec: function(env, args, request) { env.editor.copyLinesUp(); }
|
||||
exec: function(env, args) { env.editor.copyLinesUp(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "movelinesup",
|
||||
bindKey: bindKey("Alt-Up", "Option-Up"),
|
||||
exec: function(env, args, request) { env.editor.moveLinesUp(); }
|
||||
exec: function(env, args) { env.editor.moveLinesUp(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "selecttostart",
|
||||
bindKey: bindKey("Alt-Shift-Up", "Command-Shift-Up"),
|
||||
exec: function(env, args, request) { env.editor.getSelection().selectFileStart(); }
|
||||
exec: function(env, args) { env.editor.getSelection().selectFileStart(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "gotostart",
|
||||
bindKey: bindKey("Ctrl-Home|Ctrl-Up", "Command-Home|Command-Up"),
|
||||
exec: function(env, args, request) { env.editor.navigateFileStart(); }
|
||||
exec: function(env, args) { env.editor.navigateFileStart(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "selectup",
|
||||
bindKey: bindKey("Shift-Up", "Shift-Up"),
|
||||
exec: function(env, args, request) { env.editor.getSelection().selectUp(); }
|
||||
exec: function(env, args) { env.editor.getSelection().selectUp(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "golineup",
|
||||
bindKey: bindKey("Up", "Up|Ctrl-P"),
|
||||
exec: function(env, args, request) { env.editor.navigateUp(args.times); }
|
||||
exec: function(env, args) { env.editor.navigateUp(args.times); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "copylinesdown",
|
||||
bindKey: bindKey("Ctrl-Alt-Down", "Command-Option-Down"),
|
||||
exec: function(env, args, request) { env.editor.copyLinesDown(); }
|
||||
exec: function(env, args) { env.editor.copyLinesDown(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "movelinesdown",
|
||||
bindKey: bindKey("Alt-Down", "Option-Down"),
|
||||
exec: function(env, args, request) { env.editor.moveLinesDown(); }
|
||||
exec: function(env, args) { env.editor.moveLinesDown(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "selecttoend",
|
||||
bindKey: bindKey("Alt-Shift-Down", "Command-Shift-Down"),
|
||||
exec: function(env, args, request) { env.editor.getSelection().selectFileEnd(); }
|
||||
exec: function(env, args) { env.editor.getSelection().selectFileEnd(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "gotoend",
|
||||
bindKey: bindKey("Ctrl-End|Ctrl-Down", "Command-End|Command-Down"),
|
||||
exec: function(env, args, request) { env.editor.navigateFileEnd(); }
|
||||
exec: function(env, args) { env.editor.navigateFileEnd(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "selectdown",
|
||||
bindKey: bindKey("Shift-Down", "Shift-Down"),
|
||||
exec: function(env, args, request) { env.editor.getSelection().selectDown(); }
|
||||
exec: function(env, args) { env.editor.getSelection().selectDown(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "golinedown",
|
||||
bindKey: bindKey("Down", "Down|Ctrl-N"),
|
||||
exec: function(env, args, request) { env.editor.navigateDown(args.times); }
|
||||
exec: function(env, args) { env.editor.navigateDown(args.times); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "selectwordleft",
|
||||
bindKey: bindKey("Ctrl-Shift-Left", "Option-Shift-Left"),
|
||||
exec: function(env, args, request) { env.editor.getSelection().selectWordLeft(); }
|
||||
exec: function(env, args) { env.editor.getSelection().selectWordLeft(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "gotowordleft",
|
||||
bindKey: bindKey("Ctrl-Left", "Option-Left"),
|
||||
exec: function(env, args, request) { env.editor.navigateWordLeft(); }
|
||||
exec: function(env, args) { env.editor.navigateWordLeft(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "selecttolinestart",
|
||||
bindKey: bindKey("Alt-Shift-Left", "Command-Shift-Left"),
|
||||
exec: function(env, args, request) { env.editor.getSelection().selectLineStart(); }
|
||||
exec: function(env, args) { env.editor.getSelection().selectLineStart(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "gotolinestart",
|
||||
bindKey: bindKey("Alt-Left|Home", "Command-Left|Home|Ctrl-A"),
|
||||
exec: function(env, args, request) { env.editor.navigateLineStart(); }
|
||||
exec: function(env, args) { env.editor.navigateLineStart(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "selectleft",
|
||||
bindKey: bindKey("Shift-Left", "Shift-Left"),
|
||||
exec: function(env, args, request) { env.editor.getSelection().selectLeft(); }
|
||||
exec: function(env, args) { env.editor.getSelection().selectLeft(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "gotoleft",
|
||||
bindKey: bindKey("Left", "Left|Ctrl-B"),
|
||||
exec: function(env, args, request) { env.editor.navigateLeft(args.times); }
|
||||
exec: function(env, args) { env.editor.navigateLeft(args.times); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "selectwordright",
|
||||
bindKey: bindKey("Ctrl-Shift-Right", "Option-Shift-Right"),
|
||||
exec: function(env, args, request) { env.editor.getSelection().selectWordRight(); }
|
||||
exec: function(env, args) { env.editor.getSelection().selectWordRight(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "gotowordright",
|
||||
bindKey: bindKey("Ctrl-Right", "Option-Right"),
|
||||
exec: function(env, args, request) { env.editor.navigateWordRight(); }
|
||||
exec: function(env, args) { env.editor.navigateWordRight(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "selecttolineend",
|
||||
bindKey: bindKey("Alt-Shift-Right", "Command-Shift-Right"),
|
||||
exec: function(env, args, request) { env.editor.getSelection().selectLineEnd(); }
|
||||
exec: function(env, args) { env.editor.getSelection().selectLineEnd(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "gotolineend",
|
||||
bindKey: bindKey("Alt-Right|End", "Command-Right|End|Ctrl-E"),
|
||||
exec: function(env, args, request) { env.editor.navigateLineEnd(); }
|
||||
exec: function(env, args) { env.editor.navigateLineEnd(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "selectright",
|
||||
bindKey: bindKey("Shift-Right", "Shift-Right"),
|
||||
exec: function(env, args, request) { env.editor.getSelection().selectRight(); }
|
||||
exec: function(env, args) { env.editor.getSelection().selectRight(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "gotoright",
|
||||
bindKey: bindKey("Right", "Right|Ctrl-F"),
|
||||
exec: function(env, args, request) { env.editor.navigateRight(args.times); }
|
||||
exec: function(env, args) { env.editor.navigateRight(args.times); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "selectpagedown",
|
||||
bindKey: bindKey("Shift-PageDown", "Shift-PageDown"),
|
||||
exec: function(env, args, request) { env.editor.selectPageDown(); }
|
||||
exec: function(env, args) { env.editor.selectPageDown(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "pagedown",
|
||||
bindKey: bindKey(null, "PageDown"),
|
||||
exec: function(env, args, request) { env.editor.scrollPageDown(); }
|
||||
exec: function(env, args) { env.editor.scrollPageDown(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "gotopagedown",
|
||||
bindKey: bindKey("PageDown", "Option-PageDown|Ctrl-V"),
|
||||
exec: function(env, args, request) { env.editor.gotoPageDown(); }
|
||||
exec: function(env, args) { env.editor.gotoPageDown(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "selectpageup",
|
||||
bindKey: bindKey("Shift-PageUp", "Shift-PageUp"),
|
||||
exec: function(env, args, request) { env.editor.selectPageUp(); }
|
||||
exec: function(env, args) { env.editor.selectPageUp(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "pageup",
|
||||
bindKey: bindKey(null, "PageUp"),
|
||||
exec: function(env, args, request) { env.editor.scrollPageUp(); }
|
||||
exec: function(env, args) { env.editor.scrollPageUp(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "gotopageup",
|
||||
bindKey: bindKey("PageUp", "Option-PageUp"),
|
||||
exec: function(env, args, request) { env.editor.gotoPageUp(); }
|
||||
exec: function(env, args) { env.editor.gotoPageUp(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "selectlinestart",
|
||||
bindKey: bindKey("Shift-Home", "Shift-Home"),
|
||||
exec: function(env, args, request) { env.editor.getSelection().selectLineStart(); }
|
||||
exec: function(env, args) { env.editor.getSelection().selectLineStart(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "selectlineend",
|
||||
bindKey: bindKey("Shift-End", "Shift-End"),
|
||||
exec: function(env, args, request) { env.editor.getSelection().selectLineEnd(); }
|
||||
exec: function(env, args) { env.editor.getSelection().selectLineEnd(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "del",
|
||||
bindKey: bindKey("Delete", "Delete|Ctrl-D"),
|
||||
exec: function(env, args, request) { env.editor.removeRight(); }
|
||||
exec: function(env, args) { env.editor.removeRight(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "backspace",
|
||||
|
|
@ -349,58 +349,58 @@ exports.startup = function() {
|
|||
"Ctrl-Backspace|Command-Backspace|Option-Backspace|Shift-Backspace|Backspace",
|
||||
"Ctrl-Backspace|Command-Backspace|Shift-Backspace|Backspace|Ctrl-H"
|
||||
),
|
||||
exec: function(env, args, request) { env.editor.removeLeft(); }
|
||||
exec: function(env, args) { env.editor.removeLeft(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "removetolinestart",
|
||||
bindKey: bindKey(null, "Option-Backspace"),
|
||||
exec: function(env, args, request) { env.editor.removeToLineStart(); }
|
||||
exec: function(env, args) { env.editor.removeToLineStart(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "removetolineend",
|
||||
bindKey: bindKey(null, "Ctrl-K"),
|
||||
exec: function(env, args, request) { env.editor.removeToLineEnd(); }
|
||||
exec: function(env, args) { env.editor.removeToLineEnd(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "removewordleft",
|
||||
bindKey: bindKey(null, "Alt-Backspace|Ctrl-Alt-Backspace"),
|
||||
exec: function(env, args, request) { env.editor.removeWordLeft(); }
|
||||
exec: function(env, args) { env.editor.removeWordLeft(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "removewordright",
|
||||
bindKey: bindKey(null, "Alt-Delete"),
|
||||
exec: function(env, args, request) { env.editor.removeWordRight(); }
|
||||
exec: function(env, args) { env.editor.removeWordRight(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "outdent",
|
||||
bindKey: bindKey("Shift-Tab", "Shift-Tab"),
|
||||
exec: function(env, args, request) { env.editor.blockOutdent(); }
|
||||
exec: function(env, args) { env.editor.blockOutdent(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "indent",
|
||||
bindKey: bindKey("Tab", "Tab"),
|
||||
exec: function(env, args, request) { env.editor.indent(); }
|
||||
exec: function(env, args) { env.editor.indent(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "inserttext",
|
||||
exec: function(env, args, request) {
|
||||
exec: function(env, args) {
|
||||
env.editor.insert(lang.stringRepeat(args.text || "", args.times || 1));
|
||||
}
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "centerselection",
|
||||
bindKey: bindKey(null, "Ctrl-L"),
|
||||
exec: function(env, args, request) { env.editor.centerSelection(); }
|
||||
exec: function(env, args) { env.editor.centerSelection(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "splitline",
|
||||
bindKey: bindKey(null, "Ctrl-O"),
|
||||
exec: function(env, args, request) { env.editor.splitLine(); }
|
||||
exec: function(env, args) { env.editor.splitLine(); }
|
||||
});
|
||||
gcli.addCommand({
|
||||
name: "transposeletters",
|
||||
bindKey: bindKey("Ctrl-T", "Ctrl-T"),
|
||||
exec: function(env, args, request) { env.editor.transposeLetters(); }
|
||||
exec: function(env, args) { env.editor.transposeLetters(); }
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 0e058cf3098129419a7678e20ccf011aee3e2fdc
|
||||
Subproject commit c2f60c25cf56854c67be75dead68d3b37f0acbb6
|
||||
Loading…
Add table
Add a link
Reference in a new issue