docs: adjust contributing-segment.md

This commit is contained in:
Elio Struyf 2022-03-10 16:59:42 +01:00 committed by Jan De Dobbeleer
parent 1b27ad7a5f
commit b512b1d487

View file

@ -12,7 +12,7 @@ Ensure `New` is a single verb indicating the context the segment renders.
You can use the following template as a guide. You can use the following template as a guide.
```go ```go
package main package segments
import ( import (
"oh-my-posh/environment" "oh-my-posh/environment"
@ -32,7 +32,7 @@ const (
) )
func (n *new) Enabled() bool { func (n *new) Enabled() bool {
true return true
} }
func (n *new) Template() string { func (n *new) Template() string {
@ -42,6 +42,8 @@ func (n *new) Template() string {
func (n *new) Init(props properties.Properties, env environment.Environment) { func (n *new) Init(props properties.Properties, env environment.Environment) {
n.props = props n.props = props
n.env = env n.env = env
n.Text = props.GetString(NewProp, "Hello")
} }
``` ```
@ -146,7 +148,7 @@ At `$.definitions.segment.allOf`, add your segment details:
"properties": { "properties": {
"properties": { "properties": {
"properties": { "properties": {
"nwprop": { "newprop": {
"type": "boolean", "type": "boolean",
"title": "New Property", "title": "New Property",
"description": "the default text to display", "description": "the default text to display",