fix: use Property for mapped locations

This commit is contained in:
Jan De Dobbeleer 2020-11-27 20:10:19 +01:00 committed by Jan De Dobbeleer
parent b6669a4506
commit 33e3307fc6
2 changed files with 5 additions and 3 deletions

View file

@ -19,7 +19,7 @@ Display the current path.
"background": "#61AFEF", "background": "#61AFEF",
"properties": { "properties": {
"style": "folder", "style": "folder",
"mappedlocations": [ "mapped_locations": [
["C:\\temp", "\ue799"] ["C:\\temp", "\ue799"]
] ]
} }
@ -33,7 +33,7 @@ Display the current path.
- folder_icon: `string` - the icon to use as a folder indication - defaults to `..` - 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` - windows_registry_icon: `string` - the icon to display when in the Windows registry - defaults to `\uE0B1`
- style: `enum` - how to display the current path - 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 ## Style

View file

@ -32,6 +32,8 @@ const (
Full string = "full" Full string = "full"
// Folder displays the current folder // Folder displays the current folder
Folder string = "folder" Folder string = "folder"
// MappedLocations allows overriding certain location with an icon
MappedLocations Property = "mapped_locations"
) )
func (pt *path) enabled() bool { func (pt *path) enabled() bool {
@ -74,7 +76,7 @@ func (pt *path) getShortPath() string {
// merge custom locations with mapped locations // merge custom locations with mapped locations
// mapped locations can override predefined 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 { for key, val := range keyValues {
mappedLocations[key] = val mappedLocations[key] = val
} }