feat: cli v0.2.0

This commit is contained in:
Gabriel Pastori
2023-11-14 11:38:22 -03:00
parent 5e0c55b489
commit b6f447bb0a
16 changed files with 1297 additions and 7 deletions

25
lib/pm2/index.js Normal file
View File

@@ -0,0 +1,25 @@
const functions = {
setup: require('./setup.js'),
reset: require('./reset.js'),
start: require('./start.js'),
stop: require('./stop.js'),
delete: require('./delete.js'),
}
module.exports = async (argv) => {
try {
if (argv._.length === 1) throw new Error('No operation specified')
const operation = argv._[1]
if (!functions[operation]) throw new Error(`Unknown operation: ${operation}`)
await functions[operation](argv)
} catch (e) {
console.error(e.message || e)
process.exit(1)
}
}