{"id":1042,"date":"2022-09-06T07:27:50","date_gmt":"2022-09-06T07:27:50","guid":{"rendered":"https:\/\/labiol.xyz\/?p=1042"},"modified":"2022-11-27T07:42:42","modified_gmt":"2022-11-27T07:42:42","slug":"zsh-and-az-azure-command-autocomplete","status":"publish","type":"post","link":"https:\/\/www.labiol.xyz\/index.php\/2022\/09\/06\/zsh-and-az-azure-command-autocomplete\/","title":{"rendered":"zsh and az (azure) command autocomplete"},"content":{"rendered":"\n<p>&#8220;<code>az<\/code>&#8221; 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 &lt;TAB> button twice. <\/p>\n\n\n\n<p>In zsh 5.8.1 (macOS ver. 12.6.1) to make it work, create the following file in your home directory: &#8220;.zshrc&#8221; with the content:<\/p>\n\n\n\n<p><br><code>autoload bashcompinit &amp;&amp; bashcompinit &amp;&amp;<br>autoload compinit &amp;&amp; compinit<br>source \/usr\/local\/etc\/bash_completion.d\/az<\/code><\/p>\n\n\n\n<p>Assumption is that you have installed az with the brew: <code>brew update &amp;&amp; brew install azure-cli<\/code><\/p>\n\n\n\n<p>az binary are then in <code>\/usr\/local\/bin\/az<\/code>, and autocompletion file in <code>\/usr\/local\/etc\/bash_completion.d\/az<\/code><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>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.<\/p>\n<\/blockquote>\n\n\n\n<p>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 \ud83d\ude42  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8220;az&#8221; 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 &lt;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: &#8220;.zshrc&#8221; with the content: &hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35,2],"tags":[],"class_list":["post-1042","post","type-post","status-publish","format-standard","hentry","category-azure","category-vmware"],"_links":{"self":[{"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/posts\/1042","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/comments?post=1042"}],"version-history":[{"count":5,"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/posts\/1042\/revisions"}],"predecessor-version":[{"id":1047,"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/posts\/1042\/revisions\/1047"}],"wp:attachment":[{"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/media?parent=1042"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/categories?post=1042"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/tags?post=1042"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}