zsh and az (azure) command autocomplete

az” autocomplete command from azure-cli package do not work by default. By autocomplete I understand the functionality where command can populate additional options by pressing <TAB> button twice.

In zsh 5.8.1 (macOS ver. 12.6.1) to make it work, create the following file in your home directory: “.zshrc” with the content:


autoload bashcompinit && bashcompinit &&
autoload compinit && compinit
source /usr/local/etc/bash_completion.d/az

Assumption is that you have installed az with the brew: brew update && brew install azure-cli

az binary are then in /usr/local/bin/az, and autocompletion file in /usr/local/etc/bash_completion.d/az

This functionality do not work for az extensions. For example, vmware extension needs to be typed (az vmware), but then subcommands are autocomplete and everything works as expected.

I believe autocomplete was one of the main features that makes Linux shell (bash in particular) so popular. Everyone appreciate the fact that there is no need to remember every command option by hard. And also, less typing means more works can be done 🙂

No Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Linux
Migrate WordPress site to another hosting service.

IntroductionThis article details the migration of WordPress site (exactly this site you are now on) from one service provider to Amazon Lightsail. There might be various reason to do that (mine is outlined below) but in general I hope to share the message that especially with WordPress, migration can be …

VMware
VMware Workstation and Fusion can be installed and use for free (even for the enterprise)

For a while now, the VMware Workstation (and Fusion for MacOS) can be used without any additional fee for Personal use. That was a great Broadcom news and nice gesture from that software vendor. Recently Broadcom announced that the software will be available for all, even the commercial sector. This …

Azure
OneDrive on macOS, ugly hack

Introduction I have been using Google Drive for many years without any issues, but since the only constant in life is change, I recently found myself having to use OneDrive. I’m not very familiar with OneDrive, so the functions (and partial solutions) presented below might also be available in Microsoft …