Azure / azure-functions-core-tools

Command line tools for Azure Functions
MIT License
1.29k stars 426 forks source link

Func new --template prompts for template numbers which are not listed #3172

Open paulyuk opened 1 year ago

paulyuk commented 1 year ago

core tools version: 4.0.4829 (x64 on rosetta to use python) OS: MacOs Montery 12.6 (Mac M1 Pro)

If I use func new with no arguments there is a nice TUI that has me select the functions templates, and those are numbered.

I tried then the following using the func templates list + func new --template 'Timer trigger'. I was a bit confused because it prompts for a template number, which func templates list does not show, but then name was filled in. This is just minor confusion because it went on to work. But if I had something invalid I would have been more confused.

I simply suggest a change to the CLI output text to say "Functions template name:" instead of "Select a number of a template:". If template number is a thing we should consider returning a table from list that has both the name and number.

Details:

 paulyuk@Pauls-MBP-2  ~/src/functions/templates  func version
4.0.4829
 paulyuk@Pauls-MBP-2  ~/src/functions/templates  func init
Found Python version 3.9.6 (python3).
Did you know? There is a new Python programming model in public preview. For fewer files and a decorator based approach, learn how you can try it out today at https://aka.ms/pythonprogrammingmodel
requirements.txt already exists. Skipped!
getting_started.md already exists. Skipped!
.gitignore already exists. Skipped!
host.json already exists. Skipped!
local.settings.json already exists. Skipped!
/Users/paulyuk/src/functions/templates/.vscode/extensions.json already exists. Skipped!
 paulyuk@Pauls-MBP-2  ~/src/functions/templates  func templates list
C# Templates:
  Azure Blob Storage trigger
  Azure Cosmos DB trigger
  Durable Functions activity
  Durable Functions entity (class)
  Durable Functions entity (function)
  Durable Functions Entity HTTP starter
  Durable Functions HTTP starter
  Durable Functions orchestrator
  Azure Event Grid trigger
  Azure Event Hub trigger
  HTTP trigger
  IoT Hub (Event Hub)
  Kafka output
  Kafka trigger
  Azure Queue Storage trigger
  RabbitMQ trigger
  SendGrid
  Azure Service Bus Queue trigger
  Azure Service Bus Topic trigger
  SignalR negotiate HTTP trigger
  Timer trigger

Custom Templates:
  Azure Blob Storage trigger
  Azure Cosmos DB trigger
  Azure Event Grid trigger
  Azure Event Hub trigger
  HTTP trigger
  IoT Hub (Event Hub)
  Kafka trigger
  Azure Queue Storage trigger
  RabbitMQ trigger
  SendGrid
  Azure Service Bus Queue trigger
  Azure Service Bus Topic trigger
  SignalR negotiate HTTP trigger
  Timer trigger

JavaScript Templates:
  Azure Blob Storage trigger
  Azure Cosmos DB trigger
  Durable Functions activity
  Durable Functions entity
  Durable Functions Entity HTTP starter
  Durable Functions HTTP starter
  Durable Functions orchestrator
  Azure Event Grid trigger
  Azure Event Hub trigger
  HTTP trigger
  IoT Hub (Event Hub)
  Kafka output
  Kafka trigger
  Azure Queue Storage trigger
  RabbitMQ trigger
  SendGrid
  Azure Service Bus Queue trigger
  Azure Service Bus Topic trigger
  SignalR negotiate HTTP trigger
  Timer trigger

PowerShell Templates:
  Azure Blob Storage trigger
  Azure Cosmos DB trigger
  Durable Functions activity
  Durable Functions HTTP starter
  Durable Functions orchestrator
  Azure Event Grid trigger
  Azure Event Hub trigger
  HTTP trigger
  IoT Hub (Event Hub)
  Kafka output
  Kafka trigger
  Azure Queue Storage trigger
  RabbitMQ trigger
  SendGrid
  Azure Service Bus Queue trigger
  Azure Service Bus Topic trigger
  SignalR negotiate HTTP trigger
  Timer trigger

Python Templates:
  Azure Blob Storage trigger
  Azure Cosmos DB trigger
  Durable Functions activity
  Durable Functions entity
  Durable Functions HTTP starter
  Durable Functions orchestrator
  Azure Event Grid trigger
  Azure Event Hub trigger
  HTTP trigger
  Kafka output
  Kafka trigger
  Azure Queue Storage trigger
  RabbitMQ trigger
  Azure Service Bus Queue trigger
  Azure Service Bus Topic trigger
  Timer trigger

TypeScript Templates:
  Azure Blob Storage trigger
  Azure Cosmos DB trigger
  Durable Functions activity
  Durable Functions entity
  Durable Functions Entity HTTP starter
  Durable Functions HTTP starter
  Durable Functions orchestrator
  Azure Event Grid trigger
  Azure Event Hub trigger
  HTTP trigger
  IoT Hub (Event Hub)
  Kafka output
  Kafka trigger
  Azure Queue Storage trigger
  RabbitMQ trigger
  SendGrid
  Azure Service Bus Queue trigger
  Azure Service Bus Topic trigger
  SignalR negotiate HTTP trigger
  Timer trigger

 paulyuk@Pauls-MBP-2  ~/src/functions/templates  func new --template 'Timer trigger'
**Select a number for template:Timer trigger**
Function name: [TimerTrigger] 
kantegajorgen commented 1 year ago

I found that writing like this (no space in template name) worked: func new --template 'TimerTrigger' --language python --name capture-beautiful-data

This might be a good place to find reference-values for different triggers: https://learn.microsoft.com/en-us/azure/azure-functions/add-bindings-existing-function?tabs=python#manually-add-bindings-based-on-examples

paulyuk commented 1 year ago

@shreyabatra4