Azure / azure-functions-core-tools

Command line tools for Azure Functions
MIT License
1.32k stars 434 forks source link

Creating function seems to fail - what is the correct command? #2653

Open diberry opened 3 years ago

diberry commented 3 years ago

If I look at the list of typescript templates, I see the HTTP trigger.

npx func templates list

image

If I try to create a new function with that template name, I get an error:

npx func new --template "HTTP trigger" --name graphql

image

If I walk through the steps via the cli, I find out the number for that template is 10. If I try to use that number, instead of a name, I also get an error.

image

I don't want to step through the cli choices, I want a single command that answers all the choices - because I'm using this in a doc and don't want the reader to have to step through all the choices either.

apawast commented 3 years ago

@diberry do you still run into this issue if you use func without npx? npx is not currently a supported/tested scenario.

diberry commented 3 years ago

Without npx, how to do I use the tools as a CLI and note a step-through process? image

anthonychu commented 3 years ago

@diberry It's prompting because the folder hasn't been initialized when func new is called. You can get func new to initialize as well by adding the language or by running func init first.

func new --template "HTTP Trigger" --javascript --name graphql

or

func init --javascript
func new --template "HTTP Trigger" --name graphql
diberry commented 3 years ago

@anthonychu - I'm looking for a complete CLI command that I don't have to step through so I can plug it into a script to create a typescript function app. Is that possible or what am I missing?

anthonychu commented 3 years ago

Does func init --typescript work for you?