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

Commit 18fa9ac

Browse files
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 4416a12 commit 18fa9ac

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/commands/functions/create.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ exports.handler = async function(event, context) {
2020
class FunctionsCreateCommand extends Command {
2121
async run() {
2222
const { flags, args } = this.parse(FunctionsCreateCommand)
23-
const { name } = args
23+
const name = flags.name || args.name
2424
const { config } = this.netlify
2525

2626
this.log(`Creating function ${name}`)
@@ -70,6 +70,7 @@ FunctionsCreateCommand.description = `create a new function locally
7070
FunctionsCreateCommand.examples = ['netlify functions:create hello-world']
7171

7272
FunctionsCreateCommand.flags = {
73+
name: flags.string({ char: 'n', description: 'function name' }),
7374
functions: flags.string({ char: 'f', description: 'functions folder' }),
7475
dir: flags.boolean({
7576
char: 'd',

0 commit comments

Comments
 (0)