mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-06-06 12:47:13 +02:00
* Split out oputil stuff into modules based on <command>
* oputil: better syntax * oputil: allow areaTag@storageTag for scan, e.g. oputil fb scan <args> retro_pc@some_specific_storage
This commit is contained in:
parent
d41fbf6911
commit
d0511d5d74
10 changed files with 725 additions and 553 deletions
45
core/oputil/oputil_main.js
Normal file
45
core/oputil/oputil_main.js
Normal file
|
@ -0,0 +1,45 @@
|
|||
/* jslint node: true */
|
||||
/* eslint-disable no-console */
|
||||
'use strict';
|
||||
|
||||
const ExitCodes = require('./oputil_common.js').ExitCodes;
|
||||
const argv = require('./oputil_common.js').argv;
|
||||
const printUsageAndSetExitCode = require('./oputil_common.js').printUsageAndSetExitCode;
|
||||
const handleUserCommand = require('./oputil_user.js').handleUserCommand;
|
||||
const handleFileBaseCommand = require('./oputil_file_base.js').handleFileBaseCommand;
|
||||
const handleConfigCommand = require('./oputil_config.js').handleConfigCommand;
|
||||
const getHelpFor = require('./oputil_help.js').getHelpFor;
|
||||
|
||||
|
||||
module.exports = function() {
|
||||
|
||||
process.exitCode = ExitCodes.SUCCESS;
|
||||
|
||||
if(true === argv.version) {
|
||||
return console.info(require('../package.json').version);
|
||||
}
|
||||
|
||||
if(0 === argv._.length ||
|
||||
'help' === argv._[0])
|
||||
{
|
||||
printUsageAndSetExitCode(getHelpFor('General'), ExitCodes.SUCCESS);
|
||||
}
|
||||
|
||||
switch(argv._[0]) {
|
||||
case 'user' :
|
||||
handleUserCommand();
|
||||
break;
|
||||
|
||||
case 'config' :
|
||||
handleConfigCommand();
|
||||
break;
|
||||
|
||||
case 'file-base' :
|
||||
case 'fb' :
|
||||
handleFileBaseCommand();
|
||||
break;
|
||||
|
||||
default:
|
||||
return printUsageAndSetExitCode('', ExitCodes.BAD_COMMAND);
|
||||
}
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue