Skip to content
This repository was archived by the owner on Sep 12, 2019. It is now read-only.

Commit 5c2ef1a

Browse files
Benaiahsw-yx
authored and
sw-yx
committed
Add '--name' flag to 'netlify functions:create'
An alternative to passing the first positional argument that matches the style described in the message returned by 'netlify functions'
1 parent 6bfc6aa commit 5c2ef1a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/commands/functions/create.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const templatesDir = path.resolve(__dirname, '../../functions-templates')
88
class FunctionsCreateCommand extends Command {
99
async run() {
1010
const { flags, args } = this.parse(FunctionsCreateCommand)
11+
const name = flags.name || args.name
1112
const { config } = this.netlify
1213
let templates = fs.readdirSync(templatesDir).filter(x => path.extname(x) === '.js') // only js templates for now
1314
templates = templates
@@ -96,6 +97,7 @@ FunctionsCreateCommand.description = `create a new function locally`
9697
FunctionsCreateCommand.examples = ['netlify functions:create hello-world']
9798

9899
FunctionsCreateCommand.flags = {
100+
name: flags.string({ char: 'n', description: 'function name' }),
99101
functions: flags.string({ char: 'f', description: 'functions folder' }),
100102
dir: flags.boolean({
101103
char: 'd',

0 commit comments

Comments
 (0)