[feat] [s]: add prompt method
This commit is contained in:
parent
12c0e1ac18
commit
253a58a406
@ -5,11 +5,11 @@ const chalk = require('chalk')
|
||||
const prompts = require('prompts')
|
||||
const package = require('./package.json')
|
||||
|
||||
/* Output path to create new portal app */
|
||||
// Output path to create new portal app
|
||||
let path = ''
|
||||
|
||||
|
||||
/* Commander parameters to specify CLI behavior */
|
||||
// Commander parameters to specify CLI behavior
|
||||
program.name(package.name)
|
||||
.version(package.version)
|
||||
.arguments('[dir]')
|
||||
@ -20,3 +20,21 @@ program.name(package.name)
|
||||
.action(name => path = name)
|
||||
.allowUnknownOption()
|
||||
.parse(process.argv)
|
||||
|
||||
|
||||
/**
|
||||
* Method to ask a custon name if was not passed as parameter
|
||||
*/
|
||||
async function promptPath(){
|
||||
return prompts({
|
||||
type: 'text',
|
||||
name: 'path',
|
||||
message: 'Choose a name to your project',
|
||||
initial: '',
|
||||
validate: name => {
|
||||
//TODO Method to validate valid path name
|
||||
return true
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user