-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added hostname segment and isGitDir #1
base: master
Are you sure you want to change the base?
Conversation
baol
commented
Oct 27, 2016
•
edited
Loading
edited
- Implemented a simple hostname segment
- isGitDir will avoid spawning a process when not in a git dir
@@ -21,7 +21,7 @@ import ( | |||
"fmt" | |||
"os" | |||
|
|||
"github.com/otann/powerline-go/powerline" | |||
"github.com/baol/powerline-go/powerline" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I understand the purpose behind, but it doesn't makes sense in this fork ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, went in by mistake!
func HostSegment(t Theme) Segment { | ||
hn, _ := os.Hostname() | ||
return Segment{ | ||
Bg: t.Lock.Bg, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be additional config for home segment colors as well?
@@ -124,7 +146,11 @@ func getGitInformation() (string, bool) { | |||
return status, staged | |||
} | |||
|
|||
func GitSegment(t Theme) Segment { | |||
func GitSegment(cwdParts []string, t Theme) Segment { | |||
if !isGitDir(cwdParts) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be done in getGitInformation
, also isn't there a way to check same thing without constructing a path from it's parts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe, maybe not. getGitInformation at the moment gets information from git, isGitDir is a pre-filter. cwdParts was the closest information to what was needed that is already available to other segments.
Thanks a lot for this segment! This will be of much use, when reading configuration from file will be added |
How would you handle reading from config without reading the config every time? Env variables maybe? |
I think both, readingsimple json from file should be really quick |