From 0e93a705563d9b22dffc750c93ce37f658e6012d Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Tue, 27 Jun 2017 20:01:31 +0000 Subject: [PATCH] UI to set config --- CliClient/app/main.js | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/CliClient/app/main.js b/CliClient/app/main.js index 587a7164eb..5f3f2c4aa9 100644 --- a/CliClient/app/main.js +++ b/CliClient/app/main.js @@ -32,7 +32,6 @@ const packageJson = require('./package.json'); let initArgs = { profileDir: null, - syncTarget: null, } let currentFolder = null; @@ -47,17 +46,12 @@ commands.push({ usage: 'root', options: [ ['--profile ', 'Sets the profile path directory.'], - ['--sync-target ', 'Sets the sync target.'], ], action: function(args, end) { if (args.profile) { initArgs.profileDir = args.profile; } - if (args['sync-target']) { - initArgs.syncTarget = args['sync-target']; - } - end(); }, }); @@ -320,6 +314,28 @@ commands.push({ autocomplete: autocompleteFolders, }); +commands.push({ + usage: 'config [name] [value]', + description: 'Gets or sets a config value. If [value] is not provided, it will show the value of [name]. If neither [name] nor [value] is provided, it will list the current configuration.', + action: function(args, end) { + try { + if (!args.name && !args.value) { + let keys = Setting.publicKeys(); + for (let i = 0; i < keys.length; i++) { + this.log(keys[i] + ' = ' + Setting.value(keys[i])); + } + } else if (args.name && !args.value) { + this.log(args.name + ' = ' + Setting.value(args.name)); + } else { + Setting.setValue(args.name, args.value); + } + } catch(error) { + this.log(error); + } + end(); + }, +}); + commands.push({ usage: 'sync', description: 'Synchronizes with remote storage.', @@ -639,8 +655,6 @@ async function main() { BaseModel.db_ = database_; await Setting.load(); - if (initArgs.syncTarget) Setting.setValue('sync.target', initArgs.syncTarget); - let activeFolderId = Setting.value('activeFolderId'); let activeFolder = null; if (activeFolderId) activeFolder = await Folder.load(activeFolderId);