diff --git a/docs/docs/segment-aws.md b/docs/docs/segment-aws.md new file mode 100644 index 00000000..05a931dd --- /dev/null +++ b/docs/docs/segment-aws.md @@ -0,0 +1,38 @@ +--- +id: aws +title: AWS Context +sidebar_label: AWS +--- + +## What + +Display the currently active AWS profile and region. + +## Sample Configuration + +```json +{ + "type": "aws", + "style": "powerline", + "powerline_symbol": "\uE0B0", + "foreground": "#ffffff", + "background": "#FFA400", + "properties": { + "prefix": " \uE7AD ", + "template": "{{.Profile}}{{if .Region}}@{{.Region}}{{end}}" + } +} +``` + +## Properties + +- template: `string` - A go [text/template][go-text-template] template extended with [sprig][sprig] utilizing the +properties below. Defaults to `{{.Context}}{{if .Namespace}} :: {{.Namespace}}{{end}}` + +## Template Properties + +- `.Profile`: `string` - the currently active profile +- `.Region`: `string` - the currently active region + +[go-text-template]: https://golang.org/pkg/text/template/ +[sprig]: https://masterminds.github.io/sprig/ diff --git a/docs/sidebars.js b/docs/sidebars.js index ca70ed36..0542613b 100644 --- a/docs/sidebars.js +++ b/docs/sidebars.js @@ -9,6 +9,7 @@ module.exports = { type: "category", label: "Segments", items: [ + "aws", "az", "battery", "command", diff --git a/themes/schema.json b/themes/schema.json index 0c6361cc..dfc355b3 100644 --- a/themes/schema.json +++ b/themes/schema.json @@ -30,6 +30,12 @@ "description": "The string to display when the command is not available", "default": "" }, + "template": { + "type": "string", + "title": "Template text", + "description": "The template to use to render the segment text", + "default": "" + }, "block": { "type": "object", "description": "https://ohmyposh.dev/docs/configure#block", @@ -137,7 +143,8 @@ "julia", "ruby", "ytm", - "executiontime" + "executiontime", + "aws" ] }, "style": { @@ -705,7 +712,36 @@ }, "then": { "title": "Kubectl Segment", - "description": "https://ohmyposh.dev/docs/kubectl" + "description": "https://ohmyposh.dev/docs/kubectl", + "properties": { + "properties": { + "properties": { + "template": { + "$ref": "#/definitions/template" + } + } + } + } + } + }, + { + "if": { + "properties": { + "type": { "const": "aws" } + } + }, + "then": { + "title": "AWS Segment", + "description": "https://ohmyposh.dev/docs/aws", + "properties": { + "properties": { + "properties": { + "template": { + "$ref": "#/definitions/template" + } + } + } + } } }, {