[feat] [s]: add prompt method

This commit is contained in:
Thadeu Cotts
2020-11-23 17:05:59 -03:00
parent 12c0e1ac18
commit 253a58a406

View File

@@ -5,11 +5,11 @@ const chalk = require('chalk')
const prompts = require('prompts') const prompts = require('prompts')
const package = require('./package.json') const package = require('./package.json')
/* Output path to create new portal app */ // Output path to create new portal app
let path = '' let path = ''
/* Commander parameters to specify CLI behavior */ // Commander parameters to specify CLI behavior
program.name(package.name) program.name(package.name)
.version(package.version) .version(package.version)
.arguments('[dir]') .arguments('[dir]')
@@ -20,3 +20,21 @@ program.name(package.name)
.action(name => path = name) .action(name => path = name)
.allowUnknownOption() .allowUnknownOption()
.parse(process.argv) .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
}
})
}