Skip to content
This repository has been archived by the owner on Apr 24, 2020. It is now read-only.

[New Segment]: Microsoft Azure segment #1192

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
27 changes: 27 additions & 0 deletions segments/azure/README.md
Original file line number Diff line number Diff line change
@@ -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"`.
36 changes: 36 additions & 0 deletions segments/azure/azure.p9k
Original file line number Diff line number Diff line change
@@ -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
}
Binary file added segments/azure/segment.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
282 changes: 282 additions & 0 deletions segments/azure/segment.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.