separate commands from parameters

This commit is contained in:
Vyacheslav.Sviridov
2022-07-27 19:52:55 +06:00
parent 0b3c4e939a
commit dbdef199e6
4 changed files with 48 additions and 48 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -11,7 +11,7 @@ function createNext(filter) {
separator,
...commands.map(cmd => ({
name: chalk.yellowBright.bold(`[${cmd}]`),
value: cmd,
value: `_${cmd}`,
short: cmd,
})),
separator,