Skip to content

Commit

Permalink
fix: use Property for mapped locations
Browse files Browse the repository at this point in the history
  • Loading branch information
JanDeDobbeleer committed Nov 28, 2020
1 parent b6669a4 commit 33e3307
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions docs/docs/segment-path.md
Expand Up @@ -19,7 +19,7 @@ Display the current path.
"background": "#61AFEF",
"properties": {
"style": "folder",
"mappedlocations": [
"mapped_locations": [
["C:\\temp", "\ue799"]
]
}
Expand All @@ -33,7 +33,7 @@ Display the current path.
- folder_icon: `string` - the icon to use as a folder indication - defaults to `..`
- windows_registry_icon: `string` - the icon to display when in the Windows registry - defaults to `\uE0B1`
- style: `enum` - how to display the current path
- mappedlocations: `[]string` - Custom glyph/text for specific paths(only when `style` is set to `agnoster`, `agnosterfull` or `short`)
- mapped_locations: `map[string]string` - custom glyph/text for specific paths(only when `style` is set to `agnoster`, `agnosterfull` or `short`)

## Style

Expand Down
4 changes: 3 additions & 1 deletion segment_path.go
Expand Up @@ -32,6 +32,8 @@ const (
Full string = "full"
// Folder displays the current folder
Folder string = "folder"
// MappedLocations allows overriding certain location with an icon
MappedLocations Property = "mapped_locations"
)

func (pt *path) enabled() bool {
Expand Down Expand Up @@ -74,7 +76,7 @@ func (pt *path) getShortPath() string {

// merge custom locations with mapped locations
// mapped locations can override predefined locations
keyValues := pt.props.getKeyValueMap("mappedlocations", make(map[string]string))
keyValues := pt.props.getKeyValueMap(MappedLocations, make(map[string]string))
for key, val := range keyValues {
mappedLocations[key] = val
}
Expand Down

0 comments on commit 33e3307

Please sign in to comment.