aboutsummaryrefslogtreecommitdiff
path: root/src/command/commands.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/command/commands.js')
-rw-r--r--src/command/commands.js28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/command/commands.js b/src/command/commands.js
index f76af01..8fa369a 100644
--- a/src/command/commands.js
+++ b/src/command/commands.js
@@ -18,9 +18,9 @@ function execute(output, command) {
}
}
-function exec(output, args) {
+function safeEval(output, code) {
try {
- var result = eval(args.join(' '));
+ var result = eval(code);
if ( typeof result !== 'undefined' ) {
output.log(result);
@@ -30,6 +30,10 @@ function exec(output, args) {
}
}
+function exec(output, args) {
+ safeEval(output, args.join(' '));
+}
+
function jump(output, index) {
terminalList.selectItem(index);
}
@@ -53,3 +57,23 @@ function ls(output) {
}
});
}
+
+function set(output, args) {
+ switch ( args.length ) {
+ case 2: {
+ safeEval(output, 'settings.' + args[0] + '.' + args[1]);
+ break;
+ }
+ case 3: {
+ safeEval(
+ output,
+ 'settings.' + args[0] + '.' + args[1] + ' = "' + args[2] + '"'
+ );
+ break;
+ }
+ default: {
+ output.error('Wrong count of arguments.');
+ break;
+ }
+ }
+}