From 264636ce4c2677ff32bca7dc432b0a086bf5cece Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Fri, 21 Aug 2015 19:31:26 +0200 Subject: Implement automatic key suggestion in `set` command --- src/command/commands.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src') diff --git a/src/command/commands.js b/src/command/commands.js index d27fa58..b2216b7 100644 --- a/src/command/commands.js +++ b/src/command/commands.js @@ -55,6 +55,24 @@ function ls(output) { function set(output, args) { switch ( args.length ) { + case 0: { + Object.keys(settings).filter( + function(element) { + return element !== 'objectName' + && typeof settings[element] !== 'function'; + } + ).forEach(output.log); + break; + } + case 1: { + Object.keys(settings[args[0]]).filter( + function(element) { + return element !== 'objectName' + && typeof settings[args[0]][element] !== 'function'; + } + ).forEach(output.log); + break; + } case 2: { output.log(settings.read(args[0], args[1])); break; -- cgit v1.2.3