cli rework
This commit is contained in:
+38
-9
@@ -1,11 +1,40 @@
|
||||
import yargs from 'yargs'
|
||||
import c from 'chalk'
|
||||
import { select } from '@inquirer/prompts'
|
||||
|
||||
import create from './commands/create'
|
||||
import { checkForUpdate } from './utils/update'
|
||||
import { initProject } from './commands/create'
|
||||
import { downloadUpdater } from './commands/download-updater'
|
||||
|
||||
yargs
|
||||
.usage('<cmd> [args]')
|
||||
// .scriptName('rage-fw')
|
||||
// .usage('$0 <cmd> [args]')
|
||||
// @ts-ignore
|
||||
.command(create)
|
||||
.help().argv
|
||||
enum Actions {
|
||||
INIT_PROJECT = 'INIT_PROJECT',
|
||||
UPDATER = 'UPDATER',
|
||||
}
|
||||
|
||||
;(async () => {
|
||||
await checkForUpdate()
|
||||
|
||||
console.log(
|
||||
c.blueBright('Rage FW CLI | Powered by Entity Seven Group ️ <3'),
|
||||
)
|
||||
|
||||
const action = await select({
|
||||
message: c.gray('Select action:'),
|
||||
choices: [
|
||||
{
|
||||
name: 'Initialize new project',
|
||||
value: Actions.INIT_PROJECT,
|
||||
description: 'Initialize new project and start develop',
|
||||
},
|
||||
{
|
||||
name: 'Install RAGE:MP updater',
|
||||
value: Actions.UPDATER,
|
||||
description:
|
||||
'Use our custom updater to download and update RAGE:MP server files.',
|
||||
},
|
||||
],
|
||||
loop: true,
|
||||
})
|
||||
|
||||
if (action === Actions.INIT_PROJECT) await initProject()
|
||||
if (action === Actions.UPDATER) await downloadUpdater()
|
||||
})()
|
||||
|
||||
Reference in New Issue
Block a user