mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-11-09 20:44:03 -08:00
parent
b67756001f
commit
0700dfa594
|
@ -53,6 +53,8 @@ const (
|
||||||
DefaultCacheTimeout = 10
|
DefaultCacheTimeout = 10
|
||||||
// CacheTimeout cache timeout
|
// CacheTimeout cache timeout
|
||||||
CacheTimeout Property = "cache_timeout"
|
CacheTimeout Property = "cache_timeout"
|
||||||
|
// Files to trigger the segment on
|
||||||
|
Files Property = "files"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Map map[Property]any
|
type Map map[Property]any
|
||||||
|
|
|
@ -41,12 +41,17 @@ func (c *CfTarget) Enabled() bool {
|
||||||
return c.setCFTargetStatus()
|
return c.setCFTargetStatus()
|
||||||
}
|
}
|
||||||
|
|
||||||
manifest, err := c.env.HasParentFilePath("manifest.yml", false)
|
files := c.props.GetStringArray(properties.Files, []string{"manifest.yml"})
|
||||||
if err != nil || manifest.IsDir {
|
for _, file := range files {
|
||||||
return false
|
manifest, err := c.env.HasParentFilePath(file, false)
|
||||||
|
if err != nil || manifest.IsDir {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
return c.setCFTargetStatus()
|
||||||
}
|
}
|
||||||
|
|
||||||
return c.setCFTargetStatus()
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *CfTarget) setCFTargetStatus() bool {
|
func (c *CfTarget) setCFTargetStatus() bool {
|
||||||
|
|
|
@ -10,22 +10,25 @@ Display the details of the logged [Cloud Foundry endpoint][cf-target] (`cf targe
|
||||||
|
|
||||||
## Sample Configuration
|
## Sample Configuration
|
||||||
|
|
||||||
import Config from '@site/src/components/Config.js';
|
import Config from "@site/src/components/Config.js";
|
||||||
|
|
||||||
<Config data={{
|
<Config
|
||||||
"background": "#a7cae1",
|
data={{
|
||||||
"foreground": "#100e23",
|
background: "#a7cae1",
|
||||||
"powerline_symbol": "\ue0b0",
|
foreground: "#100e23",
|
||||||
"template": " \uf40a {{ .Org }}/{{ .Space }} ",
|
powerline_symbol: "\ue0b0",
|
||||||
"style": "powerline",
|
template: " \uf40a {{ .Org }}/{{ .Space }} ",
|
||||||
"type": "cftarget"
|
style: "powerline",
|
||||||
}}/>
|
type: "cftarget",
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
|
||||||
| Name | Type | Default | Description |
|
| Name | Type | Default | Description |
|
||||||
| -------------- | :------: | :------: | ------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| -------------- | :--------: | :----------------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| `display_mode` | `string` | `always` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when a `manifest.yml` file is present </li></ul> |
|
| `display_mode` | `string` | `always` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when a `manifest.yml` file is present (or defined otherwise using `files`) </li></ul> |
|
||||||
|
| `files` | `[]string` | `["manifest.yml"]` | on which files to display the segment on. Will look in parent folders as well |
|
||||||
|
|
||||||
## Template ([info][templates])
|
## Template ([info][templates])
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue