Skip to content

Commit

Permalink
aws_profile segment added
Browse files Browse the repository at this point in the history
  • Loading branch information
Bryan Grimes committed Jan 14, 2016
1 parent 9fb1c94 commit 334dd0c
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
powerline-shell.py
*.py[co]
config.py

.DS_Store
*sublime*
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,12 @@ settings.

# Changes

2016-01-14

* AWS profle support added per the `AWS_DEFAULT_PROFILE` setup described in [the AWS docs](http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html)
* `$ export AWS_DEFAULT_PROFILE=<NAME>`


2015-12-26

* Beginnings of unit testing for segments. Included in this change was a
Expand Down
11 changes: 11 additions & 0 deletions segments/aws_profile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

def add_aws_profile_segment(powerline):
import os

aws_profile = os.environ.get('AWS_PROFILE') or \
os.environ.get('AWS_DEFAULT_PROFILE')

if aws_profile:
powerline.append(' aws:%s ' % os.path.basename(aws_profile),
Color.AWS_PROFILE_FG,
Color.AWS_PROFILE_BG)
17 changes: 10 additions & 7 deletions themes/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ class Color(DefaultColor):
HOSTNAME_BG = 7

HOME_SPECIAL_DISPLAY = False
PATH_BG = 8 # dark grey
PATH_FG = 7 # light grey
CWD_FG = 15 # white
PATH_BG = 8 # dark grey
PATH_FG = 7 # light grey
CWD_FG = 15 # white
SEPARATOR_FG = 7

READONLY_BG = 1
READONLY_FG = 15

REPO_CLEAN_BG = 2 # green
REPO_CLEAN_FG = 0 # black
REPO_DIRTY_BG = 1 # red
REPO_DIRTY_FG = 15 # white
REPO_CLEAN_BG = 2 # green
REPO_CLEAN_FG = 0 # black
REPO_DIRTY_BG = 1 # red
REPO_DIRTY_FG = 15 # white

JOBS_FG = 14
JOBS_BG = 8
Expand All @@ -35,3 +35,6 @@ class Color(DefaultColor):

VIRTUAL_ENV_BG = 2
VIRTUAL_ENV_FG = 0

AWS_PROFILE_FG = 14
AWS_PROFILE_BG = 8
6 changes: 5 additions & 1 deletion themes/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class DefaultColor:
READONLY_BG = 124
READONLY_FG = 254

SSH_BG = 166 # medium orange
SSH_BG = 166 # medium orange
SSH_FG = 254

REPO_CLEAN_BG = 148 # a light green color
Expand Down Expand Up @@ -56,6 +56,10 @@ class DefaultColor:
VIRTUAL_ENV_BG = 35 # a mid-tone green
VIRTUAL_ENV_FG = 00

AWS_PROFILE_FG = 39
AWS_PROFILE_BG = 238


class Color(DefaultColor):
"""
This subclass is required when the user chooses to use 'default' theme.
Expand Down
3 changes: 3 additions & 0 deletions themes/solarized-dark.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ class Color(DefaultColor):

VIRTUAL_ENV_BG = 15
VIRTUAL_ENV_FG = 2

AWS_PROFILE_FG = 7
AWS_PROFILE_BG = 2
3 changes: 3 additions & 0 deletions themes/washed.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ class Color(DefaultColor):

VIRTUAL_ENV_BG = 150
VIRTUAL_ENV_FG = 0

AWS_PROFILE_FG = 0
AWS_PROFILE_BG = 7

0 comments on commit 334dd0c

Please sign in to comment.