From 22276404e5c3f3833a2de5f1971be24f0729aa6e Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Sun, 9 Aug 2015 20:10:38 +0200 Subject: Implement basic command dispatch logic Moved command implementation into separate ressource. Commands are plain JavaScript functions in this separate ressource and as such callable via a simple call to `eval`. Introduced the concept of a command prefix to enable implementation of e.g. a search command analogously to _vim_. --- qml/commands.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 qml/commands.js (limited to 'qml/commands.js') diff --git a/qml/commands.js b/qml/commands.js new file mode 100644 index 0000000..ee13a1b --- /dev/null +++ b/qml/commands.js @@ -0,0 +1,19 @@ +function execute(command) { + var args = command.split(' '); + var func = args[0]; + args.shift(); + + eval(func + '(' + JSON.stringify(args) + ')'); +} + +function exec(args) { + eval(args.join(' ')); +} + +function next() { + terminalList.selectNext(); +} + +function prev() { + terminalList.selectPrev(); +} -- cgit v1.2.3