docs: aws segment

This commit is contained in:
Jan De Dobbeleer 2021-02-12 12:49:37 +01:00 committed by Jan De Dobbeleer
parent 3c1c0f87df
commit 616cc3a685
3 changed files with 77 additions and 2 deletions

38
docs/docs/segment-aws.md Normal file
View file

@ -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/

View file

@ -9,6 +9,7 @@ module.exports = {
type: "category", type: "category",
label: "Segments", label: "Segments",
items: [ items: [
"aws",
"az", "az",
"battery", "battery",
"command", "command",

View file

@ -30,6 +30,12 @@
"description": "The string to display when the command is not available", "description": "The string to display when the command is not available",
"default": "" "default": ""
}, },
"template": {
"type": "string",
"title": "Template text",
"description": "The template to use to render the segment text",
"default": ""
},
"block": { "block": {
"type": "object", "type": "object",
"description": "https://ohmyposh.dev/docs/configure#block", "description": "https://ohmyposh.dev/docs/configure#block",
@ -137,7 +143,8 @@
"julia", "julia",
"ruby", "ruby",
"ytm", "ytm",
"executiontime" "executiontime",
"aws"
] ]
}, },
"style": { "style": {
@ -705,7 +712,36 @@
}, },
"then": { "then": {
"title": "Kubectl Segment", "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"
}
}
}
}
} }
}, },
{ {