The addhistory hook previously had two bugs when inc_append_history or share_history was not set: 1. Commands were only saved to one history file (HISTFILE or per-dir) depending on when fc -AI was called, resulting in lost history. 2. fc -p was called unconditionally after every command, corrupting the zsh history stack even in global mode. This caused the per-dir hook to push a new history frame on every command, breaking the global history state. Fix: always write both history files via fc -AI before any mode check, and only call fc -p (to push into per-directory history) when actually in directory mode. Signed-off-by: god032396-del <god032396@gmail.com>
1.5 KiB
azure
This plugin provides completion support for azure cli and a few utilities to manage azure subscriptions and display them in the prompt.
To use it, add azure to the plugins array in your zshrc file.
plugins=(... azure)
Plugin commands
-
az_subscriptions: lists the available subscriptions in theAZURE_CONFIG_DIR(default:~/.azure/). Used to provide completion for theazssfunction. -
azgs: gets the current value of$azure_subscription. -
azss [<subscription>]: sets the$azure_subscription.
NOTE : because azure keeps the state of active subscription in ${AZURE_CONFIG_DIR:-$HOME/.azure/azureProfile.json}, the prompt command requires jq to be enabled to parse the file. If jq is not in the path the prompt will show nothing
Theme
The plugin creates an azure_prompt_info function that you can use in your theme, which displays
the current $azure_subscription. It uses two variables to control how that is shown:
-
ZSH_THEME_AZURE_PREFIX: sets the prefix of the azure_subscription. Defaults to
<az:. -
ZSH_THEME_azure_SUFFIX: sets the suffix of the azure_subscription. Defaults to
>.
RPROMPT='$(azure_prompt_info)'
Develop
On ubuntu get a working environment with :
docker run -it -v $(pwd):/mnt -w /mnt ubuntu bash
apt install -y curl jq zsh git vim
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
curl -sL https://aka.ms/InstallAzureCLIDeb | bash