Skip to content

Commit

Permalink
Merge pull request #38 from pmenglund/aws
Browse files Browse the repository at this point in the history
add support for displaying aws profile
  • Loading branch information
justjanne authored Oct 8, 2017
2 parents 778f40e + 2fc03da commit 97d6751
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
17 changes: 17 additions & 0 deletions aws.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package main

import (
"fmt"
"os"
)

func segmentAWS(p *powerline) {
profile, _ := os.LookupEnv("AWS_PROFILE")
if profile != "" {
p.appendSegment("aws", segment{
content: fmt.Sprintf(" %s ", profile),
foreground: p.theme.AWSFg,
background: p.theme.AWSBg,
})
}
}
3 changes: 3 additions & 0 deletions defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ var themes = map[string]Theme{
DotEnvFg: 15, // white
DotEnvBg: 55, // purple

AWSFg: 15, // white
AWSBg: 22, // dark green

RepoCleanFg: 0, // black
RepoCleanBg: 148, // a light green color
RepoDirtyFg: 15, // white
Expand Down
5 changes: 3 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ func getValidCwd() string {
}

var modules = map[string](func(*powerline)){
"aws": segmentAWS,
"cwd": segmentCwd,
"docker": segmentDocker,
"dotenv": segmentDotEnv,
Expand Down Expand Up @@ -127,12 +128,12 @@ func main() {
Modules: flag.String("modules",
"venv,user,host,ssh,cwd,perms,git,hg,jobs,exit,root",
"The list of modules to load, separated by ','\n"+
" (valid choices: cwd, docker, dotenv, exit, git, gitlite, hg, host, jobs, perlbrew, perms, root, ssh, time, user, venv)\n"+
" (valid choices: aws, cwd, docker, dotenv, exit, git, gitlite, hg, host, jobs, perlbrew, perms, root, ssh, time, user, venv)\n"+
" "),
Priority: flag.String("priority",
"root,cwd,user,host,ssh,perms,git-branch,git-status,hg,jobs,exit",
"Segments sorted by priority, if not enough space exists, the least priorized segments are removed first. Separate with ','\n"+
" (valid choices: cwd, docker, exit, git-branch, git-status, hg, host, jobs, perlbrew, perms, root, ssh, time, user, venv)\n"+
" (valid choices: aws, cwd, docker, exit, git-branch, git-status, hg, host, jobs, perlbrew, perms, root, ssh, time, user, venv)\n"+
" "),
MaxWidthPercentage: flag.Int("max-width",
50,
Expand Down
3 changes: 3 additions & 0 deletions themes.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ type Theme struct {
DotEnvFg uint8
DotEnvBg uint8

AWSFg uint8
AWSBg uint8

RepoCleanFg uint8
RepoCleanBg uint8
RepoDirtyFg uint8
Expand Down

0 comments on commit 97d6751

Please sign in to comment.