From dbdef199e6e62987ec6b9db5f94d1c11add6b1f9 Mon Sep 17 00:00:00 2001 From: "Vyacheslav.Sviridov" Date: Wed, 27 Jul 2022 19:52:55 +0600 Subject: [PATCH] separate commands from parameters --- .../AutoProvisioning/inputHandler.js | 22 +++++----- lib/applications/BulkImport/inputHandler.js | 40 +++++++++---------- .../TopologyBrowser/inputHandler.js | 32 +++++++-------- util/createNext.js | 2 +- 4 files changed, 48 insertions(+), 48 deletions(-) diff --git a/lib/applications/AutoProvisioning/inputHandler.js b/lib/applications/AutoProvisioning/inputHandler.js index 6746770..46cc43a 100755 --- a/lib/applications/AutoProvisioning/inputHandler.js +++ b/lib/applications/AutoProvisioning/inputHandler.js @@ -22,38 +22,38 @@ async function commandOther(prvn, command) { async function handleCommand(prvn, command) { switch (command) { - case 'exit': + case '_exit': prvn.prompt = '' break - case 'new': + case '_new': await prvn.newProject() break - case 'back': + case '_back': prvn.nodeIndex ? await prvn.getProjects() : await prvn.getProjectData() break - case 'delete': + case '_delete': prvn.nodeIndex ? await prvn.deleteNode() : await prvn.deleteProject() break - case 'status': + case '_status': await prvn.getNodeStatus() break - case 'properties': + case '_properties': await prvn.getNodeProperties() break - case 'bind': + case '_bind': await prvn.bindNode() break - case 'cancel': + case '_cancel': await prvn.cancelNode() break - case 'resume': + case '_resume': await prvn.resumeNode() break - case 'configurations': + case '_configurations': await prvn.configurationsNode() break - case 'siteinstall': + case '_siteinstall': await prvn.siteinstallNode() break diff --git a/lib/applications/BulkImport/inputHandler.js b/lib/applications/BulkImport/inputHandler.js index 0ccb5d2..5a97388 100755 --- a/lib/applications/BulkImport/inputHandler.js +++ b/lib/applications/BulkImport/inputHandler.js @@ -22,54 +22,54 @@ async function commandOther(bulk, command) { async function handleCommand(bulk, command) { switch (command) { - case 'exit': + case '_exit': bulk.prompt = '' break - case 'next': - case 'last': - case 'first': - case 'prev': + case '_next': + case '_last': + case '_first': + case '_prev': bulk.operations ? await bulk.pageOperations(command) : await bulk.pageJobs(command) break - case 'operations': - case 'failures': + case '_operations': + case '_failures': await bulk.getOperations(command === 'failures') break - case 'my': + case '_my': await bulk.my() break - case 'new': + case '_new': await bulk.newJob() break - case 'back': + case '_back': bulk.operations ? await bulk.job(bulk.jobId) : await bulk.getJobs() break - case 'delete': + case '_delete': await bulk.deleteJob() break - case 'cancel': + case '_cancel': await bulk.cancelImportJob() break - case 'files': + case '_files': await bulk.files() break - case 'print': + case '_print': await bulk.print() break - case 'validate': - case 'execute': + case '_validate': + case '_execute': await bulk.invocation(command) break - case 'unschedule': + case '_unschedule': await bulk.unschedule() break - case 'unsync': + case '_unsync': await bulk.unsync() break - case 'export': + case '_export': await bulk.exportJob() break - case 'revoke': + case '_revoke': await bulk.revoke() break diff --git a/lib/applications/TopologyBrowser/inputHandler.js b/lib/applications/TopologyBrowser/inputHandler.js index 011ae2b..2b24ff4 100755 --- a/lib/applications/TopologyBrowser/inputHandler.js +++ b/lib/applications/TopologyBrowser/inputHandler.js @@ -23,52 +23,52 @@ function commandOther(tplg, command) { async function handleCommand(tplg, command) { const [cmd, param = ''] = command.split(/\s+/) switch (cmd) { - case 'exit': + case '_exit': tplg.fdn = '' break - case 'show': + case '_show': await tplg.show(param) break - case 'config': + case '_config': await tplg.config() break - case 'set': + case '_set': await tplg.set() break - case 'commit': + case '_commit': await tplg.commit() break - case 'up': + case '_up': tplg.up() break - case 'get': + case '_get': tplg.get() break - case 'check': + case '_check': tplg.check() break - case 'end': + case '_end': tplg.end() break - case 'home': + case '_home': tplg.home() break - case 'search': + case '_search': await tplg.search() break - case 'description': + case '_description': tplg.description() break - case 'persistent': + case '_persistent': tplg.persistent() break - case 'fdn': + case '_fdn': await tplg.goToFdn(param) break - case 'alarms': + case '_alarms': await tplg.alarms() break - case 'sync': + case '_sync': await tplg.sync() break diff --git a/util/createNext.js b/util/createNext.js index 26ab98c..f76876f 100755 --- a/util/createNext.js +++ b/util/createNext.js @@ -11,7 +11,7 @@ function createNext(filter) { separator, ...commands.map(cmd => ({ name: chalk.yellowBright.bold(`[${cmd}]`), - value: cmd, + value: `_${cmd}`, short: cmd, })), separator,