diff options
Diffstat (limited to 'qml/commands.js')
-rw-r--r-- | qml/commands.js | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/qml/commands.js b/qml/commands.js index 9b4d8de..7d4bdcf 100644 --- a/qml/commands.js +++ b/qml/commands.js @@ -1,9 +1,21 @@ function execute(command) { + var msg = function(name) { + console.log('"' + name + '"' + " is not implemented."); + }; var args = command.split(' '); - var func = args[0]; - args.shift(); - eval(func + '(' + JSON.stringify(args) + ')'); + try { + var closure = eval(args[0]); + + if ( typeof closure === "function" ) { + args.shift(); + closure(args); + } else { + msg(args[0]); + } + } catch (exception) { + msg(args[0]); + } } function exec(args) { |