Closed chaliy closed 1 year ago
Hi @chaliy thank you for the advice. We will take a look at this during our planning.
Since essentially a PowerShell console is just a Windows command line window, I'll update the subject to reflect the fact that you actually ask for autocompletion in command line window.
In the meantime, since we have autocompletion for bash you can use it on Windows through cygwin or Ubuntu subsystem in Windows 10.
@troydai thanks for response. I believe that PowerShell autocompletion has nothing to do with "windows command line window". In PowerShell you actually alter TabExpansion function to react on your commands. After it's done it will work for any PowerShell environment (PowerShell ISE, PowerShell in Windows Console, etc). It will not affect CMD.
Another good example of tabexpansion implementation is Posh-GIT - https://github.com/dahlbyk/posh-git/blob/master/src/GitTabExpansion.ps1
I see what you're saying. I'll change the subject line.
Is there any news on this? I'd love to see this supported as well!
Powershell is not actively supported by the CLI team, so there are currently no plans for this.
Very sad, since PowerShell is the shell to use in windows. Honestly, I think it's kind of hilarious, since even docker (a native linux tool!) has better powershell support than a core microsoft product.
@ChristianSauer thank you for the comments. The Azure CLI 2.0 is designed to be a bash oriented. Its tab completion is supported in bash on Windows as well as cywin and mingw. On the other hand Azure PowerShell CLI is optimized to be used in the PowerShell command line environment, under which it also supports tab completion. The essense of this issue, however, is to support tab completion for Azure CLI 2.0 (a bash-oriented tool) in PowerShell environment.
Azure CLI is much easy to use rather than Azure Powershell , As we used the PowerShell ISE for script editor , it would be nice if you include teh auto completion azure CLI ... As Docker and other tools supporting , Hope it not big deal for Azure CLI to provide that feature ..
@troydai This might be true. However, the documentation and hints jump back and forth from using the CLI tools to PowerShell. I am currently working with Docker and Kubernetes and the Docker commands in the help were in PowerShell and the Kubernetes connection is given in Azure CLI in the Azure Portal. So both tools are required and it would be great to have similar support in both tools.
The Azure CLI 2.0 is designed to be a bash oriented. Its tab completion is supported in bash on Windows as well as cywin and mingw. On the other hand Azure PowerShell CLI is optimized to be used in the PowerShell command line environment, under which it also supports tab completion.
The problem here is that Azure PowerShell CLI only supports a subset of what az can do. Any plans on having one toolset that works equally fine on all both platforms?
At this time we have no plans to add support for Powershell tab completion. The CLI was not designed with Powershell as an intended shell, and while it does work, people generally run into more issues with special characters and so forth. Since the target shell for Azure CLI is bash, our priority is on fully supporting tab completion there, and even in that regard there is much to do.
For other shells, az interactive
is currently the only supported mechanism for tab completion.
That being said, if anyone in the community would like to contribute a PR that adds tab completion support for Powershell, we would gladly review it for inclusion.
Powershell is not actively supported by the CLI team, so there are currently no plans for this.
I just spent an hour trying to get WSL to integrate like a native terminal with unsatisfactory results. Please fully support Windows. Many of the Azure docs only feature az
and lack parity with Azure PowerShell.
I have also yet to get tab completion working on WSL bash.
This looks like a sizable undertaking but granted that a large number of PowerShell based users do use Azure CLI, this would be immensely helpful. Anyone wants to start posh-az module? :)
Powershell is not actively supported by the CLI team, so there are currently no plans for this.
That's irrelevant. Look at the dotnet CLI: it doesn't "actively support" PowerShell, but it has a "complete" command, which is shell-agnostic. This command can then be used to integrate with any shell (PowerShell, bash or zsh for instance). Look here for details: https://docs.microsoft.com/en-us/dotnet/core/tools/enable-tab-autocomplete#powershell
+1 for using Azure CLI in PowerShell and wanting it to be fully supported. We are a Dotnet shop so PowerShell is everywhere for us.
As @thomaslevesque pointed out, the dotnet CLI supports any shell that supports expansions. That same documentation has instructions that enable it for bash and zsh, as common examples.
The big benefit to you is that - with a little introspection - you don't have to maintain it have users install separate expansion files. Users set up completion once and are done no matter how many times they update the az CLI. You have no need to keep those files up to date.
Seems like a win-win.
add to S165.
Azure CLI uses Python's argcomplete for auto-completion. As mentioned in https://github.com/kislyuk/argcomplete/issues/166, currently there is no good implementation for Python apps to achieve auto-completion in PowerShell terminal.
You might want to remove the following highlighted sentence from this documentation: https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-windows?tabs=azure-cli#run-the-azure-cli
Run the Azure CLI You can now run the Azure CLI with the az command from either Windows Command Prompt or PowerShell. PowerShell offers some tab completion features not available from Windows Command Prompt. To sign in, run the az login command.
Although that sentence is true by itself, in that context it implies you can use tab completion in Powershell with Azure CLI. I definitely don't read that and get the sense that there are "no plans to add support for Powershell tab completion"—quite the opposite in fact.
@wqoq, the sentence "PowerShell offers some tab completion features not available from Windows Command Prompt." has been removed by https://github.com/MicrosoftDocs/azure-docs-cli/pull/2801.
@wqoq, the sentence "PowerShell offers some tab completion features not available from Windows Command Prompt." has been removed by MicrosoftDocs/azure-docs-cli#2801.
Disappointing outcome, but thanks. At least that should reduce some confusion for the next people that encounter that documentation.
@wqoq, I totally understand, but currently there is hardly any good implementation for local exe
command's auto-complete in PowerShell. 😥
For what it's worth, you may use F8 key in PowerShell to bring back a command from the history (you typed before). I always found this helpful.
@wqoq, I totally understand, but currently there is hardly any good implementation for local exe command's auto-complete in PowerShell. 😥
There is autocomplete for git, kubectl, how it is different for az? It is quite annoying that third party companies can and do support PowerShell while Microsoft itself don't.
Azure CLI uses Python's argcomplete for auto-completion. As mentioned in kislyuk/argcomplete#166, currently there is no good implementation for Python apps to achieve auto-completion in PowerShell terminal.
Cool cool -- why on earth is the azure cli written in python when it doesn't have clean support for the Windows native shell? Sorry this just sounds lazy... If the dotnet
cli can do this (snippet below), someone can do it in a python based app...
Register-ArgumentCompleter -Native -CommandName dotnet -ScriptBlock {
param($commandName, $wordToComplete, $cursorPosition)
dotnet complete --position $cursorPosition "$wordToComplete" | ForEach-Object {
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
}
}
For what it's worth, you may use F8 key in PowerShell to bring back a command from the history (you typed before). I always found this helpful.
Well for that you just must setup up and down arrow history lookup with PSReadLine
module:
Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward
Had this once auto configured in bash and never have understood the plain up arrow previous command being the default ever since. As who would want the previous command if there is already something written over there.
Sorry if that was off topic, but it does make the lacking tab completion bit more manageable, though would still love to have proper tab completion for commands. Nothing breaks the flow of writing command than having to Ctrl+C and type az
Would think bit of consultation from @gvanrossum from Microsoft would help fix that for Azure CLI, though maybe he's priorities lie elsewhere:
Starts to make sense why there is need for both Azure PowerShell and this one if this issue cannot be fixed. Was just ranting when starting AZ-104 certification study that why on earth are both Azure CLI and Azure Powershell needed if Az cli can work on both bash and powershell...
So I guess the winner is still undecided, but maybe should go back to Azure Powershell my self over this although I do like the syntax of Azure CLI better.
Owners of this issue might want to lock it down. I'm unsubscribing.
So I guess the winner is still undecided, but maybe should go back to Azure Powershell my self over this although I do like the syntax of Azure CLI better.
If the preference towards the az cli is syntax you could try wrapping it using Set-Alias
Looks like a spammer is active here. :-(
So I guess the winner is still undecided, but maybe should go back to Azure Powershell my self over this although I do like the syntax of Azure CLI better.
If the preference towards the az cli is syntax you could try wrapping it using
Set-Alias
I do not think that is the same thing at all. Azure powershell has totally different command structure, so cannot alias between the two.
And maybe I was totally out of line referencing Mr. Guido Van Rossum here. So my apologies. Though won't tag him to spam any further.
@wqoq, I totally understand, but currently there is hardly any good implementation for local
exe
command's auto-complete in PowerShell. 😥
How about this python-prompt-toolkit library for implementing autocomplete on python?
Read in stackoverflow it being used for IronPython, so would think it is properly maintained.
Good afternoon everybody
I hope you are well
this auto complete option will be released for powershell 7?
@Didjacome Yes, #24752 supports PowerShell 7.
thanks @bebound i am waiting for the PRs request
The feature has been released. See Enable Tab Completion on PowerShell
The feature has been released. See Enable Tab Completion on PowerShell
It works for me. Although its quite slow compared to other auto completion options but i'll take anything i can get!
Awesome, love to see it!
I am big fun of new Azure CLI 2.0. However my working console is Powershell, is there any chance to get autocomplete for Powershell?
There are many examples of successful integrations to Powershell: