mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-28 04:19:41 -08:00
fix: use Property for mapped locations
This commit is contained in:
parent
b6669a4506
commit
33e3307fc6
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue