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
|
||||
// CacheTimeout cache timeout
|
||||
CacheTimeout Property = "cache_timeout"
|
||||
// Files to trigger the segment on
|
||||
Files Property = "files"
|
||||
)
|
||||
|
||||
type Map map[Property]any
|
||||
|
|
|
@ -41,12 +41,17 @@ func (c *CfTarget) Enabled() bool {
|
|||
return c.setCFTargetStatus()
|
||||
}
|
||||
|
||||
manifest, err := c.env.HasParentFilePath("manifest.yml", false)
|
||||
if err != nil || manifest.IsDir {
|
||||
return false
|
||||
files := c.props.GetStringArray(properties.Files, []string{"manifest.yml"})
|
||||
for _, file := range files {
|
||||
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 {
|
||||
|
|
|
@ -10,22 +10,25 @@ Display the details of the logged [Cloud Foundry endpoint][cf-target] (`cf targe
|
|||
|
||||
## Sample Configuration
|
||||
|
||||
import Config from '@site/src/components/Config.js';
|
||||
import Config from "@site/src/components/Config.js";
|
||||
|
||||
<Config data={{
|
||||
"background": "#a7cae1",
|
||||
"foreground": "#100e23",
|
||||
"powerline_symbol": "\ue0b0",
|
||||
"template": " \uf40a {{ .Org }}/{{ .Space }} ",
|
||||
"style": "powerline",
|
||||
"type": "cftarget"
|
||||
}}/>
|
||||
<Config
|
||||
data={{
|
||||
background: "#a7cae1",
|
||||
foreground: "#100e23",
|
||||
powerline_symbol: "\ue0b0",
|
||||
template: " \uf40a {{ .Org }}/{{ .Space }} ",
|
||||
style: "powerline",
|
||||
type: "cftarget",
|
||||
}}
|
||||
/>
|
||||
|
||||
## Properties
|
||||
|
||||
| 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> |
|
||||
| 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 (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])
|
||||
|
||||
|
|
Loading…
Reference in a new issue