-
Notifications
You must be signed in to change notification settings - Fork 0
/
mu.js
38 lines (33 loc) · 935 Bytes
/
mu.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
'use strict'
/*
* MAIN
*/
const chalk = require('chalk')
module.exports = async function mu(args) {
const gl = require('./src/constant')
const loader = require('./src/utils/loader')
const commands = loader.require('arguments')
const muOps = require('./src/modules/muOps')
const pointerOps = require('./src/modules/pointerOps')
const {print, quiet} = require('./src/utils/print')
if(args.includes('--quiet')){
quiet()
}
for (let [index, param] of args.entries()) {
const command = commands[param]
if (typeof command === 'function') {
await muOps.update()
if (param === 'start') {
return command(index, args)
}
if(muOps.isPath){
await pointerOps.init()
return command(index, args)
}
print(chalk.yellow(`Warning: ${process.cwd()} is not a mu repo root`))
return gl.exit.cannotExe
}
}
print(gl.help)
return gl.exit.notFound
}