File tree Expand file tree Collapse file tree 1 file changed +20
-8
lines changed
Expand file tree Collapse file tree 1 file changed +20
-8
lines changed Original file line number Diff line number Diff line change @@ -9,19 +9,31 @@ import (
99func segmentAWS (p * powerline ) []pwl.Segment {
1010 profile := os .Getenv ("AWS_PROFILE" )
1111 region := os .Getenv ("AWS_DEFAULT_REGION" )
12- if profile == "" {
12+ var content string = ""
13+
14+ if len (profile ) == 0 {
1315 profile = os .Getenv ("AWS_VAULT" )
14- if profile == "" {
15- return []pwl.Segment {}
16- }
1716 }
18- var r string
19- if region != "" {
20- r = " (" + region + ")"
17+
18+ if len ( region ) == 0 {
19+ region = os . Getenv ( "AWS_REGION" )
2120 }
21+
22+ if len (region ) > 0 {
23+ content = "(" + region + ")"
24+ }
25+
26+ if len (profile ) > 0 {
27+ content = profile + " " + content
28+ }
29+
30+ if len (content ) == 0 {
31+ return []pwl.Segment {}
32+ }
33+
2234 return []pwl.Segment {{
2335 Name : "aws" ,
24- Content : profile + r ,
36+ Content : content ,
2537 Foreground : p .theme .AWSFg ,
2638 Background : p .theme .AWSBg ,
2739 }}
You can’t perform that action at this time.
0 commit comments