refactor: update defaults in docs

This commit is contained in:
Jan De Dobbeleer 2020-10-16 20:07:38 +02:00 committed by Jan De Dobbeleer
parent 2821fe6424
commit 23233bc383
16 changed files with 66 additions and 84 deletions

View file

@ -1,6 +1,7 @@
{
"MD024": false,
"MD014": false,
"MD038": false,
"line-length": {
"line_length": 120
}

View file

@ -261,16 +261,7 @@ override or transparent background color using the segement's [foreground][fg] p
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#193549",
"background": "#ffeb3b",
"properties": {
"branch_icon": "",
"branch_identical_icon": "≡",
"branch_ahead_icon": "↑",
"branch_behind_icon": "↓",
"branch_gone_icon": "≢",
"local_working_icon": "",
"local_staged_icon": ""
}
"background": "#ffeb3b"
},
{
"type": "exit",

View file

@ -29,7 +29,7 @@ func (n *new) enabled() bool {
}
func (n *new) string() string {
newText := n.props.getString(NewProp, "n00b")
newText := n.props.getString(NewProp, "\uEFF1")
return newText
}
@ -39,6 +39,10 @@ func (n *new) init(props *properties, env environmentInfo) {
}
```
When it comes to properties, make sure to use the UTF32 representation (e.g. "\uEFF1") rather than the icon itself.
This will facilitate the review process as not all environments display the icons based on the font being used.
You can find these values and query for icons easily at [Nerd Fonts][nf-icons].
For each segment, there's a single test file ensuring the functionality going forward. The convention
is `new_segment_test.go`, have a look at existing segment tests for inspiration.
@ -96,14 +100,14 @@ Display something new.
"foreground": "#193549",
"background": "#ffeb3b",
"properties": {
"newprop": "w00p"
"newprop": "\uEFF1"
}
}
```
## Properties
- newprop: `string` - the new text to show
- newprop: `string` - the new text to show - defaults to `\uEFF1`
````
## Map the new documentation in the sidebar
@ -118,3 +122,4 @@ And be patient, I'm going as fast as I can 🏎
[themes]: https://github.com/JanDeDobbeleer/oh-my-posh3/tree/main/themes
[docs]: https://github.com/JanDeDobbeleer/oh-my-posh3/tree/main/docs/docs
[sidebars]: https://github.com/JanDeDobbeleer/oh-my-posh3/blob/main/docs/sidebars.js
[nf-icons]: https://www.nerdfonts.com/cheat-sheet

View file

@ -21,7 +21,7 @@ Display the currently active Azure subscription information.
"display_id": true,
"display_name": true,
"info_separator": " @ ",
"prefix": " "
"prefix": " \uFD03 "
}
}
```

View file

@ -33,14 +33,14 @@ Battery displays the remaining power percentage for your battery.
## Properties
- battery_icon: `string` - the icon to use as a prefix for the battery percentage
- display_error: `boolean` - show the error context when failing to retrieve the battery information
- charging_icon: `string` - icon to display on the left when charging
- discharging_icon: `string` - icon to display on the left when discharging
- charged_icon: `string` - icon to display on the left when fully charged
- color_background: `boolean` - color the background or foreground for properties below
- charged_color: `string` [hex color code][colors] - color to use when fully charged
- charging_color: `string` [hex color code][colors] - color to use when charging
- discharging_color: `string` [hex color code][colors] - color to use when discharging
- battery_icon: `string` - the icon to use as a prefix for the battery percentage - defaults to empty
- display_error: `boolean` - show the error context when failing to retrieve the battery information - defaults to `true`
- charging_icon: `string` - icon to display on the left when charging - defaults to empty
- discharging_icon: `string` - icon to display on the left when discharging - defaults to empty
- charged_icon: `string` - icon to display on the left when fully charged - defaults to empty
- color_background: `boolean` - color the background or foreground for properties below - defaults to `false`
- charged_color: `string` [hex color code][colors] - color to use when fully charged - defaults to segment color
- charging_color: `string` [hex color code][colors] - color to use when charging - defaults to segment color
- discharging_color: `string` [hex color code][colors] - color to use when discharging - defaults to segment color
[colors]: https://htmlcolorcodes.com/color-chart/material-design-color-chart/

View file

@ -30,9 +30,9 @@ Displays the last exit code or that the last command failed based on the configu
## Properties
- display_exit_code: `boolean` - show or hide the exit code
- always_enabled: `boolean` - always show the status
- color_background: `boolean` - color the background or foreground when an error occurs
- display_exit_code: `boolean` - show or hide the exit code - defaults to `true`
- always_enabled: `boolean` - always show the status - defaults to `false`
- color_background: `boolean` - color the background or foreground when an error occurs - defaults to `false`
- error_color: `string` [hex color code][colors] - color to use when an error occured
[colors]: https://htmlcolorcodes.com/color-chart/material-design-color-chart/

View file

@ -23,24 +23,8 @@ Local changes can also shown by default using the following syntax for both the
"foreground": "#193549",
"background": "#ffeb3b",
"properties": {
"branch_icon": "",
"branch_identical_icon": "≡",
"branch_ahead_icon": "↑",
"branch_behind_icon": "↓",
"local_working_icon": "",
"local_staged_icon": "",
"rebase_icon": " ",
"cherry_pick_icon": " ",
"commit_icon": " ",
"tag_icon": "笠 ",
"display_stash_count": true,
"stash_count_icon": "\uF692 ",
"merge_icon": "\uE726 ",
"display_upstream_icon": true,
"github_icon": "\uE709",
"bitbucket_icon": "\uE703",
"gitlab_icon": "\uE296",
"git_icon": "\uE702"
"display_upstream_icon": true
}
}
```
@ -49,32 +33,33 @@ Local changes can also shown by default using the following syntax for both the
### Standard
- branch_icon: `string` - the icon to use in front of the git branch name
- branch_identical_icon: `string` - the icon to display when remote and local are identical
- branch_ahead_icon: `string` - the icon to display when the local branch is ahead of its remote
- branch_behind_icon: `string` - the icon to display when the local branch is behind its remote
- branch_icon: `string` - the icon to use in front of the git branch name - defaults to `\uE0A`
- branch_identical_icon: `string` - the icon to display when remote and local are identical - defaults to `\uF0C9`
- branch_ahead_icon: `string` - the icon to display when the local branch is ahead of its remote - defaults to `\uF176`
- branch_behind_icon: `string` - the icon to display when the local branch is behind its remote - defaults to `\uF175`
- branch_gone_icon: `string` - the icon to display when there's no remote branch - defaults to `\u2262`
### Status
- display_status: `boolean` - display the local changes or not
- display_stash_count: `boolean` show stash count or not
- status_separator_icon: `string` icon/text to display between staging and working area changes
- local_working_icon: `string` - the icon to display in front of the working area changes
- local_staged_icon: `string` - the icon to display in front of the staged area changes
- stash_count_icon: `string` icon/text to display before the stash context
- display_status: `boolean` - display the local changes or not - defaults to `true`
- display_stash_count: `boolean` show stash count or not - defaults to `false`
- status_separator_icon: `string` icon/text to display between staging and working area changes - defaults to ` |`
- local_working_icon: `string` - the icon to display in front of the working area changes - defaults to `\uF044`
- local_staged_icon: `string` - the icon to display in front of the staged area changes - defaults to `\uF046`
- stash_count_icon: `string` icon/text to display before the stash context - defaults to `\uF692`
### HEAD context
- commit_icon: `string` - icon/text to display before the commit context (detached HEAD)
- tag_icon: `string` - icon/text to display before the tag context
- rebase_icon: `string` - icon/text to display before the context when in a rebase
- cherry_pick_icon: `string` - icon/text to display before the context when doing a cherry-pick
- merge_icon: `string` icon/text to display before the merge context
- commit_icon: `string` - icon/text to display before the commit context (detached HEAD) - defaults to `\uF417`
- tag_icon: `string` - icon/text to display before the tag context - defaults to `\uF412`
- rebase_icon: `string` - icon/text to display before the context when in a rebase - defaults to `\uE728 `
- cherry_pick_icon: `string` - icon/text to display before the context when doing a cherry-pick - defaults to `\uE29B `
- merge_icon: `string` icon/text to display before the merge context - defaults to `\uE727 `
### Upstream context
- display_upstream_icon: `boolean` - display upstrean icon or not
- github_icon: `string` - icon/text to display when the upstream is Github
- gitlab_icon: `string` - icon/text to display when the upstream is Gitlab
- bitbucket_icon: `string` - icon/text to display when the upstream is Bitbucket
- git_icon: `string` - icon/text to display when the upstream is not known/mapped
- display_upstream_icon: `boolean` - display upstrean icon or not - defaults to `false`
- github_icon: `string` - icon/text to display when the upstream is Github - defaults to `\uF408 `
- gitlab_icon: `string` - icon/text to display when the upstream is Gitlab - defaults to `\uF296 `
- bitbucket_icon: `string` - icon/text to display when the upstream is Bitbucket - defaults to `\uF171 `
- git_icon: `string` - icon/text to display when the upstream is not known/mapped - defaults to `\uE5FB `

View file

@ -14,11 +14,11 @@ Display the currently active Kubernetes context name.
{
"type": "kubectl",
"style": "powerline",
"powerline_symbol": "",
"powerline_symbol": "\uE0B0",
"foreground": "#000000",
"background": "#ebcc34",
"properties": {
"prefix": " "
"prefix": " \uFD31 "
}
}
```

View file

@ -25,6 +25,6 @@ Display OS specific info. Defaults to Icon.
## Properties
- macos: `string` - the string to use for macOS - defaults to macOS icon
- linux: `string` - the icon to use for Linux - defaults to Linux icon
- windows: `string` - the icon to use for Windows - defaults to Windows icon
- macos: `string` - the string to use for macOS - defaults to macOS icon - defaults to `\uF179`
- linux: `string` - the icon to use for Linux - defaults to Linux icon - defaults to `\uF17C`
- windows: `string` - the icon to use for Windows - defaults to Windows icon - defaults to `\uE62A`

View file

@ -25,10 +25,10 @@ Display the current path.
## Properties
- folder_separator_icon: `string` - the symbol to use as a separator between folders
- home_icon: `string` - the icon to display when at `$HOME`
- folder_icon: `string` - the icon to use as a folder indication
- windows_registry_icon: `string` - the icon to display when in the Windows registry
- folder_separator_icon: `string` - the symbol to use as a separator between folders - defaults to platfrom path separator
- home_icon: `string` - the icon to display when at `$HOME` - 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`
- style: `enum` - how to display the current path
## Style

View file

@ -26,4 +26,4 @@ Supports conda, virtualenv and pyenv.
## Properties
- display_virtual_env: `boolean` - show the name of the virtualenv or not, defaults to `true`.
- display_virtual_env: `boolean` - show the name of the virtualenv or not - defaults to `true`

View file

@ -25,4 +25,4 @@ Show when the current user is root or when in an elevated shell (Windows).
## Properties
- root_icon: `string` - icon to display in case of root/elevated.
- root_icon: `string` - icon to display in case of root/elevated - defaults to `\uF0E7`

View file

@ -23,10 +23,10 @@ Show the current user and host name.
## Properties
- user_info_separator: `string` - text/icon to put in between the user and host name.
- user_color: `string` [hex color code][colors] - override the foreground color of the user name.
- host_color: `string` [hex color code][colors] - override the foreground color of the host name.
- display_user: `boolean` - display the user name or not default: `true`.
- display_host: `boolean` - display the host name or not default: `true`.
- user_info_separator: `string` - text/icon to put in between the user and host name - defaults to `@`
- user_color: `string` [hex color code][colors] - override the foreground color of the user name
- host_color: `string` [hex color code][colors] - override the foreground color of the host name
- display_user: `boolean` - display the user name or not - defaults to `true`
- display_host: `boolean` - display the host name or not - defaults to `true`
[colors]: https://htmlcolorcodes.com/color-chart/material-design-color-chart/

View file

@ -28,6 +28,6 @@ Be aware this can make the prompt a tad bit slower as it needs to get a response
## Properties
- playing_icon: `string` - text/icon to show when playing.
- paused_icon: `string` - text/icon to show when paused.
- track_separator: `string` - text/icon to put between the artist and song name.
- playing_icon: `string` - text/icon to show when playing - defaults to `\uE602 `
- paused_icon: `string` - text/icon to show when paused - defaults to `\uF8E3 `
- track_separator: `string` - text/icon to put between the artist and song name - defaults to ` - `

View file

@ -23,6 +23,6 @@ Show the current timestamp.
## Properties
- time_format: `string` - format to use, follows the [golang standard][format].
- time_format: `string` - format to use, follows the [golang standard][format] - defaults to `15:04:05`
[format]: https://gobyexample.com/time-formatting-parsing

View file

@ -101,7 +101,7 @@ func (pt *path) rootLocation(pwd string) string {
splitted := strings.Split(pwd, pt.env.getPathSeperator())
rootLocation := splitted[0]
mappedLocations := map[string]string{
"HKCU:": pt.props.getString(WindowsRegistryIcon, "HK:"),
"HKCU:": pt.props.getString(WindowsRegistryIcon, "\uE0B1"),
}
if val, ok := mappedLocations[rootLocation]; ok {
return val