microsoft / vscode-azurecli

VS Code extension for the Azure CLI 2.0
MIT License
71 stars 47 forks source link

Unable to recognize multiline command #49

Open tilakmishra opened 5 years ago

tilakmishra commented 5 years ago

I am trying to run this below command using VS code but it doesnt recognize muti-line parameter and giving below error saying following arguments are required. However, arguments are passed

How to overcome this? Not sure if this is a bug or something i am missing. Couldn't find any solution after searching so many ways in internet and hence creating this issue. Thanks for helping. { "stderr": "ERROR: az storage account create: error: the following arguments are required: --resource-group/-g, --name/-n\r\nusage: az storage account create [-h] [--verbose] [--debug]\r\n [--output {json,jsonc,table,tsv,yaml,none}]\r\n [--query JMESPATH] --resource-group\r\n RESOURCE_GROUP_NAME --name ACCOUNT_NAME\r\n [--sku {Standard_LRS,Standard_GRS,Standard_RAGRS,Standard_ZRS,Premium_LRS,Premium_ZRS}]\r\n [--location LOCATION]\r\n [--kind {Storage,StorageV2,BlobStorage,FileStorage,BlockBlobStorage}]\r\n [--tags [TAGS [TAGS ...]]]\r\n [--custom-domain CUSTOM_DOMAIN]\r\n [--encryption-services {blob,file,table,queue} [{blob,file,table,queue} ...]]\r\n [--access-tier {Hot,Cool}]\r\n [--https-only [{true,false}]]\r\n [--bypass {None,Logging,Metrics,AzureServices} [{None,Logging,Metrics,AzureServices} ...]]\r\n [--default-action {Allow,Deny}]\r\n [--assign-identity]\r\n [--subscription _SUBSCRIPTION]\r\n", "stdout": "" }

az storage account create \ --name storagequickstart \ --resource-group storage-quickstart-resource-group \ --location westus \ --sku Standard_LRS \ --kind StorageV2

sbhuttan commented 5 years ago

Any updates on this issue? Multiline statements still do not seem to work.

chrmarti commented 5 years ago

It doesn't work when running the command in the background with the results shown in a side-by-side editor.

It does work when you put a \ at the end of all but the last line and use Run Selected Text in Active Terminal.

sbhuttan commented 5 years ago

I am seeing same behavior on the Terminal. Each line runs individually. I used "Run Selected Text in Active Terminal" as suggested.

image

chrmarti commented 5 years ago

The line continuation character for PowerShell is `, not \. I missed you are using PowerShell.

mataralhawiti commented 4 years ago

I am seeing same behavior on the Terminal. Each line runs individually. I used "Run Selected Text in Active Terminal" as suggested.

image

I've having the same issue.

chrmarti commented 4 years ago

@mataralhawiti Are you using PowerShell or some Unix shell? Note that PowerShell uses ` (backtick) at the end of each but the last line. Unix shells use \ (backslash).

mataralhawiti commented 4 years ago

@mataralhawiti Are you using PowerShell or some Unix shell? Note that PowerShell uses (backtick) at the end of each but the last line. Unix shells use` (backslash).

I'm using the vs code (run line in terminal ) - windows machine

here's my code :

az group create --location westeurope\ --name rg_playground2\ --tags owner:'Matar' for:airflow'

The error :

--name rg_playground2\ '--name' is not recognized as an internal or external command, operable program or batch file.

chrmarti commented 4 years ago

If you are using PowerShell in the terminal you need to replace the backslashes with backticks. If you are using CMD you need to replace the backslashes with carets (^). The different shells have different line continuation characters.

mataralhawiti commented 4 years ago

thanks it works now

ivanakcheurov commented 4 years ago

Hi, I have the following command that is not working in Powershell 7.0.3 (Windows10, Visual Studio Code terminal).

az role definition update --role-definition '{ `
   "Name": "Custom Network Contributor Role", `
   "IsCustom": true, `
   "Description": "Can do operations on NICs and join subnets", `
   "Actions": [ `
     "*/read", `
   ], `
   "NotActions": [], `
   "DataActions": [], `
   "NotDataActions": [], `
   "AssignableScopes": [ `
     "/subscriptions/---guid---", `
     "/subscriptions/---another-guid---" `
   ] `
 }'

I get the following error: Expecting property name enclosed in double quotes: line 1 column 3 (char 2) I tried with backticks, backslashes, with and without single quotes. Nothing works.

AndreyTomilinXmpi commented 1 year ago

Same for me: the ` does not work with PowerShell 7.3.0, but works with previous versions. Welcome to the world of Microsoft standards and backward compatibility! Some things never change.