diff --git a/README.md b/README.md index 760f7a12f..716a13fbc 100644 --- a/README.md +++ b/README.md @@ -145,6 +145,7 @@ The segments that are currently available are: * **AWS Segments:** * [`aws`](segments/aws/README.md) - The current AWS profile, if active. * [`aws_eb_env`](segments/aws_eb_env/README.md) - The current Elastic Beanstalk Environment. +* [`azure`](segments/azure/README.md) - The current Azure subscription, if active. * [`docker_machine`](segments/docker_machine/README.md) - The current Docker Machine. * [`kubecontext`](segments/kubecontext/README.md) - The current context of your `kubectl` configuration. * [`dropbox`](segments/dropbox/README.md) - Indicates Dropbox directory and syncing status using `dropbox-cli` diff --git a/segments/azure/README.md b/segments/azure/README.md new file mode 100644 index 000000000..a6d709eef --- /dev/null +++ b/segments/azure/README.md @@ -0,0 +1,27 @@ +# Azure + +![](segment.png) + +## Installation + +To use this segment, you need to activate it by adding `azure` to your +`P9K_LEFT_PROMPT_ELEMENTS` or `P9K_RIGHT_PROMPT_ELEMENTS` array, depending +where you want to show this segment. + +## Configuration + +This segment shows the current active Microsoft Azure subscription using the `az`command provided by [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest) + + +### Color Customization + +You can change the foreground and background color of this segment by setting +``` +P9K_AZURE_FOREGROUND='red' +P9K_AZURE_BACKGROUND='blue' +``` + +### Customize Icon + +The main Icon can be changed by setting `P9K_AZURE_ICON="my_icon"`. To change the +icon color only, set `P9K_AZURE_ICON_COLOR="red"`. diff --git a/segments/azure/azure.p9k b/segments/azure/azure.p9k new file mode 100644 index 000000000..b1ea2b47d --- /dev/null +++ b/segments/azure/azure.p9k @@ -0,0 +1,36 @@ +# vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8 +################################################################ +# @title powerlevel9k Segment - Python Environment +# @source [powerlevel9k](https://github.com/bhilburn/powerlevel9k) +## + +(){ + # Set the right locale to protect special characters + local LC_ALL="" LC_CTYPE="en_US.UTF-8" + ################################################################ + # Register segment + # Parameters: + # segment_name context background foreground Generic Flat/Awesome-Patched Awesome-FontConfig Awesome-Mapped-FontConfig NerdFont + #   ☁ ﴃ + p9k::register_segment "AZURE" "" "69" "231" '' $'\uE60F' $'\uE60F' $'\U2601' $'\uFD03 ' + + ################################################################ +} + +################################################################ +# @description +# Display the current active Microsoft Azure subscription +## +# @args +# $1 string Alignment - left | right +# $2 integer Segment index +# $3 boolean Whether the segment should be joined +## +prompt_azure() { + if [ $commands[az] ]; then + local az_account="$(az account show --query name -o tsv)" + if [[ -n "$az_account" ]]; then + p9k::prepare_segment "$0" "" $1 "$2" $3 "${az_account}" + fi + fi +} diff --git a/segments/azure/segment.png b/segments/azure/segment.png new file mode 100644 index 000000000..e00231b31 Binary files /dev/null and b/segments/azure/segment.png differ diff --git a/segments/azure/segment.svg b/segments/azure/segment.svg new file mode 100644 index 000000000..917602d60 --- /dev/null +++ b/segments/azure/segment.svg @@ -0,0 +1,282 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + Fonts needed:- ubuntu- ubuntu Nerd Font + + + + + + + + + + + + + + + + + + + + ﴃ MySubscription + + + + + + + + + + + + + + + + + + + + +