From b442c06a1bcb260231e6aa7a3b1bfe365c595f2e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Mar 2024 00:34:15 +0000 Subject: [PATCH 001/157] chore(deps): bump github.com/stretchr/testify in /src Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.4 to 1.9.0. - [Release notes](https://github.com/stretchr/testify/releases) - [Commits](https://github.com/stretchr/testify/compare/v1.8.4...v1.9.0) --- updated-dependencies: - dependency-name: github.com/stretchr/testify dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- src/go.mod | 4 ++-- src/go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/go.mod b/src/go.mod index 0cee09da..4ad0fd10 100644 --- a/src/go.mod +++ b/src/go.mod @@ -20,8 +20,8 @@ require ( github.com/mitchellh/mapstructure v1.5.0 github.com/sergi/go-diff v1.3.1 // indirect github.com/shirou/gopsutil/v3 v3.24.1 - github.com/stretchr/objx v0.5.1 // indirect - github.com/stretchr/testify v1.8.4 + github.com/stretchr/objx v0.5.2 // indirect + github.com/stretchr/testify v1.9.0 github.com/wayneashleyberry/terminal-dimensions v1.1.0 golang.org/x/crypto v0.19.0 // indirect golang.org/x/image v0.15.0 diff --git a/src/go.sum b/src/go.sum index 2613b9a9..dceea234 100644 --- a/src/go.sum +++ b/src/go.sum @@ -177,16 +177,16 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/objx v0.5.1 h1:4VhoImhV/Bm0ToFkXFi8hXNXwpDRZ/ynw3amt82mzq0= -github.com/stretchr/objx v0.5.1/go.mod h1:/iHQpkQwBD6DLUmQ4pE+s1TXdob1mORJ4/UFdrifcy0= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= github.com/tklauser/go-sysconf v0.3.13 h1:GBUpcahXSpR2xN01jhkNAbTLRk2Yzgggk8IM08lq3r4= github.com/tklauser/go-sysconf v0.3.13/go.mod h1:zwleP4Q4OehZHGn4CYZDipCgg9usW5IJePewFCGVEa0= From fefa3117620a1bafeae6197a73c580fecc08de2a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Mar 2024 01:03:50 +0000 Subject: [PATCH 002/157] chore(deps): bump github.com/shirou/gopsutil/v3 in /src Bumps [github.com/shirou/gopsutil/v3](https://github.com/shirou/gopsutil) from 3.24.1 to 3.24.2. - [Release notes](https://github.com/shirou/gopsutil/releases) - [Commits](https://github.com/shirou/gopsutil/compare/v3.24.1...v3.24.2) --- updated-dependencies: - dependency-name: github.com/shirou/gopsutil/v3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/go.mod | 2 +- src/go.sum | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/go.mod b/src/go.mod index 4ad0fd10..6b2e8dd5 100644 --- a/src/go.mod +++ b/src/go.mod @@ -19,7 +19,7 @@ require ( github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/mapstructure v1.5.0 github.com/sergi/go-diff v1.3.1 // indirect - github.com/shirou/gopsutil/v3 v3.24.1 + github.com/shirou/gopsutil/v3 v3.24.2 github.com/stretchr/objx v0.5.2 // indirect github.com/stretchr/testify v1.9.0 github.com/wayneashleyberry/terminal-dimensions v1.1.0 diff --git a/src/go.sum b/src/go.sum index dceea234..916fef53 100644 --- a/src/go.sum +++ b/src/go.sum @@ -156,8 +156,8 @@ github.com/sahilm/fuzzy v0.1.1-0.20230530133925-c48e322e2a8f h1:MvTmaQdww/z0Q4wr github.com/sahilm/fuzzy v0.1.1-0.20230530133925-c48e322e2a8f/go.mod h1:VFvziUEIMCrT6A6tw2RFIXPXXmzXbOsSHF0DOI8ZK9Y= github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= -github.com/shirou/gopsutil/v3 v3.24.1 h1:R3t6ondCEvmARp3wxODhXMTLC/klMa87h2PHUw5m7QI= -github.com/shirou/gopsutil/v3 v3.24.1/go.mod h1:UU7a2MSBQa+kW1uuDq8DeEBS8kmrnQwsv2b5O513rwU= +github.com/shirou/gopsutil/v3 v3.24.2 h1:kcR0erMbLg5/3LcInpw0X/rrPSqq4CDPyI6A6ZRC18Y= +github.com/shirou/gopsutil/v3 v3.24.2/go.mod h1:tSg/594BcA+8UdQU2XcW803GWYgdtauFFPgJCJKZlVk= github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM= github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ= github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU= @@ -199,7 +199,6 @@ github.com/wayneashleyberry/terminal-dimensions v1.1.0/go.mod h1:2lc/0eWCObmhRcz github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no= github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= github.com/zclconf/go-cty v1.14.2 h1:kTG7lqmBou0Zkx35r6HJHUQTvaRPr5bIAf3AoHS0izI= @@ -238,7 +237,6 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= From 413a8808c658793084ca56468f75de7d9afb6006 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Mar 2024 01:02:43 +0000 Subject: [PATCH 003/157] chore(deps): bump golang.org/x/sys from 0.17.0 to 0.18.0 in /src Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.17.0 to 0.18.0. - [Commits](https://github.com/golang/sys/compare/v0.17.0...v0.18.0) --- updated-dependencies: - dependency-name: golang.org/x/sys dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- src/go.mod | 2 +- src/go.sum | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/go.mod b/src/go.mod index 6b2e8dd5..896ceb9b 100644 --- a/src/go.mod +++ b/src/go.mod @@ -25,7 +25,7 @@ require ( github.com/wayneashleyberry/terminal-dimensions v1.1.0 golang.org/x/crypto v0.19.0 // indirect golang.org/x/image v0.15.0 - golang.org/x/sys v0.17.0 + golang.org/x/sys v0.18.0 golang.org/x/text v0.14.0 gopkg.in/ini.v1 v1.67.0 ) diff --git a/src/go.sum b/src/go.sum index 916fef53..0b02f870 100644 --- a/src/go.sum +++ b/src/go.sum @@ -237,8 +237,9 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= From 70fa0bffca7e1d10a391e087ba692125a12cf5d5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Mar 2024 01:02:48 +0000 Subject: [PATCH 004/157] chore(deps): bump golang.org/x/mod from 0.15.0 to 0.16.0 in /src Bumps [golang.org/x/mod](https://github.com/golang/mod) from 0.15.0 to 0.16.0. - [Commits](https://github.com/golang/mod/compare/v0.15.0...v0.16.0) --- updated-dependencies: - dependency-name: golang.org/x/mod dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- src/go.mod | 2 +- src/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/go.mod b/src/go.mod index 896ceb9b..5e95f6c1 100644 --- a/src/go.mod +++ b/src/go.mod @@ -40,7 +40,7 @@ require ( github.com/spf13/cobra v1.8.0 github.com/spf13/pflag v1.0.5 golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3 - golang.org/x/mod v0.15.0 + golang.org/x/mod v0.16.0 gopkg.in/yaml.v3 v3.0.1 ) diff --git a/src/go.sum b/src/go.sum index 0b02f870..f54ff2ab 100644 --- a/src/go.sum +++ b/src/go.sum @@ -213,8 +213,8 @@ golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3/go.mod h1:idGWGoKP1toJGkd5/i golang.org/x/image v0.15.0 h1:kOELfmgrmJlw4Cdb7g/QGuB3CvDrXbqEIww/pNtNBm8= golang.org/x/image v0.15.0/go.mod h1:HUYqC05R2ZcZ3ejNQsIHQDQiwWM4JBqmm6MKANTp4LE= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8= -golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.16.0 h1:QX4fJ0Rr5cPQCF7O9lh9Se4pmwfwskqZfq5moyldzic= +golang.org/x/mod v0.16.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= From 134f7013cf71ce71a0aa4e3815f507cf5b0d4d6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Grzegorz=20Kraso=C5=84?= Date: Tue, 5 Mar 2024 12:36:31 +0100 Subject: [PATCH 005/157] feat(nu): validate existence of history.txt --- src/shell/scripts/omp.nu | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shell/scripts/omp.nu b/src/shell/scripts/omp.nu index 0300bccc..15f17bc4 100644 --- a/src/shell/scripts/omp.nu +++ b/src/shell/scripts/omp.nu @@ -23,7 +23,7 @@ $env.PROMPT_MULTILINE_INDICATOR = (^::OMP:: print secondary $"--config=($env.POS $env.PROMPT_COMMAND = { || # hack to set the cursor line to 1 when the user clears the screen # this obviously isn't bulletproof, but it's a start - let clear = (history | last 1 | get 0.command) == "clear" + let clear = (history | is-empty) or ((history | last 1 | get 0.command) == "clear") ^::OMP:: print primary $"--config=($env.POSH_THEME)" --shell=nu $"--shell-version=($env.POSH_SHELL_VERSION)" $"--execution-time=(posh_cmd_duration)" $"--status=($env.LAST_EXIT_CODE)" $"--terminal-width=(posh_width)" $"--cleared=($clear)" } From bea1c6496ed4d15cffa169b465869f348214d375 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Tue, 5 Mar 2024 11:36:48 +0000 Subject: [PATCH 006/157] docs: update website/docs/contributors.md [skip ci] --- website/docs/contributors.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/website/docs/contributors.md b/website/docs/contributors.md index efa3f1da..9cf7302c 100644 --- a/website/docs/contributors.md +++ b/website/docs/contributors.md @@ -326,6 +326,9 @@ Thanks goes to these wonderful people ([emoji key][acek]): Veko
Veko

📖 Lucas Costi
Lucas Costi

💻 + + Grzegorz Krasoń
Grzegorz Krasoń

💻 + From 8401da66e544d27854d8736c0ffe75df92ff709e Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Tue, 5 Mar 2024 11:36:49 +0000 Subject: [PATCH 007/157] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index c3678857..2c58da34 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2280,6 +2280,15 @@ "contributions": [ "code" ] + }, + { + "login": "gergelyk", + "name": "Grzegorz Krasoń", + "avatar_url": "https://avatars.githubusercontent.com/u/11185582?v=4", + "profile": "http://krason.dev/", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, From 21df976c2fde9544973db9d4c8851018afd10b2e Mon Sep 17 00:00:00 2001 From: "rocky@HP_OMEN" Date: Wed, 28 Feb 2024 12:45:40 +0000 Subject: [PATCH 008/157] feat(python): make parent folder fallback optional --- src/segments/python.go | 5 +++-- src/segments/python_test.go | 37 ++++++++++++++++++++++++++------ website/docs/segments/python.mdx | 5 ++--- 3 files changed, 36 insertions(+), 11 deletions(-) diff --git a/src/segments/python.go b/src/segments/python.go index ba33a2ca..49cace56 100644 --- a/src/segments/python.go +++ b/src/segments/python.go @@ -21,6 +21,7 @@ const ( // FetchVirtualEnv fetches the virtual env FetchVirtualEnv properties.Property = "fetch_virtual_env" UsePythonVersionFile properties.Property = "use_python_version_file" + FolderNameFallback properties.Property = "folder_name_fallback" ) func (p *Python) Template() string { @@ -74,6 +75,7 @@ func (p *Python) loadContext() { "CONDA_DEFAULT_ENV", } + folderNameFallback := p.language.props.GetBool(FolderNameFallback, true) defaultVenvNames := []string{ ".venv", "venv", @@ -87,8 +89,7 @@ func (p *Python) loadContext() { } name := platform.Base(p.language.env, venv) - - if slices.Contains(defaultVenvNames, name) { + if folderNameFallback && slices.Contains(defaultVenvNames, name) { venv = strings.TrimSuffix(venv, name) name = platform.Base(p.language.env, venv) } diff --git a/src/segments/python_test.go b/src/segments/python_test.go index c5794d0e..63754473 100644 --- a/src/segments/python_test.go +++ b/src/segments/python_test.go @@ -150,14 +150,36 @@ func TestPythonPythonInContext(t *testing.T) { func TestPythonVirtualEnvIgnoreDefaultVenvNames(t *testing.T) { cases := []struct { - VirtualEnvName string + Expected string + FolderNameFallback bool + VirtualEnvName string }{ - {VirtualEnvName: "/path/to/folder/.venv"}, - {VirtualEnvName: "/path/to/folder/venv"}, + { + Expected: "folder", + FolderNameFallback: true, + VirtualEnvName: "/path/to/folder/.venv", + }, + { + Expected: "folder", + FolderNameFallback: true, + VirtualEnvName: "/path/to/folder/venv", + }, + { + Expected: ".venv", + FolderNameFallback: false, + VirtualEnvName: "/path/to/folder/.venv", + }, + { + Expected: "venv", + FolderNameFallback: false, + VirtualEnvName: "/path/to/folder/venv", + }, } for _, tc := range cases { - env := new(mock.MockedEnvironment) + params := &mockedLanguageParams{} + env, props := getMockedLanguageEnv(params) + env.On("GOOS").Return("") env.On("PathSeparator").Return("/") env.On("CommandPath", mock2.Anything).Return("") @@ -167,9 +189,12 @@ func TestPythonVirtualEnvIgnoreDefaultVenvNames(t *testing.T) { env.On("Getenv", "CONDA_DEFAULT_ENV").Return("") env.On("Getenv", "PYENV_VERSION").Return("") env.On("HasParentFilePath", ".python-version").Return(&platform.FileInfo{}, errors.New("no match at root level")) + + props[FolderNameFallback] = tc.FolderNameFallback + python := &Python{} - python.Init(properties.Map{}, env) + python.Init(props, env) python.loadContext() - assert.Equal(t, "folder", python.Venv) + assert.Equal(t, tc.Expected, python.Venv) } } diff --git a/website/docs/segments/python.mdx b/website/docs/segments/python.mdx index 6179b81f..3e5a706f 100644 --- a/website/docs/segments/python.mdx +++ b/website/docs/segments/python.mdx @@ -9,8 +9,6 @@ sidebar_label: Python Display the currently active python version and virtualenv. Supports conda, virtualenv and pyenv (if python points to pyenv shim). -If your virtual environment is a directory named `venv` or `.venv`, the virtual environment's name will be the parent directory. - ## Sample Configuration import Config from "@site/src/components/Config.js"; @@ -38,8 +36,9 @@ import Config from "@site/src/components/Config.js"; | `display_mode` | `string` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when one of the following files is present:
    • `*.py`
    • `*.ipynb`
    • `pyproject.toml`
    • `venv.bak`
    • `venv`
    • `.venv`
  • `environment`: the segment is only displayed when a virtual env is present (**default**)
  • `context`: the segment is only displayed when either `environment` or `files` is active
| | `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | | `extensions` | `[]string` | allows to override the default list of file extensions to validate | -| `folders` | `[]string` | allows to override the list of folder names to validate | +| `folders` | `[]string` | allows to override the list of folder names to validate | | `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` | +| `folder_name_fallback` | `boolean` | instead of `venv` or `.venv` (case sensitive), use the parent folder name as the virtual environment's name or not - defaults to `true` | ## Template ([info][templates]) From ae73c1dad54d1f199e98e656b7e1815af5005fe2 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Tue, 5 Mar 2024 12:49:56 +0100 Subject: [PATCH 009/157] fix(spotify): adjust incorrect erorr check --- src/segments/spotify_darwin.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/segments/spotify_darwin.go b/src/segments/spotify_darwin.go index 61ba5c05..d468ceef 100644 --- a/src/segments/spotify_darwin.go +++ b/src/segments/spotify_darwin.go @@ -3,24 +3,28 @@ package segments func (s *Spotify) Enabled() bool { - var err error // Check if running running := s.runAppleScriptCommand("application \"Spotify\" is running") if running == "false" || running == "" { s.Status = stopped return false } + s.Status = s.runAppleScriptCommand("tell application \"Spotify\" to player state as string") - if err != nil { + + if len(s.Status) == 0 { s.Status = stopped return false } + if s.Status == stopped { return false } + s.Artist = s.runAppleScriptCommand("tell application \"Spotify\" to artist of current track as string") s.Track = s.runAppleScriptCommand("tell application \"Spotify\" to name of current track as string") s.resolveIcon() + return true } From 621389314a00848f061d8e2bb23cc94a224ff957 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Tue, 5 Mar 2024 11:58:21 +0000 Subject: [PATCH 010/157] docs: update website/docs/contributors.md [skip ci] --- website/docs/contributors.md | 1 + 1 file changed, 1 insertion(+) diff --git a/website/docs/contributors.md b/website/docs/contributors.md index 9cf7302c..d8fa10d4 100644 --- a/website/docs/contributors.md +++ b/website/docs/contributors.md @@ -328,6 +328,7 @@ Thanks goes to these wonderful people ([emoji key][acek]): Grzegorz Krasoń
Grzegorz Krasoń

💻 + rockyoung
rockyoung

💻 📖 From b468f2967a1d6db9734ec17009357049e7822568 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Tue, 5 Mar 2024 11:58:22 +0000 Subject: [PATCH 011/157] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 2c58da34..dcc6591f 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2289,6 +2289,16 @@ "contributions": [ "code" ] + }, + { + "login": "rockyoung", + "name": "rockyoung", + "avatar_url": "https://avatars.githubusercontent.com/u/1207971?v=4", + "profile": "https://github.com/rockyoung", + "contributions": [ + "code", + "doc" + ] } ], "contributorsPerLine": 7, From 5d24a56b2ef7b8b84ebcd982fb1dc4323335282a Mon Sep 17 00:00:00 2001 From: Shravan Asati Date: Mon, 4 Mar 2024 23:08:05 +0530 Subject: [PATCH 012/157] theme(atomic): add space between double width icons --- themes/atomic.omp.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/atomic.omp.json b/themes/atomic.omp.json index a0425066..02e10f77 100644 --- a/themes/atomic.omp.json +++ b/themes/atomic.omp.json @@ -29,7 +29,7 @@ "style": "folder" }, "style": "powerline", - "template": " \uf07b\uea9c{{ .Path }} ", + "template": " \uf07b\uea9c {{ .Path }} ", "type": "path" }, { @@ -59,7 +59,7 @@ "threshold": 0 }, "style": "diamond", - "template": " \ueba2{{ .FormattedMs }}\u2800", + "template": " \ueba2 {{ .FormattedMs }}\u2800", "trailing_diamond": "\ue0b4", "type": "executiontime" } From 41f7cf418fe841a634676ad7dc3f8c111916dd6d Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Tue, 5 Mar 2024 12:00:32 +0000 Subject: [PATCH 013/157] docs: update website/docs/contributors.md [skip ci] --- website/docs/contributors.md | 1 + 1 file changed, 1 insertion(+) diff --git a/website/docs/contributors.md b/website/docs/contributors.md index d8fa10d4..872b79f3 100644 --- a/website/docs/contributors.md +++ b/website/docs/contributors.md @@ -329,6 +329,7 @@ Thanks goes to these wonderful people ([emoji key][acek]): Grzegorz Krasoń
Grzegorz Krasoń

💻 rockyoung
rockyoung

💻 📖 + Shravan Asati
Shravan Asati

🎨 From cb43ae50f9550e501f8b36d18b9b6dca79d659c7 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Tue, 5 Mar 2024 12:00:33 +0000 Subject: [PATCH 014/157] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index dcc6591f..481785e8 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2299,6 +2299,15 @@ "code", "doc" ] + }, + { + "login": "shravanasati", + "name": "Shravan Asati", + "avatar_url": "https://avatars.githubusercontent.com/u/69118069?v=4", + "profile": "https://github.com/shravanasati", + "contributions": [ + "design" + ] } ], "contributorsPerLine": 7, From 24ddffe0a5ece70e87be98ff455d9a7524e6b047 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 6 Mar 2024 00:51:17 +0000 Subject: [PATCH 015/157] chore(deps): bump github.com/charmbracelet/lipgloss in /src Bumps [github.com/charmbracelet/lipgloss](https://github.com/charmbracelet/lipgloss) from 0.9.1 to 0.10.0. - [Release notes](https://github.com/charmbracelet/lipgloss/releases) - [Commits](https://github.com/charmbracelet/lipgloss/compare/v0.9.1...v0.10.0) --- updated-dependencies: - dependency-name: github.com/charmbracelet/lipgloss dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- src/go.mod | 2 +- src/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/go.mod b/src/go.mod index 5e95f6c1..74e2c89b 100644 --- a/src/go.mod +++ b/src/go.mod @@ -34,7 +34,7 @@ require ( github.com/ConradIrwin/font v0.0.0-20210318200717-ce8d41cc0732 github.com/charmbracelet/bubbles v0.18.0 github.com/charmbracelet/bubbletea v0.25.0 - github.com/charmbracelet/lipgloss v0.9.1 + github.com/charmbracelet/lipgloss v0.10.0 github.com/hashicorp/hcl/v2 v2.20.0 github.com/mattn/go-runewidth v0.0.15 github.com/spf13/cobra v1.8.0 diff --git a/src/go.sum b/src/go.sum index f54ff2ab..304ff928 100644 --- a/src/go.sum +++ b/src/go.sum @@ -31,8 +31,8 @@ github.com/charmbracelet/bubbles v0.18.0 h1:PYv1A036luoBGroX6VWjQIE9Syf2Wby2oOl/ github.com/charmbracelet/bubbles v0.18.0/go.mod h1:08qhZhtIwzgrtBjAcJnij1t1H0ZRjwHyGsy6AL11PSw= github.com/charmbracelet/bubbletea v0.25.0 h1:bAfwk7jRz7FKFl9RzlIULPkStffg5k6pNt5dywy4TcM= github.com/charmbracelet/bubbletea v0.25.0/go.mod h1:EN3QDR1T5ZdWmdfDzYcqOCAps45+QIJbLOBxmVNWNNg= -github.com/charmbracelet/lipgloss v0.9.1 h1:PNyd3jvaJbg4jRHKWXnCj1akQm4rh8dbEzN1p/u1KWg= -github.com/charmbracelet/lipgloss v0.9.1/go.mod h1:1mPmG4cxScwUQALAAnacHaigiiHB9Pmr+v1VEawJl6I= +github.com/charmbracelet/lipgloss v0.10.0 h1:KWeXFSexGcfahHX+54URiZGkBFazf70JNMtwg/AFW3s= +github.com/charmbracelet/lipgloss v0.10.0/go.mod h1:Wig9DSfvANsxqkRsqj6x87irdy123SR4dOXlKa91ciE= github.com/containerd/console v1.0.4 h1:F2g4+oChYvBTsASRTz8NP6iIAi97J3TtSAsLbIFn4ro= github.com/containerd/console v1.0.4/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk= github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= From 6cd13337ab8245fb9ab5b539228ab88bb44965f5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 8 Mar 2024 00:26:49 +0000 Subject: [PATCH 016/157] chore(deps): bump azure/login from 1.6.1 to 2.0.0 Bumps [azure/login](https://github.com/azure/login) from 1.6.1 to 2.0.0. - [Release notes](https://github.com/azure/login/releases) - [Commits](https://github.com/azure/login/compare/cb79c773a3cfa27f31f25eb3f677781210c9ce3d...8c334a195cbb38e46038007b304988d888bf676a) --- updated-dependencies: - dependency-name: azure/login dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 7fa3f794..8d640e41 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -44,7 +44,7 @@ jobs: - name: Set default Kubernetes namespace run: | kubectl config set-context posh --namespace demo - - uses: azure/login@cb79c773a3cfa27f31f25eb3f677781210c9ce3d + - uses: azure/login@8c334a195cbb38e46038007b304988d888bf676a with: creds: ${{ secrets.AZURE_CREDENTIALS }} - name: Build oh-my-posh 🔧 From 8e0a4c11ded4ecf7015872701e6ac4500878b000 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Mar 2024 00:43:00 +0000 Subject: [PATCH 017/157] chore(deps): bump softprops/action-gh-release from 1 to 2 Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 1 to 2. - [Release notes](https://github.com/softprops/action-gh-release/releases) - [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md) - [Commits](https://github.com/softprops/action-gh-release/compare/de2c0eb89ae2a093876385947365aca7b0e5f844...d99959edae48b5ffffd7b00da66dcdb0a33a52ee) --- updated-dependencies: - dependency-name: softprops/action-gh-release dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a60729da..4142b260 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -85,7 +85,7 @@ jobs: } shell: pwsh - name: Release 🎓 - uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 + uses: softprops/action-gh-release@d99959edae48b5ffffd7b00da66dcdb0a33a52ee with: tag_name: ${{ needs.changelog.outputs.tag }} body: ${{ needs.changelog.outputs.body }} From 87d1719bd03cff0903474abd0ff8d1972b598c34 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Mon, 11 Mar 2024 09:23:00 +0100 Subject: [PATCH 018/157] feat(config): use custom config parser --- src/ansi/ansi_writer.go | 4 +- src/ansi/palettes.go | 4 +- src/engine/block.go | 20 ++--- src/engine/config.go | 184 +++++++++++++++++++------------------- src/engine/config_test.go | 34 ------- src/engine/engine_test.go | 1 - src/engine/segment.go | 42 ++++----- src/go.mod | 16 ++-- src/go.sum | 27 +++--- 9 files changed, 143 insertions(+), 189 deletions(-) diff --git a/src/ansi/ansi_writer.go b/src/ansi/ansi_writer.go index f33f5494..a7f8652c 100644 --- a/src/ansi/ansi_writer.go +++ b/src/ansi/ansi_writer.go @@ -36,8 +36,8 @@ type style struct { } type Colors struct { - Background string `json:"background"` - Foreground string `json:"foreground"` + Background string `json:"background" toml:"background"` + Foreground string `json:"foreground" toml:"foreground"` } const ( diff --git a/src/ansi/palettes.go b/src/ansi/palettes.go index 9cbd7fbb..482585f2 100644 --- a/src/ansi/palettes.go +++ b/src/ansi/palettes.go @@ -1,6 +1,6 @@ package ansi type Palettes struct { - Template string `json:"template,omitempty"` - List map[string]Palette `json:"list,omitempty"` + Template string `json:"template,omitempty" toml:"template,omitempty"` + List map[string]Palette `json:"list,omitempty" toml:"list,omitempty"` } diff --git a/src/engine/block.go b/src/engine/block.go index e2c6eea1..f07e4d4b 100644 --- a/src/engine/block.go +++ b/src/engine/block.go @@ -38,19 +38,19 @@ const ( // Block defines a part of the prompt with optional segments type Block struct { - Type BlockType `json:"type,omitempty"` - Alignment BlockAlignment `json:"alignment,omitempty"` - Segments []*Segment `json:"segments,omitempty"` - Newline bool `json:"newline,omitempty"` - Filler string `json:"filler,omitempty"` - Overflow Overflow `json:"overflow,omitempty"` + Type BlockType `json:"type,omitempty" toml:"type,omitempty"` + Alignment BlockAlignment `json:"alignment,omitempty" toml:"alignment,omitempty"` + Segments []*Segment `json:"segments,omitempty" toml:"segments,omitempty"` + Newline bool `json:"newline,omitempty" toml:"newline,omitempty"` + Filler string `json:"filler,omitempty" toml:"filler,omitempty"` + Overflow Overflow `json:"overflow,omitempty" toml:"overflow,omitempty"` // Deprecated: keep the logic for legacy purposes - HorizontalOffset int `json:"horizontal_offset,omitempty"` - VerticalOffset int `json:"vertical_offset,omitempty"` + HorizontalOffset int `json:"horizontal_offset,omitempty" toml:"horizontal_offset,omitempty"` + VerticalOffset int `json:"vertical_offset,omitempty" toml:"vertical_offset,omitempty"` - MaxWidth int `json:"max_width,omitempty"` - MinWidth int `json:"min_width,omitempty"` + MaxWidth int `json:"max_width,omitempty" toml:"max_width,omitempty"` + MinWidth int `json:"min_width,omitempty" toml:"min_width,omitempty"` env platform.Environment writer *ansi.Writer diff --git a/src/engine/config.go b/src/engine/config.go index 342bbbf6..9c574e68 100644 --- a/src/engine/config.go +++ b/src/engine/config.go @@ -2,7 +2,6 @@ package engine import ( "bytes" - json2 "encoding/json" "fmt" "io" "os" @@ -10,18 +9,16 @@ import ( "strings" "time" + json "github.com/goccy/go-json" + yaml "github.com/goccy/go-yaml" + "github.com/gookit/goutil/jsonutil" "github.com/jandedobbeleer/oh-my-posh/src/ansi" "github.com/jandedobbeleer/oh-my-posh/src/platform" "github.com/jandedobbeleer/oh-my-posh/src/properties" "github.com/jandedobbeleer/oh-my-posh/src/segments" "github.com/jandedobbeleer/oh-my-posh/src/shell" "github.com/jandedobbeleer/oh-my-posh/src/template" - - "github.com/gookit/config/v2" - "github.com/gookit/config/v2/json" - "github.com/gookit/config/v2/toml" - yaml "github.com/gookit/config/v2/yamlv3" - "github.com/mitchellh/mapstructure" + toml "github.com/pelletier/go-toml/v2" ) const ( @@ -34,33 +31,33 @@ const ( // Config holds all the theme for rendering the prompt type Config struct { - Version int `json:"version"` - FinalSpace bool `json:"final_space,omitempty"` - ConsoleTitleTemplate string `json:"console_title_template,omitempty"` - TerminalBackground string `json:"terminal_background,omitempty"` - AccentColor string `json:"accent_color,omitempty"` - Blocks []*Block `json:"blocks,omitempty"` - Tooltips []*Segment `json:"tooltips,omitempty"` - TransientPrompt *Segment `json:"transient_prompt,omitempty"` - ValidLine *Segment `json:"valid_line,omitempty"` - ErrorLine *Segment `json:"error_line,omitempty"` - SecondaryPrompt *Segment `json:"secondary_prompt,omitempty"` - DebugPrompt *Segment `json:"debug_prompt,omitempty"` - Palette ansi.Palette `json:"palette,omitempty"` - Palettes *ansi.Palettes `json:"palettes,omitempty"` - Cycle ansi.Cycle `json:"cycle,omitempty"` - ShellIntegration bool `json:"shell_integration,omitempty"` - PWD string `json:"pwd,omitempty"` - Var map[string]any `json:"var,omitempty"` - DisableCursorPositioning bool `json:"disable_cursor_positioning,omitempty"` - PatchPwshBleed bool `json:"patch_pwsh_bleed,omitempty"` + Version int `json:"version" toml:"version"` + FinalSpace bool `json:"final_space,omitempty" toml:"final_space,omitempty"` + ConsoleTitleTemplate string `json:"console_title_template,omitempty" toml:"console_title_template,omitempty"` + TerminalBackground string `json:"terminal_background,omitempty" toml:"terminal_background,omitempty"` + AccentColor string `json:"accent_color,omitempty" toml:"accent_color,omitempty"` + Blocks []*Block `json:"blocks,omitempty" toml:"blocks,omitempty"` + Tooltips []*Segment `json:"tooltips,omitempty" toml:"tooltips,omitempty"` + TransientPrompt *Segment `json:"transient_prompt,omitempty" toml:"transient_prompt,omitempty"` + ValidLine *Segment `json:"valid_line,omitempty" toml:"valid_line,omitempty"` + ErrorLine *Segment `json:"error_line,omitempty" toml:"error_line,omitempty"` + SecondaryPrompt *Segment `json:"secondary_prompt,omitempty" toml:"secondary_prompt,omitempty"` + DebugPrompt *Segment `json:"debug_prompt,omitempty" toml:"debug_prompt,omitempty"` + Palette ansi.Palette `json:"palette,omitempty" toml:"palette,omitempty"` + Palettes *ansi.Palettes `json:"palettes,omitempty" toml:"palettes,omitempty"` + Cycle ansi.Cycle `json:"cycle,omitempty" toml:"cycle,omitempty"` + ShellIntegration bool `json:"shell_integration,omitempty" toml:"shell_integration,omitempty"` + PWD string `json:"pwd,omitempty" toml:"pwd,omitempty"` + Var map[string]any `json:"var,omitempty" toml:"var,omitempty"` + DisableCursorPositioning bool `json:"disable_cursor_positioning,omitempty" toml:"disable_cursor_positioning,omitempty"` + PatchPwshBleed bool `json:"patch_pwsh_bleed,omitempty" toml:"patch_pwsh_bleed,omitempty"` // Deprecated - OSC99 bool `json:"osc99,omitempty"` + OSC99 bool `json:"osc99,omitempty" toml:"osc99,omitempty"` - Output string `json:"-"` - MigrateGlyphs bool `json:"-"` - Format string `json:"-"` + Output string `json:"-" toml:"-"` + MigrateGlyphs bool `json:"-" toml:"-"` + Format string `json:"-" toml:"-"` origin string // eval bool @@ -135,94 +132,82 @@ func loadConfig(env platform.Environment) *Config { cfg.Format = strings.TrimPrefix(filepath.Ext(configFile), ".") cfg.env = env - // support different extensions - switch cfg.Format { - case "yml": - cfg.Format = YAML - case "jsonc": - cfg.Format = JSON - } - - config.AddDriver(yaml.Driver.WithAliases("yaml", "yml")) - config.AddDriver(json.Driver.WithAliases("json", "jsonc")) - config.AddDriver(toml.Driver) - - if config.Default().IsEmpty() { - config.WithOptions(func(opt *config.Options) { - opt.DecoderConfig = &mapstructure.DecoderConfig{ - TagName: "json", - } - }) - } - - err := config.LoadFiles(configFile) + // read the data + data, err := os.ReadFile(configFile) if err != nil { - env.Error(err) + env.DebugF("error reading config file: %s", err) return defaultConfig(env, true) } - err = config.BindStruct("", &cfg) + switch cfg.Format { + case "yml", "yaml": + cfg.Format = YAML + err = yaml.Unmarshal(data, &cfg) + case "jsonc", "json": + cfg.Format = JSON + + if cfg.Format == "jsonc" { + str := jsonutil.StripComments(string(data)) + data = []byte(str) + } + + decoder := json.NewDecoder(bytes.NewReader(data)) + err = decoder.Decode(&cfg) + case "toml", "tml": + cfg.Format = TOML + err = toml.Unmarshal(data, &cfg) + default: + err = fmt.Errorf("unsupported config file format: %s", cfg.Format) + } + if err != nil { - env.Error(err) + env.DebugF("error decoding config file: %s", err) return defaultConfig(env, true) } return &cfg } -func (cfg *Config) sync() { - if !cfg.updated { - return - } - var structMap map[string]any - inrec, err := json2.Marshal(cfg) - if err != nil { - return - } - err = json2.Unmarshal(inrec, &structMap) - if err != nil { - return - } - // remove empty structs - for k, v := range structMap { - if smap, OK := v.(map[string]any); OK && len(smap) == 0 { - delete(structMap, k) - } - } - config.SetData(structMap) -} - func (cfg *Config) Export(format string) string { - cfg.sync() - if len(format) != 0 { cfg.Format = format } - config.AddDriver(yaml.Driver) - config.AddDriver(toml.Driver) - var result bytes.Buffer - if cfg.Format == JSON { - jsonEncoder := json2.NewEncoder(&result) + switch cfg.Format { + case YAML: + prefix := "# yaml-language-server: $schema=https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json\n\n" + yamlEncoder := yaml.NewEncoder(&result) + + err := yamlEncoder.Encode(cfg) + if err != nil { + return "" + } + + return prefix + escapeGlyphs(result.String(), cfg.MigrateGlyphs) + case JSON: + jsonEncoder := json.NewEncoder(&result) jsonEncoder.SetEscapeHTML(false) jsonEncoder.SetIndent("", " ") _ = jsonEncoder.Encode(cfg) prefix := "{\n \"$schema\": \"https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json\"," data := strings.Replace(result.String(), "{", prefix, 1) return escapeGlyphs(data, cfg.MigrateGlyphs) + case TOML: + prefix := "#:schema https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json\n\n" + tomlEncoder := toml.NewEncoder(&result) + + err := tomlEncoder.Encode(cfg) + if err != nil { + return "" + } + + return prefix + escapeGlyphs(result.String(), cfg.MigrateGlyphs) } - _, _ = config.DumpTo(&result, cfg.Format) - var prefix string - switch cfg.Format { - case YAML: - prefix = "# yaml-language-server: $schema=https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json\n\n" - case TOML: - prefix = "#:schema https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json\n\n" - } - return prefix + escapeGlyphs(result.String(), cfg.MigrateGlyphs) + // unsupported format + return "" } func (cfg *Config) BackupAndMigrate() { @@ -233,19 +218,30 @@ func (cfg *Config) BackupAndMigrate() { func (cfg *Config) Write(format string) { content := cfg.Export(format) + if len(content) == 0 { + // we are unable to perform the export + os.Exit(1) + return + } + destination := cfg.Output if len(destination) == 0 { destination = cfg.origin } + f, err := os.OpenFile(destination, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0755) if err != nil { return } + + defer func() { + _ = f.Close() + }() + _, err = f.WriteString(content) if err != nil { return } - _ = f.Close() } func (cfg *Config) Backup() { diff --git a/src/engine/config_test.go b/src/engine/config_test.go index 631f51cd..bd43b7a0 100644 --- a/src/engine/config_test.go +++ b/src/engine/config_test.go @@ -6,46 +6,12 @@ import ( "github.com/jandedobbeleer/oh-my-posh/src/ansi" "github.com/jandedobbeleer/oh-my-posh/src/mock" "github.com/jandedobbeleer/oh-my-posh/src/platform" - "github.com/jandedobbeleer/oh-my-posh/src/segments" - "github.com/gookit/config/v2" - "github.com/mitchellh/mapstructure" "github.com/stretchr/testify/assert" mock2 "github.com/stretchr/testify/mock" ) -func testClearDefaultConfig() { - config.Default().ClearAll() -} - -func TestParseMappedLocations(t *testing.T) { - defer testClearDefaultConfig() - cases := []struct { - Case string - JSON string - }{ - {Case: "new format", JSON: `{ "properties": { "mapped_locations": {"folder1": "one","folder2": "two"} } }`}, - {Case: "old format", JSON: `{ "properties": { "mapped_locations": [["folder1", "one"], ["folder2", "two"]] } }`}, - } - for _, tc := range cases { - config.ClearAll() - config.WithOptions(func(opt *config.Options) { - opt.DecoderConfig = &mapstructure.DecoderConfig{ - TagName: "config", - } - }) - err := config.LoadStrings(config.JSON, tc.JSON) - assert.NoError(t, err) - var segment Segment - err = config.BindStruct("", &segment) - assert.NoError(t, err) - mappedLocations := segment.Properties.GetKeyValueMap(segments.MappedLocations, make(map[string]string)) - assert.Equal(t, "two", mappedLocations["folder2"]) - } -} - func TestEscapeGlyphs(t *testing.T) { - defer testClearDefaultConfig() cases := []struct { Input string Expected string diff --git a/src/engine/engine_test.go b/src/engine/engine_test.go index 4f45603c..6e8a9128 100644 --- a/src/engine/engine_test.go +++ b/src/engine/engine_test.go @@ -113,7 +113,6 @@ func engineRender() { defer env.Close() cfg := LoadConfig(env) - defer testClearDefaultConfig() writerColors := cfg.MakeColors() writer := &ansi.Writer{ diff --git a/src/engine/segment.go b/src/engine/segment.go index 1f02612e..ebc9a928 100644 --- a/src/engine/segment.go +++ b/src/engine/segment.go @@ -20,28 +20,28 @@ import ( // Segment represent a single segment and it's configuration type Segment struct { - Type SegmentType `json:"type,omitempty"` - Tips []string `json:"tips,omitempty"` - Style SegmentStyle `json:"style,omitempty"` - PowerlineSymbol string `json:"powerline_symbol,omitempty"` - InvertPowerline bool `json:"invert_powerline,omitempty"` - Foreground string `json:"foreground,omitempty"` - ForegroundTemplates template.List `json:"foreground_templates,omitempty"` - Background string `json:"background,omitempty"` - BackgroundTemplates template.List `json:"background_templates,omitempty"` - LeadingDiamond string `json:"leading_diamond,omitempty"` - TrailingDiamond string `json:"trailing_diamond,omitempty"` - Template string `json:"template,omitempty"` - Templates template.List `json:"templates,omitempty"` - TemplatesLogic template.Logic `json:"templates_logic,omitempty"` - Properties properties.Map `json:"properties,omitempty"` - Interactive bool `json:"interactive,omitempty"` - Alias string `json:"alias,omitempty"` - MaxWidth int `json:"max_width,omitempty"` - MinWidth int `json:"min_width,omitempty"` - Filler string `json:"filler,omitempty"` + Type SegmentType `json:"type,omitempty" toml:"type,omitempty"` + Tips []string `json:"tips,omitempty" toml:"tips,omitempty"` + Style SegmentStyle `json:"style,omitempty" toml:"style,omitempty"` + PowerlineSymbol string `json:"powerline_symbol,omitempty" toml:"powerline_symbol,omitempty"` + InvertPowerline bool `json:"invert_powerline,omitempty" toml:"invert_powerline,omitempty"` + Foreground string `json:"foreground,omitempty" toml:"foreground,omitempty"` + ForegroundTemplates template.List `json:"foreground_templates,omitempty" toml:"foreground_templates,omitempty"` + Background string `json:"background,omitempty" toml:"background,omitempty"` + BackgroundTemplates template.List `json:"background_templates,omitempty" toml:"background_templates,omitempty"` + LeadingDiamond string `json:"leading_diamond,omitempty" toml:"leading_diamond,omitempty"` + TrailingDiamond string `json:"trailing_diamond,omitempty" toml:"trailing_diamond,omitempty"` + Template string `json:"template,omitempty" toml:"template,omitempty"` + Templates template.List `json:"templates,omitempty" toml:"templates,omitempty"` + TemplatesLogic template.Logic `json:"templates_logic,omitempty" toml:"templates_logic,omitempty"` + Properties properties.Map `json:"properties,omitempty" toml:"properties,omitempty"` + Interactive bool `json:"interactive,omitempty" toml:"interactive,omitempty"` + Alias string `json:"alias,omitempty" toml:"alias,omitempty"` + MaxWidth int `json:"max_width,omitempty" toml:"max_width,omitempty"` + MinWidth int `json:"min_width,omitempty" toml:"min_width,omitempty"` + Filler string `json:"filler,omitempty" toml:"filler,omitempty"` - Enabled bool `json:"-"` + Enabled bool `json:"-" toml:"-"` colors *ansi.Colors env platform.Environment diff --git a/src/go.mod b/src/go.mod index 74e2c89b..2686bdbc 100644 --- a/src/go.mod +++ b/src/go.mod @@ -13,11 +13,8 @@ require ( github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 github.com/google/uuid v1.6.0 // indirect github.com/gookit/color v1.5.4 - github.com/gookit/config/v2 v2.2.5 - github.com/gookit/goutil v0.6.15 // indirect github.com/huandu/xstrings v1.4.0 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect - github.com/mitchellh/mapstructure v1.5.0 github.com/sergi/go-diff v1.3.1 // indirect github.com/shirou/gopsutil/v3 v3.24.2 github.com/stretchr/objx v0.5.2 // indirect @@ -35,8 +32,12 @@ require ( github.com/charmbracelet/bubbles v0.18.0 github.com/charmbracelet/bubbletea v0.25.0 github.com/charmbracelet/lipgloss v0.10.0 + github.com/goccy/go-json v0.10.2 + github.com/goccy/go-yaml v1.11.3 + github.com/gookit/goutil v0.6.15 github.com/hashicorp/hcl/v2 v2.20.0 github.com/mattn/go-runewidth v0.0.15 + github.com/pelletier/go-toml/v2 v2.1.1 github.com/spf13/cobra v1.8.0 github.com/spf13/pflag v1.0.5 golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3 @@ -62,7 +63,6 @@ require ( ) require ( - dario.cat/mergo v1.0.0 // indirect dmitri.shuralyov.com/font/woff2 v0.0.0-20180220214647-957792cbbdab // indirect github.com/agext/levenshtein v1.2.3 // indirect github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect @@ -70,13 +70,11 @@ require ( github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect github.com/containerd/console v1.0.4 // indirect github.com/dsnet/compress v0.0.1 // indirect - github.com/fatih/color v1.16.0 // indirect - github.com/goccy/go-json v0.10.2 // indirect - github.com/goccy/go-yaml v1.11.3 // indirect + github.com/fatih/color v1.10.0 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 // indirect - github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-colorable v0.1.8 // indirect github.com/mattn/go-localereader v0.0.1 // indirect github.com/mitchellh/go-wordwrap v1.0.1 // indirect github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect @@ -93,7 +91,7 @@ require ( golang.org/x/sync v0.6.0 // indirect golang.org/x/term v0.17.0 // indirect golang.org/x/tools v0.17.0 // indirect - golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect + golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect ) replace github.com/atotto/clipboard v0.1.4 => github.com/jandedobbeleer/clipboard v0.1.4-1 diff --git a/src/go.sum b/src/go.sum index 304ff928..1b69baea 100644 --- a/src/go.sum +++ b/src/go.sum @@ -1,5 +1,3 @@ -dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= -dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= dmitri.shuralyov.com/font/woff2 v0.0.0-20180220214647-957792cbbdab h1:Ew70NL+wL6v9looOiJJthlqA41VzoJS+q9AyjHJe6/g= dmitri.shuralyov.com/font/woff2 v0.0.0-20180220214647-957792cbbdab/go.mod h1:FvHgTMJanm43G7B3MVSjS/jim5ytVqAJNAOpRhnuHJc= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= @@ -44,8 +42,8 @@ github.com/dsnet/compress v0.0.1/go.mod h1:Aw8dCMJ7RioblQeTqt88akK31OvO8Dhf5Jflh github.com/dsnet/golib v0.0.0-20171103203638-1ea166775780/go.mod h1:Lj+Z9rebOhdfkVLjJ8T6VcRQv3SXugXy999NBtR9aFY= github.com/esimov/stackblur-go v1.1.0 h1:fwnZJC/7sHFzu4CDMgdJ1QxMN/q3k5MGILuoU4hH6oQ= github.com/esimov/stackblur-go v1.1.0/go.mod h1:7PcTPCHHKStxbZvBkUlQJjRclqjnXtQ0NoORZt1AlHE= -github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= -github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= +github.com/fatih/color v1.10.0 h1:s36xzo75JdqLaaWoiEHk767eHiwo0598uUxyfiPkDsg= +github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= github.com/fogleman/gg v1.3.0 h1:/7zJX8F6AaYQc57WQCyN9cAIz+4bCJGO9B+dyW29am8= github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -76,12 +74,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gookit/color v1.5.4 h1:FZmqs7XOyGgCAxmWyPslpiok1k05wmY3SJTytgvYFs0= github.com/gookit/color v1.5.4/go.mod h1:pZJOeOS8DM43rXbp4AZo1n9zCU2qjpcRko0b6/QJi9w= -github.com/gookit/config/v2 v2.2.5 h1:RECbYYbtherywmzn3LNeu9NA5ZqhD7MSKEMsJ7l+MpU= -github.com/gookit/config/v2 v2.2.5/go.mod h1:NeX+yiNYn6Ei10eJvCQFXuHEPIE/IPS8bqaFIsszzaM= github.com/gookit/goutil v0.6.15 h1:mMQ0ElojNZoyPD0eVROk5QXJPh2uKR4g06slgPDF5Jo= github.com/gookit/goutil v0.6.15/go.mod h1:qdKdYEHQdEtyH+4fNdQNZfJHhI0jUZzHxQVAV3DaMDY= -github.com/gookit/ini/v2 v2.2.3 h1:nSbN+x9OfQPcMObTFP+XuHt8ev6ndv/fWWqxFhPMu2E= -github.com/gookit/ini/v2 v2.2.3/go.mod h1:Vu6p7P7xcfmb8KYu3L0ek8bqu/Im63N81q208SCCZY4= github.com/hashicorp/hcl/v2 v2.20.0 h1:l++cRs/5jQOiKVvqXZm/P1ZEfVXJmvLS9WSVxkaeTb4= github.com/hashicorp/hcl/v2 v2.20.0/go.mod h1:WmcD/Ym72MDOOx5F62Ly+leloeu6H7m0pG7VBiU6pQk= github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= @@ -112,9 +106,9 @@ github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= github.com/lufia/plan9stats v0.0.0-20231016141302-07b5767bb0ed h1:036IscGBfJsFIgJQzlui7nK1Ncm0tp2ktmPj8xO4N/0= github.com/lufia/plan9stats v0.0.0-20231016141302-07b5767bb0ed/go.mod h1:ilwx/Dta8jXAgpFYFvSWEMwxmbWXyiUHkd5FwyKhb5k= -github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= -github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= -github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= +github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4= @@ -127,8 +121,6 @@ github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa1 github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0= github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0= -github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= -github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= @@ -140,6 +132,8 @@ github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s= github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8= github.com/muesli/termenv v0.15.2 h1:GohcuySI0QmI3wN8Ok9PtKGkgkFIk7y6Vpb5PvrY+Wo= github.com/muesli/termenv v0.15.2/go.mod h1:Epx+iuz8sNs7mNKhxzH4fWXGNpZwUaJKRS1noLXviQ8= +github.com/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= +github.com/pelletier/go-toml/v2 v2.1.1/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= @@ -225,13 +219,14 @@ golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -259,8 +254,8 @@ golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc= golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU= -golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From 5b7b4afec97b5af08170990761bb72aaa82a835d Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Mon, 11 Mar 2024 09:47:28 +0100 Subject: [PATCH 019/157] fix(export): format overrules file extension --- src/cli/config_export.go | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/cli/config_export.go b/src/cli/config_export.go index 8c01abf1..4b1aacf5 100644 --- a/src/cli/config_export.go +++ b/src/cli/config_export.go @@ -2,6 +2,7 @@ package cli import ( "fmt" + "os" "path/filepath" "strings" @@ -42,15 +43,29 @@ Exports the ~/myconfig.omp.json config file to toml and prints the result to std env.Init() defer env.Close() cfg := engine.LoadConfig(env) + if len(output) == 0 { fmt.Print(cfg.Export(format)) return } + cfg.Output = cleanOutputPath(output, env) - format := strings.TrimPrefix(filepath.Ext(output), ".") - if format == "yml" { - format = engine.YAML + + if len(format) == 0 { + format = strings.TrimPrefix(filepath.Ext(output), ".") } + + switch format { + case "json", "jsonc": + format = engine.JSON + case "toml", "tml": + format = engine.TOML + case "yaml", "yml": + format = engine.YAML + default: + os.Exit(1) + } + cfg.Write(format) }, } From 17dd5c8b5888a3aeecf3d81703bfb4f31d3062d1 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Mon, 11 Mar 2024 09:53:55 +0100 Subject: [PATCH 020/157] fix(export): write config with correct permissions --- src/engine/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/config.go b/src/engine/config.go index 9c574e68..4c9f1a2a 100644 --- a/src/engine/config.go +++ b/src/engine/config.go @@ -229,7 +229,7 @@ func (cfg *Config) Write(format string) { destination = cfg.origin } - f, err := os.OpenFile(destination, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0755) + f, err := os.OpenFile(destination, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644) if err != nil { return } From 67042ffa5049cbdf21c14d2247db1d24458c81de Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Mon, 11 Mar 2024 10:02:46 +0100 Subject: [PATCH 021/157] fix(cli): use correct exit codes --- src/cli/config_export.go | 8 +++++++- src/cli/root.go | 3 ++- src/engine/config.go | 2 +- src/font/cli.go | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/cli/config_export.go b/src/cli/config_export.go index 4b1aacf5..67af7573 100644 --- a/src/cli/config_export.go +++ b/src/cli/config_export.go @@ -44,6 +44,11 @@ Exports the ~/myconfig.omp.json config file to toml and prints the result to std defer env.Close() cfg := engine.LoadConfig(env) + if len(output) == 0 && len(format) == 0 { + // usage error + os.Exit(2) + } + if len(output) == 0 { fmt.Print(cfg.Export(format)) return @@ -63,7 +68,8 @@ Exports the ~/myconfig.omp.json config file to toml and prints the result to std case "yaml", "yml": format = engine.YAML default: - os.Exit(1) + // data error + os.Exit(65) } cfg.Write(format) diff --git a/src/cli/root.go b/src/cli/root.go index 16715c64..5660c3e6 100644 --- a/src/cli/root.go +++ b/src/cli/root.go @@ -36,7 +36,8 @@ on getting started, have a look at the docs at https://ohmyposh.dev`, func Execute() { if err := RootCmd.Execute(); err != nil { - os.Exit(1) + // software error + os.Exit(70) } } diff --git a/src/engine/config.go b/src/engine/config.go index 4c9f1a2a..909550fc 100644 --- a/src/engine/config.go +++ b/src/engine/config.go @@ -220,7 +220,7 @@ func (cfg *Config) Write(format string) { content := cfg.Export(format) if len(content) == 0 { // we are unable to perform the export - os.Exit(1) + os.Exit(65) return } diff --git a/src/font/cli.go b/src/font/cli.go index 72e84722..421bd197 100644 --- a/src/font/cli.go +++ b/src/font/cli.go @@ -272,6 +272,6 @@ func Run(font string, system bool) { program = tea.NewProgram(main) if _, err := program.Run(); err != nil { print("Error running program: %v", err) - os.Exit(1) + os.Exit(70) } } From 05fe2e41590c477f269bda82358eead749d22615 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Mon, 11 Mar 2024 10:03:14 +0100 Subject: [PATCH 022/157] chore(launch): add config export --- .vscode/launch.json | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.vscode/launch.json b/.vscode/launch.json index 87f43fff..e669166c 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -77,6 +77,17 @@ "--print" ] }, + { + "name": "Export Config", + "type": "go", + "request": "launch", + "mode": "debug", + "program": "${workspaceRoot}/src", + "args": [ + "config", + "export" + ] + }, { "name": "Export Image", "type": "go", From fb16d7c4170789446eddcb90133a612bf7b4e3be Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Mon, 11 Mar 2024 10:07:29 +0100 Subject: [PATCH 023/157] fix(export): fail on invalid config option --- src/cli/config_export.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/cli/config_export.go b/src/cli/config_export.go index 67af7573..4cd756af 100644 --- a/src/cli/config_export.go +++ b/src/cli/config_export.go @@ -4,6 +4,7 @@ import ( "fmt" "os" "path/filepath" + "slices" "strings" "github.com/jandedobbeleer/oh-my-posh/src/engine" @@ -49,6 +50,12 @@ Exports the ~/myconfig.omp.json config file to toml and prints the result to std os.Exit(2) } + formats := []string{"json", "jsonc", "toml", "tml", "yaml", "yml"} + if len(format) != 0 && !slices.Contains(formats, format) { + // usage error + os.Exit(2) + } + if len(output) == 0 { fmt.Print(cfg.Export(format)) return From 822f1c3ecdd04163646d1e3de63613d3bf2bf8d1 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Mon, 11 Mar 2024 10:13:39 +0100 Subject: [PATCH 024/157] feat(go): upgrade dependencies --- src/go.mod | 24 ++++++++++++------------ src/go.sum | 53 ++++++++++++++++++++++++++--------------------------- 2 files changed, 38 insertions(+), 39 deletions(-) diff --git a/src/go.mod b/src/go.mod index 2686bdbc..bdab8339 100644 --- a/src/go.mod +++ b/src/go.mod @@ -7,7 +7,7 @@ require ( github.com/Masterminds/sprig/v3 v3.2.3 github.com/alecthomas/assert v1.0.0 github.com/alecthomas/colour v0.1.0 // indirect - github.com/alecthomas/repr v0.2.0 // indirect + github.com/alecthomas/repr v0.4.0 // indirect github.com/esimov/stackblur-go v1.1.0 github.com/fogleman/gg v1.3.0 github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 @@ -20,7 +20,7 @@ require ( github.com/stretchr/objx v0.5.2 // indirect github.com/stretchr/testify v1.9.0 github.com/wayneashleyberry/terminal-dimensions v1.1.0 - golang.org/x/crypto v0.19.0 // indirect + golang.org/x/crypto v0.21.0 // indirect golang.org/x/image v0.15.0 golang.org/x/sys v0.18.0 golang.org/x/text v0.14.0 @@ -40,7 +40,7 @@ require ( github.com/pelletier/go-toml/v2 v2.1.1 github.com/spf13/cobra v1.8.0 github.com/spf13/pflag v1.0.5 - golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3 + golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 golang.org/x/mod v0.16.0 gopkg.in/yaml.v3 v3.0.1 ) @@ -52,7 +52,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-ole/go-ole v1.3.0 // indirect github.com/imdario/mergo v0.3.16 // indirect - github.com/lufia/plan9stats v0.0.0-20231016141302-07b5767bb0ed // indirect + github.com/lufia/plan9stats v0.0.0-20240226150601-1dcf7310316a // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect @@ -70,28 +70,28 @@ require ( github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect github.com/containerd/console v1.0.4 // indirect github.com/dsnet/compress v0.0.1 // indirect - github.com/fatih/color v1.10.0 // indirect + github.com/fatih/color v1.16.0 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 // indirect - github.com/mattn/go-colorable v0.1.8 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-localereader v0.0.1 // indirect github.com/mitchellh/go-wordwrap v1.0.1 // indirect github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect github.com/muesli/cancelreader v0.2.2 // indirect github.com/muesli/reflow v0.3.0 // indirect github.com/muesli/termenv v0.15.2 // indirect - github.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b // indirect + github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect github.com/rivo/uniseg v0.4.7 // indirect - github.com/sahilm/fuzzy v0.1.1-0.20230530133925-c48e322e2a8f // indirect + github.com/sahilm/fuzzy v0.1.1 // indirect github.com/shoenig/go-m1cpu v0.1.6 // indirect github.com/shopspring/decimal v1.3.1 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect - github.com/zclconf/go-cty v1.14.2 // indirect + github.com/zclconf/go-cty v1.14.3 // indirect golang.org/x/sync v0.6.0 // indirect - golang.org/x/term v0.17.0 // indirect - golang.org/x/tools v0.17.0 // indirect - golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect + golang.org/x/term v0.18.0 // indirect + golang.org/x/tools v0.19.0 // indirect + golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect ) replace github.com/atotto/clipboard v0.1.4 => github.com/jandedobbeleer/clipboard v0.1.4-1 diff --git a/src/go.sum b/src/go.sum index 1b69baea..f4dc5c36 100644 --- a/src/go.sum +++ b/src/go.sum @@ -19,8 +19,8 @@ github.com/alecthomas/assert v1.0.0 h1:3XmGh/PSuLzDbK3W2gUbRXwgW5lqPkuqvRgeQ30FI github.com/alecthomas/assert v1.0.0/go.mod h1:va/d2JC+M7F6s+80kl/R3G7FUiW6JzUO+hPhLyJ36ZY= github.com/alecthomas/colour v0.1.0 h1:nOE9rJm6dsZ66RGWYSFrXw461ZIt9A6+nHgL7FRrDUk= github.com/alecthomas/colour v0.1.0/go.mod h1:QO9JBoKquHd+jz9nshCh40fOfO+JzsoXy8qTHF68zU0= -github.com/alecthomas/repr v0.2.0 h1:HAzS41CIzNW5syS8Mf9UwXhNH1J9aix/BvDRf1Ml2Yk= -github.com/alecthomas/repr v0.2.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= +github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc= +github.com/alecthomas/repr v0.4.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY= github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= @@ -42,8 +42,8 @@ github.com/dsnet/compress v0.0.1/go.mod h1:Aw8dCMJ7RioblQeTqt88akK31OvO8Dhf5Jflh github.com/dsnet/golib v0.0.0-20171103203638-1ea166775780/go.mod h1:Lj+Z9rebOhdfkVLjJ8T6VcRQv3SXugXy999NBtR9aFY= github.com/esimov/stackblur-go v1.1.0 h1:fwnZJC/7sHFzu4CDMgdJ1QxMN/q3k5MGILuoU4hH6oQ= github.com/esimov/stackblur-go v1.1.0/go.mod h1:7PcTPCHHKStxbZvBkUlQJjRclqjnXtQ0NoORZt1AlHE= -github.com/fatih/color v1.10.0 h1:s36xzo75JdqLaaWoiEHk767eHiwo0598uUxyfiPkDsg= -github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= +github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= +github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= github.com/fogleman/gg v1.3.0 h1:/7zJX8F6AaYQc57WQCyN9cAIz+4bCJGO9B+dyW29am8= github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -104,11 +104,11 @@ github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgx github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= -github.com/lufia/plan9stats v0.0.0-20231016141302-07b5767bb0ed h1:036IscGBfJsFIgJQzlui7nK1Ncm0tp2ktmPj8xO4N/0= -github.com/lufia/plan9stats v0.0.0-20231016141302-07b5767bb0ed/go.mod h1:ilwx/Dta8jXAgpFYFvSWEMwxmbWXyiUHkd5FwyKhb5k= -github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= -github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/lufia/plan9stats v0.0.0-20240226150601-1dcf7310316a h1:3Bm7EwfUQUvhNeKIkUct/gl9eod1TcXuj8stxvi/GoI= +github.com/lufia/plan9stats v0.0.0-20240226150601-1dcf7310316a/go.mod h1:ilwx/Dta8jXAgpFYFvSWEMwxmbWXyiUHkd5FwyKhb5k= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4= @@ -137,8 +137,8 @@ github.com/pelletier/go-toml/v2 v2.1.1/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdU github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= -github.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b h1:0LFwY6Q3gMACTjAbMZBjXAqTOzOwFaj2Ld6cjeQ7Rig= -github.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= +github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= +github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= @@ -146,8 +146,8 @@ github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUc github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/sahilm/fuzzy v0.1.1-0.20230530133925-c48e322e2a8f h1:MvTmaQdww/z0Q4wrYjDSCcZ78NoftLQyHBSLW/Cx79Y= -github.com/sahilm/fuzzy v0.1.1-0.20230530133925-c48e322e2a8f/go.mod h1:VFvziUEIMCrT6A6tw2RFIXPXXmzXbOsSHF0DOI8ZK9Y= +github.com/sahilm/fuzzy v0.1.1 h1:ceu5RHF8DGgoi+/dR5PsECjCDH1BE3Fnmpo7aVXOdRA= +github.com/sahilm/fuzzy v0.1.1/go.mod h1:VFvziUEIMCrT6A6tw2RFIXPXXmzXbOsSHF0DOI8ZK9Y= github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= github.com/shirou/gopsutil/v3 v3.24.2 h1:kcR0erMbLg5/3LcInpw0X/rrPSqq4CDPyI6A6ZRC18Y= @@ -195,15 +195,15 @@ github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJu github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= -github.com/zclconf/go-cty v1.14.2 h1:kTG7lqmBou0Zkx35r6HJHUQTvaRPr5bIAf3AoHS0izI= -github.com/zclconf/go-cty v1.14.2/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= +github.com/zclconf/go-cty v1.14.3 h1:1JXy1XroaGrzZuG6X9dt7HL6s9AwbY+l4UNL8o5B6ho= +github.com/zclconf/go-cty v1.14.3/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= -golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo= -golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= -golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3 h1:/RIbNt/Zr7rVhIkQhooTxCxFcdWLGIKnZA4IXNFSrvo= -golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08= +golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= +golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= +golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 h1:LfspQV/FYTatPTr/3HzIcmiUFH7PGP+OQ6mgDYo3yuQ= +golang.org/x/exp v0.0.0-20240222234643-814bf88cf225/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc= golang.org/x/image v0.15.0 h1:kOELfmgrmJlw4Cdb7g/QGuB3CvDrXbqEIww/pNtNBm8= golang.org/x/image v0.15.0/go.mod h1:HUYqC05R2ZcZ3ejNQsIHQDQiwWM4JBqmm6MKANTp4LE= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= @@ -219,14 +219,13 @@ golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -238,8 +237,8 @@ golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= -golang.org/x/term v0.17.0 h1:mkTF7LCd6WGJNL3K1Ad7kwxNfYAW6a8a8QqtMblp/4U= -golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= +golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8= +golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -250,12 +249,12 @@ golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc= -golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= +golang.org/x/tools v0.19.0 h1:tfGCXNR1OsFG+sVdLAitlpjAvD/I6dHDKnYrpEZUHkw= +golang.org/x/tools v0.19.0/go.mod h1:qoJWxmGSIBmAeriMx19ogtrEPrGtDbPK634QFIcLAhc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU= +golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From 6500282575bba24596030af15311f15c61874f02 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Mon, 4 Mar 2024 07:57:48 +0100 Subject: [PATCH 025/157] feat(env): cache filesystem for fast lookup --- src/platform/shell.go | 49 ++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/src/platform/shell.go b/src/platform/shell.go index f70a801a..81941794 100644 --- a/src/platform/shell.go +++ b/src/platform/shell.go @@ -281,6 +281,8 @@ type Shell struct { networks []*Connection sync.RWMutex + + lsDirMap ConcurrentMap } func (env *Shell) Init() { @@ -430,20 +432,37 @@ func (env *Shell) Pwd() string { } func (env *Shell) HasFiles(pattern string) bool { + return env.HasFilesInDir(env.Pwd(), pattern) +} + +func (env *Shell) HasFilesInDir(dir, pattern string) bool { defer env.Trace(time.Now(), pattern) - cwd := env.Pwd() - fileSystem := os.DirFS(cwd) + fileSystem := os.DirFS(dir) + var dirEntries []fs.DirEntry - matches, err := fs.ReadDir(fileSystem, ".") - if err != nil { - env.Error(err) - env.Debug("false") - return false + if files, OK := env.lsDirMap.Get(dir); OK { + dirEntries, _ = files.([]fs.DirEntry) + } + + if len(dirEntries) == 0 { + var err error + dirEntries, err = fs.ReadDir(fileSystem, ".") + if err != nil { + env.Error(err) + env.Debug("false") + return false + } + + env.lsDirMap.Set(dir, dirEntries) } pattern = strings.ToLower(pattern) - for _, match := range matches { + + env.RWMutex.RLock() + defer env.RWMutex.RUnlock() + + for _, match := range dirEntries { if match.IsDir() { continue } @@ -465,20 +484,6 @@ func (env *Shell) HasFiles(pattern string) bool { return false } -func (env *Shell) HasFilesInDir(dir, pattern string) bool { - defer env.Trace(time.Now(), pattern) - fileSystem := os.DirFS(dir) - matches, err := fs.Glob(fileSystem, pattern) - if err != nil { - env.Error(err) - env.Debug("false") - return false - } - hasFilesInDir := len(matches) > 0 - env.DebugF("%t", hasFilesInDir) - return hasFilesInDir -} - func (env *Shell) HasFileInParentDirs(pattern string, depth uint) bool { defer env.Trace(time.Now(), pattern, fmt.Sprint(depth)) currentFolder := env.Pwd() From 414581cf687f404ffb87d2e62a1d17d36f8b13a9 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Tue, 5 Mar 2024 08:43:56 +0100 Subject: [PATCH 026/157] refactor: move cache out of shell --- src/platform/cache.go | 78 +++++++++++++++++++++++++++++++++++++++++++ src/platform/shell.go | 75 ----------------------------------------- 2 files changed, 78 insertions(+), 75 deletions(-) diff --git a/src/platform/cache.go b/src/platform/cache.go index 0e8298ba..f807b572 100644 --- a/src/platform/cache.go +++ b/src/platform/cache.go @@ -2,15 +2,46 @@ package platform import ( "encoding/json" + "fmt" "os" "path/filepath" + "strconv" + "sync" "time" ) +type Cache interface { + Init(home string) + Close() + // Gets the value for a given key. + // Returns the value and a boolean indicating if the key was found. + // In case the ttl expired, the function returns false. + Get(key string) (string, bool) + // Sets a value for a given key. + // The ttl indicates how many minutes to cache the value. + Set(key, value string, ttl int) + // Deletes a key from the cache. + Delete(key string) +} + const ( CacheFile = "/omp.cache" ) +func pid() string { + pid := os.Getenv("POSH_PID") + if len(pid) == 0 { + pid = strconv.Itoa(os.Getppid()) + } + return pid +} + +var ( + TEMPLATECACHE = fmt.Sprintf("template_cache_%s", pid()) + TOGGLECACHE = fmt.Sprintf("toggle_cache_%s", pid()) + PROMPTCOUNTCACHE = fmt.Sprintf("prompt_count_cache_%s", pid()) +) + type cacheObject struct { Value string `json:"value"` Timestamp int64 `json:"timestamp"` @@ -91,3 +122,50 @@ func (fc *fileCache) Delete(key string) { fc.cache.Delete(key) fc.dirty = true } + +type commandCache struct { + commands *ConcurrentMap +} + +func (c *commandCache) set(command, path string) { + c.commands.Set(command, path) +} + +func (c *commandCache) get(command string) (string, bool) { + cacheCommand, found := c.commands.Get(command) + if !found { + return "", false + } + command, ok := cacheCommand.(string) + return command, ok +} + +type TemplateCache struct { + Root bool + PWD string + Folder string + Shell string + ShellVersion string + UserName string + HostName string + Code int + Env map[string]string + Var SimpleMap + OS string + WSL bool + PromptCount int + SHLVL int + Segments *ConcurrentMap + SegmentsCache SimpleMap + + initialized bool + sync.RWMutex +} + +func (t *TemplateCache) AddSegmentData(key string, value any) { + t.Segments.Set(key, value) +} + +func (t *TemplateCache) RemoveSegmentData(key string) { + t.Segments.Delete(key) +} diff --git a/src/platform/shell.go b/src/platform/shell.go index 81941794..e1d70831 100644 --- a/src/platform/shell.go +++ b/src/platform/shell.go @@ -37,20 +37,6 @@ const ( CMD = "cmd" ) -func pid() string { - pid := os.Getenv("POSH_PID") - if len(pid) == 0 { - pid = strconv.Itoa(os.Getppid()) - } - return pid -} - -var ( - TEMPLATECACHE = fmt.Sprintf("template_cache_%s", pid()) - TOGGLECACHE = fmt.Sprintf("toggle_cache_%s", pid()) - PROMPTCOUNTCACHE = fmt.Sprintf("prompt_count_cache_%s", pid()) -) - type Flags struct { ErrorCode int PipeStatus string @@ -92,20 +78,6 @@ type FileInfo struct { IsDir bool } -type Cache interface { - Init(home string) - Close() - // Gets the value for a given key. - // Returns the value and a boolean indicating if the key was found. - // In case the ttl expired, the function returns false. - Get(key string) (string, bool) - // Sets a value for a given key. - // The ttl indicates how many minutes to cache the value. - Set(key, value string, ttl int) - // Deletes a key from the cache. - Delete(key string) -} - type HTTPRequestModifier func(request *http.Request) type WindowsRegistryValueType string @@ -168,36 +140,6 @@ type SystemInfo struct { Disks map[string]disk.IOCountersStat } -type TemplateCache struct { - Root bool - PWD string - Folder string - Shell string - ShellVersion string - UserName string - HostName string - Code int - Env map[string]string - Var SimpleMap - OS string - WSL bool - PromptCount int - SHLVL int - Segments *ConcurrentMap - SegmentsCache SimpleMap - - initialized bool - sync.RWMutex -} - -func (t *TemplateCache) AddSegmentData(key string, value any) { - t.Segments.Set(key, value) -} - -func (t *TemplateCache) RemoveSegmentData(key string) { - t.Segments.Delete(key) -} - type Environment interface { Getenv(key string) string Pwd() string @@ -253,23 +195,6 @@ type Environment interface { Trace(start time.Time, args ...string) } -type commandCache struct { - commands *ConcurrentMap -} - -func (c *commandCache) set(command, path string) { - c.commands.Set(command, path) -} - -func (c *commandCache) get(command string) (string, bool) { - cacheCommand, found := c.commands.Get(command) - if !found { - return "", false - } - command, ok := cacheCommand.(string) - return command, ok -} - type Shell struct { CmdFlags *Flags Var SimpleMap From 9686b32ffa78f3b9e65a6b9a39823e526f1aadc9 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Mon, 11 Mar 2024 18:00:50 +0100 Subject: [PATCH 027/157] fix(config): support jsonc --- src/engine/config.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/engine/config.go b/src/engine/config.go index 909550fc..ef09f9d5 100644 --- a/src/engine/config.go +++ b/src/engine/config.go @@ -132,7 +132,6 @@ func loadConfig(env platform.Environment) *Config { cfg.Format = strings.TrimPrefix(filepath.Ext(configFile), ".") cfg.env = env - // read the data data, err := os.ReadFile(configFile) if err != nil { env.DebugF("error reading config file: %s", err) @@ -144,13 +143,13 @@ func loadConfig(env platform.Environment) *Config { cfg.Format = YAML err = yaml.Unmarshal(data, &cfg) case "jsonc", "json": - cfg.Format = JSON - if cfg.Format == "jsonc" { str := jsonutil.StripComments(string(data)) data = []byte(str) } + cfg.Format = JSON + decoder := json.NewDecoder(bytes.NewReader(data)) err = decoder.Decode(&cfg) case "toml", "tml": From 7940b03b820d7cbe0d106d80023d9328df1dbddf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Mar 2024 01:03:23 +0000 Subject: [PATCH 028/157] chore(deps): bump softprops/action-gh-release from 2.0.2 to 2.0.3 Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 2.0.2 to 2.0.3. - [Release notes](https://github.com/softprops/action-gh-release/releases) - [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md) - [Commits](https://github.com/softprops/action-gh-release/compare/d99959edae48b5ffffd7b00da66dcdb0a33a52ee...3198ee18f814cdf787321b4a32a26ddbf37acc52) --- updated-dependencies: - dependency-name: softprops/action-gh-release dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4142b260..ec81c870 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -85,7 +85,7 @@ jobs: } shell: pwsh - name: Release 🎓 - uses: softprops/action-gh-release@d99959edae48b5ffffd7b00da66dcdb0a33a52ee + uses: softprops/action-gh-release@3198ee18f814cdf787321b4a32a26ddbf37acc52 with: tag_name: ${{ needs.changelog.outputs.tag }} body: ${{ needs.changelog.outputs.body }} From fd095c80a90b35445a9d2fbf2b83a7934045be6b Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Tue, 12 Mar 2024 09:17:29 +0100 Subject: [PATCH 029/157] fix(toml): use fork to escape glyphs correctly --- src/engine/config.go | 1 + src/go.mod | 2 ++ src/go.sum | 4 ++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/engine/config.go b/src/engine/config.go index ef09f9d5..caf0a34b 100644 --- a/src/engine/config.go +++ b/src/engine/config.go @@ -196,6 +196,7 @@ func (cfg *Config) Export(format string) string { case TOML: prefix := "#:schema https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json\n\n" tomlEncoder := toml.NewEncoder(&result) + tomlEncoder.SetIndentTables(true) err := tomlEncoder.Encode(cfg) if err != nil { diff --git a/src/go.mod b/src/go.mod index bdab8339..72ac54aa 100644 --- a/src/go.mod +++ b/src/go.mod @@ -99,3 +99,5 @@ replace github.com/atotto/clipboard v0.1.4 => github.com/jandedobbeleer/clipboar replace github.com/shirou/gopsutil/v3 v3.23.9 => github.com/jandedobbeleer/gopsutil/v3 v3.23.9-1 replace github.com/goccy/go-yaml v1.10.0 => github.com/jandedobbeleer/go-yaml v1.10.0-4 + +replace github.com/pelletier/go-toml/v2 v2.1.1 => github.com/jandedobbeleer/go-toml/v2 v2.1.1-1 diff --git a/src/go.sum b/src/go.sum index f4dc5c36..2a4c422b 100644 --- a/src/go.sum +++ b/src/go.sum @@ -88,6 +88,8 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2 github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jandedobbeleer/clipboard v0.1.4-1 h1:rJehm5W0a3hvjcxyB3snqLBV4yvMBBc12JyMP7ngNQw= github.com/jandedobbeleer/clipboard v0.1.4-1/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI= +github.com/jandedobbeleer/go-toml/v2 v2.1.1-1 h1:jBguKQLD6Inqf7mzHNNvWfbVO/apta+3Xlm9ronMBec= +github.com/jandedobbeleer/go-toml/v2 v2.1.1-1/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -132,8 +134,6 @@ github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s= github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8= github.com/muesli/termenv v0.15.2 h1:GohcuySI0QmI3wN8Ok9PtKGkgkFIk7y6Vpb5PvrY+Wo= github.com/muesli/termenv v0.15.2/go.mod h1:Epx+iuz8sNs7mNKhxzH4fWXGNpZwUaJKRS1noLXviQ8= -github.com/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= -github.com/pelletier/go-toml/v2 v2.1.1/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= From b38df39fd274968760e13fb0d6a258c1e976752a Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Tue, 12 Mar 2024 09:38:58 +0100 Subject: [PATCH 030/157] refactor: remove duplicate toml library --- src/go.mod | 1 - src/go.sum | 2 -- src/segments/project.go | 8 ++++---- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/go.mod b/src/go.mod index 72ac54aa..01a78104 100644 --- a/src/go.mod +++ b/src/go.mod @@ -46,7 +46,6 @@ require ( ) require ( - github.com/BurntSushi/toml v1.3.2 github.com/Masterminds/goutils v1.1.1 // indirect github.com/Masterminds/semver/v3 v3.2.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect diff --git a/src/go.sum b/src/go.sum index 2a4c422b..095f60be 100644 --- a/src/go.sum +++ b/src/go.sum @@ -2,8 +2,6 @@ dmitri.shuralyov.com/font/woff2 v0.0.0-20180220214647-957792cbbdab h1:Ew70NL+wL6 dmitri.shuralyov.com/font/woff2 v0.0.0-20180220214647-957792cbbdab/go.mod h1:FvHgTMJanm43G7B3MVSjS/jim5ytVqAJNAOpRhnuHJc= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= -github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8= -github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/ConradIrwin/font v0.0.0-20210318200717-ce8d41cc0732 h1:0EDePskeF4vNFCk70ATaFHQzjmwXsk+VImnMJttecNU= github.com/ConradIrwin/font v0.0.0-20210318200717-ce8d41cc0732/go.mod h1:krTLO7JWu6g8RMxG8sl+T1Hf8W93XQacBKJmqFZ2MFY= github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= diff --git a/src/segments/project.go b/src/segments/project.go index a4cef159..2d2656a6 100644 --- a/src/segments/project.go +++ b/src/segments/project.go @@ -12,7 +12,7 @@ import ( "github.com/jandedobbeleer/oh-my-posh/src/regex" "golang.org/x/exp/slices" - "github.com/BurntSushi/toml" + toml "github.com/pelletier/go-toml/v2" ) type ProjectItem struct { @@ -154,7 +154,7 @@ func (n *Project) getCargoPackage(item ProjectItem) *ProjectData { content := n.env.FileContent(item.Files[0]) var data CargoTOML - _, err := toml.Decode(content, &data) + err := toml.Unmarshal([]byte(content), &data) if err != nil { n.Error = err.Error() return nil @@ -170,7 +170,7 @@ func (n *Project) getPythonPackage(item ProjectItem) *ProjectData { content := n.env.FileContent(item.Files[0]) var data PyProjectTOML - _, err := toml.Decode(content, &data) + err := toml.Unmarshal([]byte(content), &data) if err != nil { n.Error = err.Error() return nil @@ -293,7 +293,7 @@ func (n *Project) getProjectData(item ProjectItem) *ProjectData { content := n.env.FileContent(item.Files[0]) var data ProjectData - _, err := toml.Decode(content, &data) + err := toml.Unmarshal([]byte(content), &data) if err != nil { n.Error = err.Error() return nil From f6a0bedf6ea9b04a421984f7e99f675544845a2d Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Tue, 12 Mar 2024 09:41:47 +0100 Subject: [PATCH 031/157] feat: pin to go 1.22 --- .devcontainer/devcontainer.json | 2 +- src/go.mod | 2 +- src/segments/golang_test.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index d029c0a9..726e5dcc 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -8,7 +8,7 @@ // Update the VARIANT arg to pick a version of Go: 1, 1.16, 1.17 // Append -bullseye or -buster to pin to an OS version. // Use -bullseye variants on local arm64/Apple Silicon. - "VARIANT": "1-1.21-bullseye", + "VARIANT": "1-1.22-bullseye", // Options: "POSH_THEME": "/workspaces/oh-my-posh/themes/jandedobbeleer.omp.json", diff --git a/src/go.mod b/src/go.mod index 01a78104..d16365f8 100644 --- a/src/go.mod +++ b/src/go.mod @@ -1,6 +1,6 @@ module github.com/jandedobbeleer/oh-my-posh/src -go 1.21 +go 1.22.0 require ( github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 diff --git a/src/segments/golang_test.go b/src/segments/golang_test.go index ff6a2557..022c02ee 100644 --- a/src/segments/golang_test.go +++ b/src/segments/golang_test.go @@ -22,7 +22,7 @@ func TestGolang(t *testing.T) { }{ {Case: "Go 1.15", ExpectedString: "1.15.8", Version: "go version go1.15.8 darwin/amd64"}, {Case: "Go 1.16", ExpectedString: "1.16", Version: "go version go1.16 darwin/amd64"}, - {Case: "go.mod 1.21", ParseModFile: true, HasModFileInParentDir: true, ExpectedString: "1.21"}, + {Case: "go.mod 1.22.0", ParseModFile: true, HasModFileInParentDir: true, ExpectedString: "1.22.0"}, {Case: "no go.mod file fallback", ParseModFile: true, ExpectedString: "1.16", Version: "go version go1.16 darwin/amd64"}, { Case: "invalid go.mod file fallback", From e49638c06879e4e87dee5a7cf3ef04f2bca1d83c Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Tue, 12 Mar 2024 09:47:40 +0100 Subject: [PATCH 032/157] fix(yaml): update go-yaml fork --- src/go.mod | 2 +- src/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/go.mod b/src/go.mod index d16365f8..9d348f2c 100644 --- a/src/go.mod +++ b/src/go.mod @@ -97,6 +97,6 @@ replace github.com/atotto/clipboard v0.1.4 => github.com/jandedobbeleer/clipboar replace github.com/shirou/gopsutil/v3 v3.23.9 => github.com/jandedobbeleer/gopsutil/v3 v3.23.9-1 -replace github.com/goccy/go-yaml v1.10.0 => github.com/jandedobbeleer/go-yaml v1.10.0-4 +replace github.com/goccy/go-yaml v1.11.3 => github.com/jandedobbeleer/go-yaml v1.11.3-1 replace github.com/pelletier/go-toml/v2 v2.1.1 => github.com/jandedobbeleer/go-toml/v2 v2.1.1-1 diff --git a/src/go.sum b/src/go.sum index 095f60be..b839ac10 100644 --- a/src/go.sum +++ b/src/go.sum @@ -59,8 +59,6 @@ github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68= github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= -github.com/goccy/go-yaml v1.11.3 h1:B3W9IdWbvrUu2OYQGwvU1nZtvMQJPBKgBUuweJjLj6I= -github.com/goccy/go-yaml v1.11.3/go.mod h1:wKnAMd44+9JAAnGQpWVEgBzGt3YuTaQ4uXoHvE4m7WU= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= @@ -88,6 +86,8 @@ github.com/jandedobbeleer/clipboard v0.1.4-1 h1:rJehm5W0a3hvjcxyB3snqLBV4yvMBBc1 github.com/jandedobbeleer/clipboard v0.1.4-1/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI= github.com/jandedobbeleer/go-toml/v2 v2.1.1-1 h1:jBguKQLD6Inqf7mzHNNvWfbVO/apta+3Xlm9ronMBec= github.com/jandedobbeleer/go-toml/v2 v2.1.1-1/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= +github.com/jandedobbeleer/go-yaml v1.11.3-1 h1:zAcPoe0u2aTOZHq0cNXBc2KpNjuyv02UPCzB8a2ibso= +github.com/jandedobbeleer/go-yaml v1.11.3-1/go.mod h1:wKnAMd44+9JAAnGQpWVEgBzGt3YuTaQ4uXoHvE4m7WU= github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= From 3d7be9250c7b84a173fbf503670167570a47e45d Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Tue, 12 Mar 2024 10:10:05 +0100 Subject: [PATCH 033/157] chore: remove unused staticcheck ignore --- src/platform/battery/battery_windows.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/platform/battery/battery_windows.go b/src/platform/battery/battery_windows.go index 976c7219..f0c2e47d 100644 --- a/src/platform/battery/battery_windows.go +++ b/src/platform/battery/battery_windows.go @@ -92,7 +92,7 @@ func uint32ToFloat64(num uint32) (float64, error) { } func setupDiSetup(proc *windows.LazyProc, nargs, a1, a2, a3, a4, a5, a6 uintptr) (uintptr, error) { - r1, _, errno := syscall.Syscall6(proc.Addr(), nargs, a1, a2, a3, a4, a5, a6) //nolint:staticcheck + r1, _, errno := syscall.Syscall6(proc.Addr(), nargs, a1, a2, a3, a4, a5, a6) if windows.Handle(r1) == windows.InvalidHandle { if errno != 0 { return 0, error(errno) @@ -103,7 +103,7 @@ func setupDiSetup(proc *windows.LazyProc, nargs, a1, a2, a3, a4, a5, a6 uintptr) } func setupDiCall(proc *windows.LazyProc, nargs, a1, a2, a3, a4, a5, a6 uintptr) syscall.Errno { - r1, _, errno := syscall.Syscall6(proc.Addr(), nargs, a1, a2, a3, a4, a5, a6) //nolint:staticcheck + r1, _, errno := syscall.Syscall6(proc.Addr(), nargs, a1, a2, a3, a4, a5, a6) if r1 == 0 { if errno != 0 { return errno @@ -148,7 +148,7 @@ func systemGet(idx int) (*battery, error) { return nil, err } defer func() { - _, _, _ = syscall.Syscall(setupDiDestroyDeviceInfoList.Addr(), 1, hdev, 0, 0) //nolint:staticcheck + _, _, _ = syscall.Syscall(setupDiDestroyDeviceInfoList.Addr(), 1, hdev, 0, 0) }() var did spDeviceInterfaceData From ae806a1942dd6cc7a2f4c37347a1b47d227fd824 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Tue, 12 Mar 2024 15:34:40 +0100 Subject: [PATCH 034/157] fix(config): do not escape glyphs for toml and yaml --- src/engine/config.go | 4 ++-- src/go.mod | 4 +--- src/go.sum | 8 ++++---- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/engine/config.go b/src/engine/config.go index caf0a34b..821472c9 100644 --- a/src/engine/config.go +++ b/src/engine/config.go @@ -184,7 +184,7 @@ func (cfg *Config) Export(format string) string { return "" } - return prefix + escapeGlyphs(result.String(), cfg.MigrateGlyphs) + return prefix + result.String() case JSON: jsonEncoder := json.NewEncoder(&result) jsonEncoder.SetEscapeHTML(false) @@ -203,7 +203,7 @@ func (cfg *Config) Export(format string) string { return "" } - return prefix + escapeGlyphs(result.String(), cfg.MigrateGlyphs) + return prefix + result.String() } // unsupported format diff --git a/src/go.mod b/src/go.mod index 9d348f2c..aa422e73 100644 --- a/src/go.mod +++ b/src/go.mod @@ -97,6 +97,4 @@ replace github.com/atotto/clipboard v0.1.4 => github.com/jandedobbeleer/clipboar replace github.com/shirou/gopsutil/v3 v3.23.9 => github.com/jandedobbeleer/gopsutil/v3 v3.23.9-1 -replace github.com/goccy/go-yaml v1.11.3 => github.com/jandedobbeleer/go-yaml v1.11.3-1 - -replace github.com/pelletier/go-toml/v2 v2.1.1 => github.com/jandedobbeleer/go-toml/v2 v2.1.1-1 +replace github.com/goccy/go-yaml v1.11.3 => github.com/jandedobbeleer/go-yaml v1.11.3-2 diff --git a/src/go.sum b/src/go.sum index b839ac10..c4377614 100644 --- a/src/go.sum +++ b/src/go.sum @@ -84,10 +84,8 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2 github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jandedobbeleer/clipboard v0.1.4-1 h1:rJehm5W0a3hvjcxyB3snqLBV4yvMBBc12JyMP7ngNQw= github.com/jandedobbeleer/clipboard v0.1.4-1/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI= -github.com/jandedobbeleer/go-toml/v2 v2.1.1-1 h1:jBguKQLD6Inqf7mzHNNvWfbVO/apta+3Xlm9ronMBec= -github.com/jandedobbeleer/go-toml/v2 v2.1.1-1/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= -github.com/jandedobbeleer/go-yaml v1.11.3-1 h1:zAcPoe0u2aTOZHq0cNXBc2KpNjuyv02UPCzB8a2ibso= -github.com/jandedobbeleer/go-yaml v1.11.3-1/go.mod h1:wKnAMd44+9JAAnGQpWVEgBzGt3YuTaQ4uXoHvE4m7WU= +github.com/jandedobbeleer/go-yaml v1.11.3-2 h1:mz6E/lRl29RqwYkb4HC03C2YwF5tVDNdfiPWa1hYRdo= +github.com/jandedobbeleer/go-yaml v1.11.3-2/go.mod h1:wKnAMd44+9JAAnGQpWVEgBzGt3YuTaQ4uXoHvE4m7WU= github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -132,6 +130,8 @@ github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s= github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8= github.com/muesli/termenv v0.15.2 h1:GohcuySI0QmI3wN8Ok9PtKGkgkFIk7y6Vpb5PvrY+Wo= github.com/muesli/termenv v0.15.2/go.mod h1:Epx+iuz8sNs7mNKhxzH4fWXGNpZwUaJKRS1noLXviQ8= +github.com/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= +github.com/pelletier/go-toml/v2 v2.1.1/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= From 8e2419452c33e233fec4dc12a13106f33e78f5d8 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Tue, 12 Mar 2024 15:35:39 +0100 Subject: [PATCH 035/157] fix(config): always strip comments from json --- src/engine/config.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/engine/config.go b/src/engine/config.go index 821472c9..378cffa3 100644 --- a/src/engine/config.go +++ b/src/engine/config.go @@ -143,13 +143,11 @@ func loadConfig(env platform.Environment) *Config { cfg.Format = YAML err = yaml.Unmarshal(data, &cfg) case "jsonc", "json": - if cfg.Format == "jsonc" { - str := jsonutil.StripComments(string(data)) - data = []byte(str) - } - cfg.Format = JSON + str := jsonutil.StripComments(string(data)) + data = []byte(str) + decoder := json.NewDecoder(bytes.NewReader(data)) err = decoder.Decode(&cfg) case "toml", "tml": From 57054adff986730c992b3e0507d6b58b4765cfca Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Mar 2024 00:41:24 +0000 Subject: [PATCH 036/157] chore(deps): bump actions/checkout from 4.1.1 to 4.1.2 Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.1 to 4.1.2. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/b4ffde65f46336ab88eb53be808477a3936bae11...9bb56186c3b09b4f86b1c65136769dd318469633) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/android.yml | 2 +- .github/workflows/build_code.yml | 2 +- .github/workflows/close_themes_pr.yml | 2 +- .github/workflows/code.yml | 2 +- .github/workflows/codeql.yml | 2 +- .github/workflows/docs.yml | 2 +- .github/workflows/gomod.yml | 2 +- .github/workflows/inno.yml | 2 +- .github/workflows/markdown.yml | 2 +- .github/workflows/merge_contributions_pr.yml | 2 +- .github/workflows/release.yml | 4 ++-- .github/workflows/scoop.yml | 2 +- .github/workflows/winget.yml | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 369ca8f9..81549f1d 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -9,7 +9,7 @@ jobs: container: ghcr.io/jandedobbeleer/golang-android-container:latest steps: - name: Checkout code 👋 - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 - name: Build run: | VERSION=$(echo "${{ github.event.release.name }}" | cut -c2-) diff --git a/.github/workflows/build_code.yml b/.github/workflows/build_code.yml index 111edaad..e4f496d6 100644 --- a/.github/workflows/build_code.yml +++ b/.github/workflows/build_code.yml @@ -17,7 +17,7 @@ jobs: shell: pwsh steps: - name: Checkout code 👋 - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 - name: Install Go 🗳 uses: ./.github/workflows/composite/bootstrap-go - name: Run GoReleaser 🚀 diff --git a/.github/workflows/close_themes_pr.yml b/.github/workflows/close_themes_pr.yml index b7ba89df..bf9f51aa 100644 --- a/.github/workflows/close_themes_pr.yml +++ b/.github/workflows/close_themes_pr.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code 👋 - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 - name: Check and close 🔐 uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea with: diff --git a/.github/workflows/code.yml b/.github/workflows/code.yml index 3eb90b40..bb1ad04a 100644 --- a/.github/workflows/code.yml +++ b/.github/workflows/code.yml @@ -25,7 +25,7 @@ jobs: go-version: 1.21 cache-dependency-path: src/go.sum - name: Checkout code - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 - name: Golang CI uses: golangci/golangci-lint-action@3cfe3a4abbb849e10058ce4af15d205b6da42804 with: diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index fb41361f..bb328264 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -25,7 +25,7 @@ jobs: go-version: 1.21 cache-dependency-path: src/go.sum - name: Checkout code - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 - name: Initialize CodeQL uses: github/codeql-action/init@cdcdbb579706841c47f7063dda365e292e5cad7a with: diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 8d640e41..ee0130eb 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest name: Build and Deploy steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 with: submodules: true persist-credentials: false diff --git a/.github/workflows/gomod.yml b/.github/workflows/gomod.yml index 080c364f..4a2032dd 100644 --- a/.github/workflows/gomod.yml +++ b/.github/workflows/gomod.yml @@ -15,7 +15,7 @@ jobs: go-version: 1.21 cache-dependency-path: src/go.sum - name: Checkout code - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 - name: Check for unused dependencies run: | go mod tidy diff --git a/.github/workflows/inno.yml b/.github/workflows/inno.yml index ee3b4f34..435b33ca 100644 --- a/.github/workflows/inno.yml +++ b/.github/workflows/inno.yml @@ -15,7 +15,7 @@ jobs: working-directory: ${{ github.workspace }}/packages/inno steps: - name: Checkout code 👋 - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 - name: Build installer 📦 id: build env: diff --git a/.github/workflows/markdown.yml b/.github/workflows/markdown.yml index 9a2bfac0..5c364603 100644 --- a/.github/workflows/markdown.yml +++ b/.github/workflows/markdown.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 - name: Lint files uses: articulate/actions-markdownlint@17b8abe7407cd17590c006ecc837c35e1ac3ed83 with: diff --git a/.github/workflows/merge_contributions_pr.yml b/.github/workflows/merge_contributions_pr.yml index 4dffb6fb..64a592b7 100644 --- a/.github/workflows/merge_contributions_pr.yml +++ b/.github/workflows/merge_contributions_pr.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code 👋 - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 - name: Check and merge ⛙ uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ec81c870..a4bd7bfd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,7 +19,7 @@ jobs: skipped: ${{ steps.changelog.outputs.skipped }} steps: - name: Checkout code 👋 - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 - name: Create changelog ✍️ id: changelog uses: TriPSs/conventional-changelog-action@f04dac1fd07687cec8ea302937ca588b33786e98 @@ -41,7 +41,7 @@ jobs: working-directory: ${{ github.workspace }}/src steps: - name: Checkout code 👋 - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 - name: Install Go 🗳 uses: ./.github/workflows/composite/bootstrap-go - name: Tag HEAD 😸 diff --git a/.github/workflows/scoop.yml b/.github/workflows/scoop.yml index 8feb727d..b1a630e1 100644 --- a/.github/workflows/scoop.yml +++ b/.github/workflows/scoop.yml @@ -18,7 +18,7 @@ jobs: working-directory: ${{ github.workspace }}/packages/scoop steps: - name: Checkout code 👋 - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 - name: Update Template ✍️ run: | ./build.ps1 -Version ${{ github.event.inputs.version }} diff --git a/.github/workflows/winget.yml b/.github/workflows/winget.yml index c2993e4b..9540f46b 100644 --- a/.github/workflows/winget.yml +++ b/.github/workflows/winget.yml @@ -17,7 +17,7 @@ jobs: WINGETCREATE_TOKEN: ${{ secrets.WINGETCREATE_TOKEN }} steps: - name: Checkout code 👋 - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 - name: Create manifest and submit PR 📦 run: | ./build.ps1 -Version "${{ github.event.inputs.version }}" -Token $env:WINGETCREATE_TOKEN From 33148ef8f99701bc262f06b9da30ec7c2e114231 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Mar 2024 00:41:27 +0000 Subject: [PATCH 037/157] chore(deps): bump softprops/action-gh-release from 2.0.3 to 2.0.4 Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 2.0.3 to 2.0.4. - [Release notes](https://github.com/softprops/action-gh-release/releases) - [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md) - [Commits](https://github.com/softprops/action-gh-release/compare/3198ee18f814cdf787321b4a32a26ddbf37acc52...9d7c94cfd0a1f3ed45544c887983e9fa900f0564) --- updated-dependencies: - dependency-name: softprops/action-gh-release dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a4bd7bfd..ef081132 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -85,7 +85,7 @@ jobs: } shell: pwsh - name: Release 🎓 - uses: softprops/action-gh-release@3198ee18f814cdf787321b4a32a26ddbf37acc52 + uses: softprops/action-gh-release@9d7c94cfd0a1f3ed45544c887983e9fa900f0564 with: tag_name: ${{ needs.changelog.outputs.tag }} body: ${{ needs.changelog.outputs.body }} From d05737a8e8a3295bc7ab87a2c9e4f36de0bac9c8 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Wed, 13 Mar 2024 15:20:41 +0100 Subject: [PATCH 038/157] fix(spotify): parse correctly when in WSL --- src/segments/spotify_wsl.go | 36 ++++++++++++++++++++++---------- src/segments/spotify_wsl_test.go | 11 ++++++++++ 2 files changed, 36 insertions(+), 11 deletions(-) diff --git a/src/segments/spotify_wsl.go b/src/segments/spotify_wsl.go index 347f67de..9a8bc63c 100644 --- a/src/segments/spotify_wsl.go +++ b/src/segments/spotify_wsl.go @@ -3,7 +3,6 @@ package segments import ( - "encoding/csv" "strings" ) @@ -11,24 +10,39 @@ func (s *Spotify) Enabled() bool { if !s.env.IsWsl() { return false } + tlist, err := s.env.RunCommand("tasklist.exe", "/V", "/FI", "Imagename eq Spotify.exe", "/FO", "CSV", "/NH") if err != nil || strings.HasPrefix(tlist, "INFO") { return false } - records, err := csv.NewReader(strings.NewReader(tlist)).ReadAll() - if err != nil || len(records) == 0 { + + records := strings.Split(tlist, "\n") + if len(records) == 0 { return false } + for _, record := range records { - title := record[len(record)-1] - if strings.Contains(title, " - ") { - infos := strings.Split(title, " - ") - s.Artist = infos[0] - s.Track = strings.Join(infos[1:], " - ") - s.Status = playing - s.resolveIcon() - return true + fields := strings.Split(record, ",") + if len(fields) == 0 { + continue } + + // last elemant is the title + title := fields[len(fields)-1] + // trim leading and trailing quotes from the field + title = strings.TrimPrefix(title, `"`) + title = strings.TrimSuffix(title, `"`) + if !strings.Contains(title, " - ") { + continue + } + + infos := strings.Split(title, " - ") + s.Artist = infos[0] + s.Track = strings.Join(infos[1:], " - ") + s.Status = playing + s.resolveIcon() + return true } + return false } diff --git a/src/segments/spotify_wsl_test.go b/src/segments/spotify_wsl_test.go index 0c3e0c33..bd16d893 100644 --- a/src/segments/spotify_wsl_test.go +++ b/src/segments/spotify_wsl_test.go @@ -46,6 +46,17 @@ func TestSpotifyWsl(t *testing.T) { "Spotify.exe","22052","Console","1","29,040 K","Unknown","PC\user","0:00:00","N/A" "Spotify.exe","22072","Console","1","43,960 K","Unknown","PC\user","0:01:50","N/A" "Spotify.exe","10404","Console","1","256,924 K","Unknown","PC\user","0:10:49","N/A"`, + }, + { + Case: "Spotify playing", + ExpectedString: "\ue602 Grabbitz - Another Form Of \"Goodbye\"", + ExpectedEnabled: true, + ExecOutput: `"Spotify.exe","13748","Console","1","303.744 K","Running","GARMIN\elderbroekowe","0:03:58","Grabbitz - Another Form Of "Goodbye"" +"Spotify.exe","4208","Console","1","31.544 K","Running","GARMIN\elderbroekowe","0:00:00","N/A" +"Spotify.exe","14528","Console","1","184.020 K","Running","GARMIN\elderbroekowe","0:02:54","N/A" +"Spotify.exe","14488","Console","1","53.828 K","Unknown","GARMIN\elderbroekowe","0:00:08","N/A" +"Spotify.exe","14800","Console","1","29.576 K","Unknown","GARMIN\elderbroekowe","0:00:00","N/A" +"Spotify.exe","19836","Console","1","237.360 K","Unknown","GARMIN\elderbroekowe","0:07:46","N/A"`, }, { Case: "tasklist.exe not in path", From 0674681fc827044e97de5b5f30486dff24c2d9c6 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Thu, 14 Mar 2024 08:26:39 +0100 Subject: [PATCH 039/157] refactor: remove csv from codepoint processing --- src/engine/migrate_glyphs.go | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/engine/migrate_glyphs.go b/src/engine/migrate_glyphs.go index 483c3c5e..0c1368f2 100644 --- a/src/engine/migrate_glyphs.go +++ b/src/engine/migrate_glyphs.go @@ -2,9 +2,10 @@ package engine import ( "context" - "encoding/csv" + "io" "net/http" "strconv" + "strings" "time" "github.com/jandedobbeleer/oh-my-posh/src/platform" @@ -30,23 +31,29 @@ func getGlyphCodePoints() (codePoints, error) { defer response.Body.Close() - lines, err := csv.NewReader(response.Body).ReadAll() + bytes, err := io.ReadAll(response.Body) if err != nil { return codePoints, err } + lines := strings.Split(string(bytes), "\n") + for _, line := range lines { - if len(line) < 2 { + fields := strings.Split(line, ",") + if len(fields) < 2 { continue } - oldGlyph, err := strconv.ParseUint(line[0], 16, 32) + + oldGlyph, err := strconv.ParseUint(fields[0], 16, 32) if err != nil { continue } - newGlyph, err := strconv.ParseUint(line[1], 16, 32) + + newGlyph, err := strconv.ParseUint(fields[1], 16, 32) if err != nil { continue } + codePoints[oldGlyph] = newGlyph } From 8791965f3f6306ddca401363c53ec4b8955f14ad Mon Sep 17 00:00:00 2001 From: Luca Zecca Date: Sun, 28 Jan 2024 19:17:12 +0100 Subject: [PATCH 040/157] feat: add pulumi segment --- src/engine/segment.go | 3 + src/segments/pulumi.go | 220 +++++++++++++++++++++++++++++ src/segments/pulumi_test.go | 234 +++++++++++++++++++++++++++++++ themes/schema.json | 14 ++ website/docs/segments/pulumi.mdx | 56 ++++++++ website/sidebars.js | 1 + 6 files changed, 528 insertions(+) create mode 100644 src/segments/pulumi.go create mode 100644 src/segments/pulumi_test.go create mode 100644 website/docs/segments/pulumi.mdx diff --git a/src/engine/segment.go b/src/engine/segment.go index ebc9a928..dd263b72 100644 --- a/src/engine/segment.go +++ b/src/engine/segment.go @@ -202,6 +202,8 @@ const ( PLASTIC SegmentType = "plastic" // Project version PROJECT SegmentType = "project" + // PULUMI writes the pulumi user, store and stack + PULUMI SegmentType = "pulumi" // PYTHON writes the virtual env name PYTHON SegmentType = "python" // QUASAR writes the QUASAR version and context @@ -322,6 +324,7 @@ var Segments = map[SegmentType]func() SegmentWriter{ PHP: func() SegmentWriter { return &segments.Php{} }, PLASTIC: func() SegmentWriter { return &segments.Plastic{} }, PROJECT: func() SegmentWriter { return &segments.Project{} }, + PULUMI: func() SegmentWriter { return &segments.Pulumi{} }, PYTHON: func() SegmentWriter { return &segments.Python{} }, QUASAR: func() SegmentWriter { return &segments.Quasar{} }, R: func() SegmentWriter { return &segments.R{} }, diff --git a/src/segments/pulumi.go b/src/segments/pulumi.go new file mode 100644 index 00000000..e514893d --- /dev/null +++ b/src/segments/pulumi.go @@ -0,0 +1,220 @@ +package segments + +import ( + "crypto/sha1" + "encoding/hex" + "encoding/json" + "fmt" + "path/filepath" + + "github.com/jandedobbeleer/oh-my-posh/src/platform" + "github.com/jandedobbeleer/oh-my-posh/src/properties" + "gopkg.in/yaml.v3" +) + +const ( + FetchStack properties.Property = "fetch_stack" + FetchAbout properties.Property = "fetch_about" + + JSON string = "json" + YAML string = "yaml" + + pulumiJSON string = "Pulumi.json" + pulumiYAML string = "Pulumi.yaml" +) + +type Pulumi struct { + props properties.Properties + env platform.Environment + + Stack string + Name string + + workspaceSHA1 string + + backend +} + +type backend struct { + URL string `json:"url"` + User string `json:"user"` +} + +type pulumiFileSpec struct { + Name string `yaml:"name" json:"name"` +} + +type pulumiWorkSpaceFileSpec struct { + Stack string `json:"stack"` +} + +func (p *Pulumi) Template() string { + return "\U000f0d46 {{ .Stack }}{{if .User }} :: {{ .User }}@{{ end }}{{ if .URL }}{{ .URL }}{{ end }}" +} + +func (p *Pulumi) Init(props properties.Properties, env platform.Environment) { + p.props = props + p.env = env +} + +func (p *Pulumi) Enabled() bool { + if !p.env.HasCommand("pulumi") { + return false + } + + err := p.getProjectName() + if err != nil { + p.env.Error(err) + return false + } + + if p.props.GetBool(FetchStack, false) { + p.getPulumiStackName() + } + + if p.props.GetBool(FetchAbout, false) { + p.getPulumiAbout() + } + + return true +} + +func (p *Pulumi) getPulumiStackName() { + if len(p.Name) == 0 || len(p.workspaceSHA1) == 0 { + p.env.Debug("pulumi project name or workspace sha1 is empty") + return + } + + stackNameFile := p.Name + "-" + p.workspaceSHA1 + "-" + "workspace.json" + + homedir := p.env.Home() + + workspaceCacheDir := filepath.Join(homedir, ".pulumi", "workspaces") + if !p.env.HasFolder(workspaceCacheDir) || !p.env.HasFilesInDir(workspaceCacheDir, stackNameFile) { + return + } + + workspaceCacheFile := filepath.Join(workspaceCacheDir, stackNameFile) + workspaceCacheFileContent := p.env.FileContent(workspaceCacheFile) + + var pulumiWorkspaceSpec pulumiWorkSpaceFileSpec + err := json.Unmarshal([]byte(workspaceCacheFileContent), &pulumiWorkspaceSpec) + if err != nil { + p.env.Error(fmt.Errorf("pulumi workspace file decode error")) + return + } + + p.env.DebugF("pulumi stack name: %s", pulumiWorkspaceSpec.Stack) + p.Stack = pulumiWorkspaceSpec.Stack +} + +func (p *Pulumi) getProjectName() error { + var kind, fileName string + for _, file := range []string{pulumiYAML, pulumiJSON} { + if p.env.HasFiles(file) { + fileName = file + kind = filepath.Ext(file)[1:] + } + } + + if len(kind) == 0 { + return fmt.Errorf("no pulumi spec file found") + } + + var pulumiFileSpec pulumiFileSpec + var err error + + pulumiFile := p.env.FileContent(fileName) + + switch kind { + case YAML: + err = yaml.Unmarshal([]byte(pulumiFile), &pulumiFileSpec) + case JSON: + err = json.Unmarshal([]byte(pulumiFile), &pulumiFileSpec) + default: + err = fmt.Errorf("unknown pulumi spec file format") + } + + if err != nil { + p.env.Error(err) + return nil + } + + p.Name = pulumiFileSpec.Name + + sha1HexString := func(value string) string { + h := sha1.New() + + _, err := h.Write([]byte(value)) + if err != nil { + p.env.Error(err) + return "" + } + + return hex.EncodeToString(h.Sum(nil)) + } + + p.workspaceSHA1 = sha1HexString(p.env.Pwd() + "/" + fileName) + + return nil +} + +func (p *Pulumi) getPulumiAbout() { + if len(p.Stack) == 0 { + p.env.Error(fmt.Errorf("pulumi stack name is empty, use `fetch_stack` property to enable stack fetching")) + return + } + + cacheKey := "pulumi-" + p.Name + "-" + p.Stack + "-" + p.workspaceSHA1 + "-about" + + getAboutCache := func(key string) (*backend, error) { + aboutBackend, OK := p.env.Cache().Get(key) + if (!OK || len(aboutBackend) == 0) || (OK && len(aboutBackend) == 0) { + return nil, fmt.Errorf("no data in cache") + } + + var backend *backend + err := json.Unmarshal([]byte(aboutBackend), &backend) + if err != nil { + p.env.DebugF("unable to decode about cache: %s", aboutBackend) + p.env.Error(fmt.Errorf("pulling about cache decode error")) + return nil, err + } + + return backend, nil + } + + aboutBackend, err := getAboutCache(cacheKey) + if err == nil { + p.backend = *aboutBackend + return + } + + aboutOutput, err := p.env.RunCommand("pulumi", "about", "--json") + + if err != nil { + p.env.Error(fmt.Errorf("unable to get pulumi about output")) + return + } + + var about struct { + Backend *backend `json:"backend"` + } + + err = json.Unmarshal([]byte(aboutOutput), &about) + if err != nil { + p.env.Error(fmt.Errorf("pulumi about output decode error")) + return + } + + if about.Backend == nil { + p.env.Debug("pulumi about backend is not set") + return + } + + p.backend = *about.Backend + + cacheTimeout := p.props.GetInt(properties.CacheTimeout, 43800) + jso, _ := json.Marshal(about.Backend) + p.env.Cache().Set(cacheKey, string(jso), cacheTimeout) +} diff --git a/src/segments/pulumi_test.go b/src/segments/pulumi_test.go new file mode 100644 index 00000000..bd277283 --- /dev/null +++ b/src/segments/pulumi_test.go @@ -0,0 +1,234 @@ +package segments + +import ( + "errors" + "path/filepath" + "testing" + + "github.com/jandedobbeleer/oh-my-posh/src/mock" + "github.com/jandedobbeleer/oh-my-posh/src/properties" + "github.com/stretchr/testify/assert" + mock2 "github.com/stretchr/testify/mock" +) + +func TestPulumi(t *testing.T) { + cases := []struct { + Case string + YAMLConfig string + JSONConfig string + + HasCommand bool + + FetchStack bool + Stack string + StackError error + + HasWorkspaceFolder bool + WorkSpaceFile string + + FetchAbout bool + About string + AboutError error + AboutCache string + + ExpectedString string + ExpectedEnabled bool + }{ + { + Case: "no pulumi command", + ExpectedEnabled: false, + HasCommand: false, + }, + { + Case: "pulumi command is present, but no pulumi file", + ExpectedEnabled: false, + HasCommand: true, + }, + { + Case: "pulumi file YAML is present", + ExpectedString: "\U000f0d46", + ExpectedEnabled: true, + HasCommand: true, + YAMLConfig: ` +name: oh-my-posh +runtime: golang +description: A Console App +`, + }, + { + Case: "pulumi file JSON is present", + ExpectedString: "\U000f0d46", + ExpectedEnabled: true, + HasCommand: true, + JSONConfig: `{ "name": "oh-my-posh" }`, + }, + { + Case: "no stack present", + ExpectedString: "\U000f0d46 1337", + ExpectedEnabled: true, + HasCommand: true, + HasWorkspaceFolder: true, + FetchStack: true, + JSONConfig: `{ "name": "oh-my-posh" }`, + WorkSpaceFile: `{ "stack": "1337" }`, + }, + { + Case: "pulumi stack", + ExpectedString: "\U000f0d46 1337", + ExpectedEnabled: true, + HasCommand: true, + HasWorkspaceFolder: true, + FetchStack: true, + JSONConfig: `{ "name": "oh-my-posh" }`, + WorkSpaceFile: `{ "stack": "1337" }`, + }, + { + Case: "pulumi URL", + ExpectedString: "\U000f0d46 1337 :: posh-user@s3://test-pulumi-state-test", + ExpectedEnabled: true, + HasCommand: true, + HasWorkspaceFolder: true, + FetchStack: true, + FetchAbout: true, + JSONConfig: `{ "name": "oh-my-posh" }`, + WorkSpaceFile: `{ "stack": "1337" }`, + About: `{ "backend": { "url": "s3://test-pulumi-state-test", "user":"posh-user" } }`, + }, + { + Case: "pulumi URL - cache", + ExpectedString: "\U000f0d46 1337 :: posh-user@s3://test-pulumi-state-test", + ExpectedEnabled: true, + HasCommand: true, + HasWorkspaceFolder: true, + FetchStack: true, + FetchAbout: true, + JSONConfig: `{ "name": "oh-my-posh" }`, + WorkSpaceFile: `{ "stack": "1337" }`, + AboutCache: `{ "url": "s3://test-pulumi-state-test", "user":"posh-user" }`, + }, + // Error flows + { + Case: "pulumi file JSON error", + ExpectedString: "\U000f0d46", + ExpectedEnabled: true, + FetchStack: true, + HasCommand: true, + JSONConfig: `{`, + }, + { + Case: "pulumi workspace file JSON error", + ExpectedString: "\U000f0d46", + ExpectedEnabled: true, + FetchStack: true, + HasCommand: true, + JSONConfig: `{ "name": "oh-my-posh" }`, + WorkSpaceFile: `{`, + HasWorkspaceFolder: true, + }, + { + Case: "pulumi URL, no fetch_stack set", + ExpectedString: "\U000f0d46", + ExpectedEnabled: true, + HasCommand: true, + FetchAbout: true, + JSONConfig: `{ "name": "oh-my-posh" }`, + }, + { + Case: "pulumi URL - cache error", + ExpectedString: "\U000f0d46 1337 :: posh-user@s3://test-pulumi-state-test-output", + ExpectedEnabled: true, + HasCommand: true, + HasWorkspaceFolder: true, + FetchStack: true, + FetchAbout: true, + JSONConfig: `{ "name": "oh-my-posh" }`, + WorkSpaceFile: `{ "stack": "1337" }`, + AboutCache: `{`, + About: `{ "backend": { "url": "s3://test-pulumi-state-test-output", "user":"posh-user" } }`, + }, + { + Case: "pulumi URL - about error", + ExpectedString: "\U000f0d46 1337", + ExpectedEnabled: true, + HasCommand: true, + HasWorkspaceFolder: true, + FetchStack: true, + FetchAbout: true, + JSONConfig: `{ "name": "oh-my-posh" }`, + WorkSpaceFile: `{ "stack": "1337" }`, + AboutError: errors.New("error"), + }, + { + Case: "pulumi URL - about decode error", + ExpectedString: "\U000f0d46 1337", + ExpectedEnabled: true, + HasCommand: true, + HasWorkspaceFolder: true, + FetchStack: true, + FetchAbout: true, + JSONConfig: `{ "name": "oh-my-posh" }`, + WorkSpaceFile: `{ "stack": "1337" }`, + About: `{`, + }, + { + Case: "pulumi URL - about backend is nil", + ExpectedString: "\U000f0d46 1337", + ExpectedEnabled: true, + HasCommand: true, + HasWorkspaceFolder: true, + FetchStack: true, + FetchAbout: true, + JSONConfig: `{ "name": "oh-my-posh" }`, + WorkSpaceFile: `{ "stack": "1337" }`, + About: `{}`, + }, + } + + for _, tc := range cases { + env := new(mock.MockedEnvironment) + + env.On("HasCommand", "pulumi").Return(tc.HasCommand) + env.On("RunCommand", "pulumi", []string{"stack", "ls", "--json"}).Return(tc.Stack, tc.StackError) + env.On("RunCommand", "pulumi", []string{"about", "--json"}).Return(tc.About, tc.AboutError) + + env.On("Pwd").Return("/home/foobar/Work/oh-my-posh/pulumi/projects/awesome-project") + env.On("Home").Return(filepath.Clean("/home/foobar")) + env.On("Error", mock2.Anything) + env.On("Debug", mock2.Anything) + env.On("DebugF", mock2.Anything, mock2.Anything) + + env.On("HasFiles", pulumiYAML).Return(len(tc.YAMLConfig) > 0) + env.On("FileContent", pulumiYAML).Return(tc.YAMLConfig, nil) + + env.On("HasFiles", pulumiJSON).Return(len(tc.JSONConfig) > 0) + env.On("FileContent", pulumiJSON).Return(tc.JSONConfig, nil) + + env.On("HasFolder", filepath.Clean("/home/foobar/.pulumi/workspaces")).Return(tc.HasWorkspaceFolder) + workspaceFile := "oh-my-posh-c62b7b6786c5c5a85896576e46a25d7c9f888e92-workspace.json" + env.On("HasFilesInDir", filepath.Clean("/home/foobar/.pulumi/workspaces"), workspaceFile).Return(len(tc.WorkSpaceFile) > 0) + env.On("FileContent", filepath.Clean("/home/foobar/.pulumi/workspaces/"+workspaceFile)).Return(tc.WorkSpaceFile, nil) + + cache := &mock.MockedCache{} + cache.On("Get", "pulumi-oh-my-posh-1337-c62b7b6786c5c5a85896576e46a25d7c9f888e92-about").Return(tc.AboutCache, len(tc.AboutCache) > 0) + cache.On("Set", mock2.Anything, mock2.Anything, mock2.Anything) + + env.On("Cache").Return(cache) + + pulumi := &Pulumi{ + env: env, + props: properties.Map{ + FetchStack: tc.FetchStack, + FetchAbout: tc.FetchAbout, + }, + } + + assert.Equal(t, tc.ExpectedEnabled, pulumi.Enabled(), tc.Case) + + if !tc.ExpectedEnabled { + continue + } + + var got = renderTemplate(env, pulumi.Template(), pulumi) + assert.Equal(t, tc.ExpectedString, got, tc.Case) + } +} diff --git a/themes/schema.json b/themes/schema.json index 3e4e91cf..1582a047 100644 --- a/themes/schema.json +++ b/themes/schema.json @@ -295,6 +295,7 @@ "php", "plastic", "project", + "pulumi", "root", "ruby", "rust", @@ -1957,6 +1958,19 @@ } } }, + { + "if": { + "properties": { + "type": { + "const": "pulumi" + } + } + }, + "then": { + "title": "Pulumi Segment", + "description": "https://ohmyposh.dev/docs/segments/pulumi" + } + }, { "if": { "properties": { diff --git a/website/docs/segments/pulumi.mdx b/website/docs/segments/pulumi.mdx new file mode 100644 index 00000000..0b1177dc --- /dev/null +++ b/website/docs/segments/pulumi.mdx @@ -0,0 +1,56 @@ +--- +id: pulumi +title: Pulumi +sidebar_label: Pulumi +--- + +## What + +Display the currently active pulumi logged-in user, url and stack. + +:::caution +This requires a pulumi binary in your PATH and will only show in directories that contain a `Pulumi.yaml` file. +::: + +## Sample Configuration + +import Config from "@site/src/components/Config.js"; + + + +## Properties + +| Name | Type | Default | Description | +| ------------- | --------- | ------- | ---------------------------------------------------------------------------------- | +| `fetch_stack` | `boolean` | `false` | fetch the current stack name | +| `fetch_about` | `boolean` | `false` | fetch the URL and user for the current stask. Requires `fetch_stack` set to `true` | + +## Template ([info][templates]) + +:::note default template + +```template +{{ .Stack }}{{if .User }} :: {{ .User }}@{{ end }}{{ if .URL }}{{ .URL }}{{ end }} +``` + +::: + +### Properties + +| Name | Type | Description | +| -------- | -------- | -------------------------------------------------- | +| `.Stack` | `string` | the current stack name | +| `.User` | `string` | is the current logged in user | +| `.Url` | `string` | the URL of the state where pulumi stores resources | + +[templates]: /docs/configuration/templates diff --git a/website/sidebars.js b/website/sidebars.js index a74ee249..0aba4195 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -104,6 +104,7 @@ module.exports = { "segments/php", "segments/plastic", "segments/project", + "segments/pulumi", "segments/python", "segments/quasar", "segments/r", From 1ce26266b5424c867e50a46926501dbeb3188096 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Thu, 14 Mar 2024 07:48:15 +0000 Subject: [PATCH 041/157] docs: update website/docs/contributors.md [skip ci] --- website/docs/contributors.md | 1 + 1 file changed, 1 insertion(+) diff --git a/website/docs/contributors.md b/website/docs/contributors.md index 872b79f3..cf08f90e 100644 --- a/website/docs/contributors.md +++ b/website/docs/contributors.md @@ -330,6 +330,7 @@ Thanks goes to these wonderful people ([emoji key][acek]): Grzegorz Krasoń
Grzegorz Krasoń

💻 rockyoung
rockyoung

💻 📖 Shravan Asati
Shravan Asati

🎨 + Luca Zecca
Luca Zecca

💻 🎨 📖 From bdc34aeeb739a3a39a4c265c055548068b825840 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Thu, 14 Mar 2024 07:48:16 +0000 Subject: [PATCH 042/157] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 481785e8..d7158197 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2308,6 +2308,17 @@ "contributions": [ "design" ] + }, + { + "login": "lzecca78", + "name": "Luca Zecca", + "avatar_url": "https://avatars.githubusercontent.com/u/3881844?v=4", + "profile": "https://github.com/lzecca78", + "contributions": [ + "code", + "design", + "doc" + ] } ], "contributorsPerLine": 7, From a7c60c36a5aec15199787044104396713558068f Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Thu, 14 Mar 2024 14:41:56 +0100 Subject: [PATCH 043/157] fix(spotify): trim whitespace before processing --- src/segments/spotify_wsl.go | 1 + 1 file changed, 1 insertion(+) diff --git a/src/segments/spotify_wsl.go b/src/segments/spotify_wsl.go index 9a8bc63c..ab754754 100644 --- a/src/segments/spotify_wsl.go +++ b/src/segments/spotify_wsl.go @@ -22,6 +22,7 @@ func (s *Spotify) Enabled() bool { } for _, record := range records { + record = strings.TrimSpace(record) fields := strings.Split(record, ",") if len(fields) == 0 { continue From a8f97f5aa2487fdfd25253a83aafae04aadb089c Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Thu, 14 Mar 2024 14:46:12 +0100 Subject: [PATCH 044/157] docs(export): remove deprecated flags --- src/cli/config_export_image.go | 2 -- website/docs/share-theme.md | 5 ++--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/cli/config_export_image.go b/src/cli/config_export_image.go index 191016bd..56c3f56c 100644 --- a/src/cli/config_export_image.go +++ b/src/cli/config_export_image.go @@ -109,8 +109,6 @@ Exports the config to an image file using customized output options.`, func init() { //nolint:gochecknoinits imageCmd.Flags().StringVar(&author, "author", "", "config author") imageCmd.Flags().StringVar(&bgColor, "background-color", "", "image background color") - // imageCmd.Flags().IntVar(&cursorPadding, "cursor-padding", 0, "prompt cursor padding") - // imageCmd.Flags().IntVar(&rPromptOffset, "rprompt-offset", 0, "right prompt offset") imageCmd.Flags().StringVarP(&outputImage, "output", "o", "", "image file (.png) to export to") exportCmd.AddCommand(imageCmd) } diff --git a/website/docs/share-theme.md b/website/docs/share-theme.md index 1700a93f..003c3d50 100644 --- a/website/docs/share-theme.md +++ b/website/docs/share-theme.md @@ -16,14 +16,13 @@ The oh-my-posh executable has the `config export image` command to export your c to an image file (.png). ```powershell -oh-my-posh config export image --cursor-padding 50 +oh-my-posh config export image ``` There are a couple of additional flags you can use to tweak the image rendering: -- `--cursor-padding`: spaces to add after the cursor indication (`_`) -- `--rprompt-offset`: spaces to add **before** a block that's right aligned - `--author`: the name of the creator, added after `ohmyposh.dev` - `--background-color`: the hex background color to use (e.g. `#222222`) +- `--output`: the file to export to (e.g. `theme.png`) For all options, and additional examples, use `oh-my-posh config export image --help` From f277c191b17aba6f6cd63dfa1b8324bf7e7bb5ae Mon Sep 17 00:00:00 2001 From: Joshua Reilly <30353736+jreilly-lukava@users.noreply.github.com> Date: Fri, 15 Mar 2024 00:20:38 -0600 Subject: [PATCH 045/157] fix(git): remove trailing space from upstream icons --- src/segments/git.go | 14 +++++++------- src/segments/git_test.go | 2 +- website/docs/segments/git.mdx | 14 +++++++------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/segments/git.go b/src/segments/git.go index d749f712..6be64223 100644 --- a/src/segments/git.go +++ b/src/segments/git.go @@ -492,19 +492,19 @@ func (g *Git) getUpstreamIcon() string { Icon properties.Property Default string }{ - "github": {GithubIcon, "\uF408 "}, - "gitlab": {GitlabIcon, "\uF296 "}, - "bitbucket": {BitbucketIcon, "\uF171 "}, - "dev.azure.com": {AzureDevOpsIcon, "\uEBE8 "}, - "visualstudio.com": {AzureDevOpsIcon, "\uEBE8 "}, - "codecommit": {CodeCommit, "\uF270 "}, + "github": {GithubIcon, "\uF408"}, + "gitlab": {GitlabIcon, "\uF296"}, + "bitbucket": {BitbucketIcon, "\uF171"}, + "dev.azure.com": {AzureDevOpsIcon, "\uEBE8"}, + "visualstudio.com": {AzureDevOpsIcon, "\uEBE8"}, + "codecommit": {CodeCommit, "\uF270"}, } for key, value := range defaults { if strings.Contains(g.UpstreamURL, key) { return g.props.GetString(value.Icon, value.Default) } } - return g.props.GetString(GitIcon, "\uE5FB ") + return g.props.GetString(GitIcon, "\uE5FB") } func (g *Git) setGitStatus() { diff --git a/src/segments/git_test.go b/src/segments/git_test.go index 1bafb553..43f26eb2 100644 --- a/src/segments/git_test.go +++ b/src/segments/git_test.go @@ -183,7 +183,7 @@ func TestEnabledInBareRepo(t *testing.T) { FetchRemote: true, Remote: "origin", RemoteURL: "git@github.com:JanDeDobbeleer/oh-my-posh.git", - ExpectedRemote: "\uf408 ", + ExpectedRemote: "\uf408", }, } for _, tc := range cases { diff --git a/website/docs/segments/git.mdx b/website/docs/segments/git.mdx index 753baf82..9c92ab0c 100644 --- a/website/docs/segments/git.mdx +++ b/website/docs/segments/git.mdx @@ -111,12 +111,12 @@ You can set the following properties to `true` to enable fetching additional inf | Name | Type | Description | | ------------------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `github_icon` | `string` | icon/text to display when the upstream is Github - defaults to `\uF408 ` | -| `gitlab_icon` | `string` | icon/text to display when the upstream is Gitlab - defaults to `\uF296 ` | -| `bitbucket_icon` | `string` | icon/text to display when the upstream is Bitbucket - defaults to `\uF171 ` | -| `azure_devops_icon` | `string` | icon/text to display when the upstream is Azure DevOps - defaults to `\uEBE8 ` | -| `codecommit_icon` | `string` | icon/text to display when the upstream is AWS CodeCommit - defaults to `\uF270 ` | -| `git_icon` | `string` | icon/text to display when the upstream is not known/mapped - defaults to `\uE5FB ` | +| `github_icon` | `string` | icon/text to display when the upstream is Github - defaults to `\uF408` | +| `gitlab_icon` | `string` | icon/text to display when the upstream is Gitlab - defaults to `\uF296` | +| `bitbucket_icon` | `string` | icon/text to display when the upstream is Bitbucket - defaults to `\uF171` | +| `azure_devops_icon` | `string` | icon/text to display when the upstream is Azure DevOps - defaults to `\uEBE8` | +| `codecommit_icon` | `string` | icon/text to display when the upstream is AWS CodeCommit - defaults to `\uF270` | +| `git_icon` | `string` | icon/text to display when the upstream is not known/mapped - defaults to `\uE5FB` | | `upstream_icons` | `map[string]string` | a key, value map representing the remote URL (or a part of that URL) and icon to use in case the upstream URL contains the key. These get precedence over the standard icons | ## Template ([info][templates]) @@ -157,7 +157,7 @@ You can set the following properties to `true` to enable fetching additional inf | `.Rebase` | `boolean` | true when in a rebase | | `.CherryPick` | `boolean` | true when in a cherry pick | | `.Revert` | `boolean` | true when in a revert | -| `.LatestTag` | `string` | the latest tag name | +| `.LatestTag` | `string` | the latest tag name | ### Status From aa5a8502fb9dcd873537e83acbd60c2ad8377a5c Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Fri, 15 Mar 2024 06:20:57 +0000 Subject: [PATCH 046/157] docs: update website/docs/contributors.md [skip ci] --- website/docs/contributors.md | 1 + 1 file changed, 1 insertion(+) diff --git a/website/docs/contributors.md b/website/docs/contributors.md index cf08f90e..bc8c93a7 100644 --- a/website/docs/contributors.md +++ b/website/docs/contributors.md @@ -331,6 +331,7 @@ Thanks goes to these wonderful people ([emoji key][acek]): rockyoung
rockyoung

💻 📖 Shravan Asati
Shravan Asati

🎨 Luca Zecca
Luca Zecca

💻 🎨 📖 + Joshua Reilly
Joshua Reilly

💻 📖 From 3f888df8e3df93cee38cec23123ec0ba52f4e307 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Fri, 15 Mar 2024 06:20:58 +0000 Subject: [PATCH 047/157] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index d7158197..82ae83f2 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2319,6 +2319,16 @@ "design", "doc" ] + }, + { + "login": "jreilly-lukava", + "name": "Joshua Reilly", + "avatar_url": "https://avatars.githubusercontent.com/u/30353736?v=4", + "profile": "https://github.com/jreilly-lukava", + "contributions": [ + "code", + "doc" + ] } ], "contributorsPerLine": 7, From 2596022db38b769e0b7201e88770f9a45332f75a Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Fri, 15 Mar 2024 09:08:36 +0100 Subject: [PATCH 048/157] theme(atomic): print right block correctly --- themes/atomic.omp.json | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/themes/atomic.omp.json b/themes/atomic.omp.json index 02e10f77..16e042c7 100644 --- a/themes/atomic.omp.json +++ b/themes/atomic.omp.json @@ -204,13 +204,14 @@ "background": "#b2bec3", "foreground": "#222222", "leading_diamond": "\ue0b6", + "trailing_diamond": "\ue0b2", "properties": { "linux": "\ue712", "macos": "\ue711", "windows": "\ue70f" }, "style": "diamond", - "template": " {{ if .WSL }}WSL at {{ end }}{{.Icon}}<#222222> \ue0b2", + "template": " {{ if .WSL }}WSL at {{ end }}{{.Icon}} ", "type": "os" }, { @@ -222,14 +223,14 @@ ], "foreground": "#262626", "invert_powerline": true, - "leading_diamond": "\ue0b2", + "powerline_symbol": "\ue0b2", "properties": { "charged_icon": "\uf240 ", "charging_icon": "\uf1e6 ", "discharging_icon": "\ue234 " }, - "style": "diamond", - "template": " {{ if not .Error }}{{ .Icon }}{{ .Percentage }}{{ end }}{{ .Error }}\uf295 <#262626>\ue0b2", + "style": "powerline", + "template": " {{ if not .Error }}{{ .Icon }}{{ .Percentage }}{{ end }}{{ .Error }}\uf295 ", "type": "battery" }, { From 6bbdfb9c45caade1ccd99a915130804c7ba095e7 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Mon, 18 Mar 2024 19:53:19 +0100 Subject: [PATCH 049/157] feat(node): do not show on .npmrc --- src/segments/node.go | 2 +- website/docs/segments/node.mdx | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/segments/node.go b/src/segments/node.go index ab8d8985..78a00402 100644 --- a/src/segments/node.go +++ b/src/segments/node.go @@ -32,7 +32,7 @@ func (n *Node) Init(props properties.Properties, env platform.Environment) { n.language = language{ env: env, props: props, - extensions: []string{"*.js", "*.ts", "package.json", ".nvmrc", "pnpm-workspace.yaml", ".pnpmfile.cjs", ".npmrc", ".vue"}, + extensions: []string{"*.js", "*.ts", "package.json", ".nvmrc", "pnpm-workspace.yaml", ".pnpmfile.cjs", ".vue"}, commands: []*cmd{ { executable: "node", diff --git a/website/docs/segments/node.mdx b/website/docs/segments/node.mdx index ef4174bd..446c9b0e 100644 --- a/website/docs/segments/node.mdx +++ b/website/docs/segments/node.mdx @@ -25,19 +25,19 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| ----------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | -| `fetch_version` | `boolean` | display the Node.js version - defaults to `true` | -| `missing_command_text` | `string` | text to display when the command is missing - defaults to empty | -| `display_mode` | `string` |
  • `always`: The segment is always displayed
  • `files`: The segment is only displayed when one of the following files is present (**default**):
    • `*.js`
    • `*.ts`
    • `package.json`
    • `.nvmrc`
    • `pnpm-workspace.yaml`
    • `.pnpmfile.cjs`
    • `.npmrc`
    • `.vue`
| -| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | -| `fetch_package_manager` | `boolean` | define if the current project uses Yarn or NPM - defaults to `false` | -| `yarn_icon` | `string` | the icon/text to display when using Yarn - defaults to ` \uF011B` | -| `npm_icon` | `string` | the icon/text to display when using NPM - defaults to ` \uE71E` | -| `extensions` | `[]string` | allows to override the default list of file extensions to validate | -| `folders` | `[]string` | allows to override the list of folder names to validate | -| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` | +| Name | Type | Description | +| ----------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | +| `fetch_version` | `boolean` | display the Node.js version - defaults to `true` | +| `missing_command_text` | `string` | text to display when the command is missing - defaults to empty | +| `display_mode` | `string` |
  • `always`: The segment is always displayed
  • `files`: The segment is only displayed when one of the following files is present (**default**):
    • `*.js`
    • `*.ts`
    • `package.json`
    • `.nvmrc`
    • `pnpm-workspace.yaml`
    • `.pnpmfile.cjs`
    • `.vue`
| +| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | +| `fetch_package_manager` | `boolean` | define if the current project uses Yarn or NPM - defaults to `false` | +| `yarn_icon` | `string` | the icon/text to display when using Yarn - defaults to ` \uF011B` | +| `npm_icon` | `string` | the icon/text to display when using NPM - defaults to ` \uE71E` | +| `extensions` | `[]string` | allows to override the default list of file extensions to validate | +| `folders` | `[]string` | allows to override the list of folder names to validate | +| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` | ## Template ([info][templates]) From cd232cd17e85aa19b75ecb01aa2a20927b107292 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Tue, 19 Mar 2024 08:28:15 +0100 Subject: [PATCH 050/157] revert(git): remove trailing space from upstream icons This reverts commit f277c191b17aba6f6cd63dfa1b8324bf7e7bb5ae as it was not the correct change to make. The upstream icons are supposed to have trailing spaces so they display correctly in the default template. resolves #4784 --- src/segments/git.go | 14 +++++++------- src/segments/git_test.go | 2 +- website/docs/segments/git.mdx | 14 +++++++------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/segments/git.go b/src/segments/git.go index 6be64223..d749f712 100644 --- a/src/segments/git.go +++ b/src/segments/git.go @@ -492,19 +492,19 @@ func (g *Git) getUpstreamIcon() string { Icon properties.Property Default string }{ - "github": {GithubIcon, "\uF408"}, - "gitlab": {GitlabIcon, "\uF296"}, - "bitbucket": {BitbucketIcon, "\uF171"}, - "dev.azure.com": {AzureDevOpsIcon, "\uEBE8"}, - "visualstudio.com": {AzureDevOpsIcon, "\uEBE8"}, - "codecommit": {CodeCommit, "\uF270"}, + "github": {GithubIcon, "\uF408 "}, + "gitlab": {GitlabIcon, "\uF296 "}, + "bitbucket": {BitbucketIcon, "\uF171 "}, + "dev.azure.com": {AzureDevOpsIcon, "\uEBE8 "}, + "visualstudio.com": {AzureDevOpsIcon, "\uEBE8 "}, + "codecommit": {CodeCommit, "\uF270 "}, } for key, value := range defaults { if strings.Contains(g.UpstreamURL, key) { return g.props.GetString(value.Icon, value.Default) } } - return g.props.GetString(GitIcon, "\uE5FB") + return g.props.GetString(GitIcon, "\uE5FB ") } func (g *Git) setGitStatus() { diff --git a/src/segments/git_test.go b/src/segments/git_test.go index 43f26eb2..1bafb553 100644 --- a/src/segments/git_test.go +++ b/src/segments/git_test.go @@ -183,7 +183,7 @@ func TestEnabledInBareRepo(t *testing.T) { FetchRemote: true, Remote: "origin", RemoteURL: "git@github.com:JanDeDobbeleer/oh-my-posh.git", - ExpectedRemote: "\uf408", + ExpectedRemote: "\uf408 ", }, } for _, tc := range cases { diff --git a/website/docs/segments/git.mdx b/website/docs/segments/git.mdx index 9c92ab0c..753baf82 100644 --- a/website/docs/segments/git.mdx +++ b/website/docs/segments/git.mdx @@ -111,12 +111,12 @@ You can set the following properties to `true` to enable fetching additional inf | Name | Type | Description | | ------------------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `github_icon` | `string` | icon/text to display when the upstream is Github - defaults to `\uF408` | -| `gitlab_icon` | `string` | icon/text to display when the upstream is Gitlab - defaults to `\uF296` | -| `bitbucket_icon` | `string` | icon/text to display when the upstream is Bitbucket - defaults to `\uF171` | -| `azure_devops_icon` | `string` | icon/text to display when the upstream is Azure DevOps - defaults to `\uEBE8` | -| `codecommit_icon` | `string` | icon/text to display when the upstream is AWS CodeCommit - defaults to `\uF270` | -| `git_icon` | `string` | icon/text to display when the upstream is not known/mapped - defaults to `\uE5FB` | +| `github_icon` | `string` | icon/text to display when the upstream is Github - defaults to `\uF408 ` | +| `gitlab_icon` | `string` | icon/text to display when the upstream is Gitlab - defaults to `\uF296 ` | +| `bitbucket_icon` | `string` | icon/text to display when the upstream is Bitbucket - defaults to `\uF171 ` | +| `azure_devops_icon` | `string` | icon/text to display when the upstream is Azure DevOps - defaults to `\uEBE8 ` | +| `codecommit_icon` | `string` | icon/text to display when the upstream is AWS CodeCommit - defaults to `\uF270 ` | +| `git_icon` | `string` | icon/text to display when the upstream is not known/mapped - defaults to `\uE5FB ` | | `upstream_icons` | `map[string]string` | a key, value map representing the remote URL (or a part of that URL) and icon to use in case the upstream URL contains the key. These get precedence over the standard icons | ## Template ([info][templates]) @@ -157,7 +157,7 @@ You can set the following properties to `true` to enable fetching additional inf | `.Rebase` | `boolean` | true when in a rebase | | `.CherryPick` | `boolean` | true when in a cherry pick | | `.Revert` | `boolean` | true when in a revert | -| `.LatestTag` | `string` | the latest tag name | +| `.LatestTag` | `string` | the latest tag name | ### Status From 17deda093d636445d82a9793cb65757a4b0fed72 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 20 Mar 2024 00:41:12 +0000 Subject: [PATCH 051/157] chore(deps): bump github.com/pelletier/go-toml/v2 in /src Bumps [github.com/pelletier/go-toml/v2](https://github.com/pelletier/go-toml) from 2.1.1 to 2.2.0. - [Release notes](https://github.com/pelletier/go-toml/releases) - [Changelog](https://github.com/pelletier/go-toml/blob/v2/.goreleaser.yaml) - [Commits](https://github.com/pelletier/go-toml/compare/v2.1.1...v2.2.0) --- updated-dependencies: - dependency-name: github.com/pelletier/go-toml/v2 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- src/go.mod | 2 +- src/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/go.mod b/src/go.mod index aa422e73..62f08666 100644 --- a/src/go.mod +++ b/src/go.mod @@ -37,7 +37,7 @@ require ( github.com/gookit/goutil v0.6.15 github.com/hashicorp/hcl/v2 v2.20.0 github.com/mattn/go-runewidth v0.0.15 - github.com/pelletier/go-toml/v2 v2.1.1 + github.com/pelletier/go-toml/v2 v2.2.0 github.com/spf13/cobra v1.8.0 github.com/spf13/pflag v1.0.5 golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 diff --git a/src/go.sum b/src/go.sum index c4377614..3c86fb7e 100644 --- a/src/go.sum +++ b/src/go.sum @@ -130,8 +130,8 @@ github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s= github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8= github.com/muesli/termenv v0.15.2 h1:GohcuySI0QmI3wN8Ok9PtKGkgkFIk7y6Vpb5PvrY+Wo= github.com/muesli/termenv v0.15.2/go.mod h1:Epx+iuz8sNs7mNKhxzH4fWXGNpZwUaJKRS1noLXviQ8= -github.com/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= -github.com/pelletier/go-toml/v2 v2.1.1/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= +github.com/pelletier/go-toml/v2 v2.2.0 h1:QLgLl2yMN7N+ruc31VynXs1vhMZa7CeHHejIeBAsoHo= +github.com/pelletier/go-toml/v2 v2.2.0/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= From ab5a9ed3a7243ae181dbd34643a152c2860e225d Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Sat, 23 Mar 2024 20:16:21 +0100 Subject: [PATCH 052/157] chore(lint): golangci-lint 1.57.0 compatibility --- src/.golangci.yml | 4 +--- src/ansi/ansi_writer.go | 2 +- src/segments/owm_test.go | 2 +- src/segments/ui5tooling_test.go | 2 +- src/template/text.go | 2 +- 5 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/.golangci.yml b/src/.golangci.yml index 82199d05..a6c3afe7 100644 --- a/src/.golangci.yml +++ b/src/.golangci.yml @@ -36,13 +36,11 @@ linters-settings: gocritic: enabled-tags: - diagnostic - - experimental + # - experimental - opinionated - performance - style disabled-tags: - experimental - disabled-checks: - - ifElseChain lll: line-length: 180 diff --git a/src/ansi/ansi_writer.go b/src/ansi/ansi_writer.go index a7f8652c..487253b7 100644 --- a/src/ansi/ansi_writer.go +++ b/src/ansi/ansi_writer.go @@ -428,7 +428,7 @@ func (w *Writer) writeSegmentColors() { return } - if fg.IsTransparent() && len(w.TerminalBackground) != 0 { + if fg.IsTransparent() && len(w.TerminalBackground) != 0 { //nolint: gocritic background := w.getAnsiFromColorString(w.TerminalBackground, false) w.writeEscapedAnsiString(fmt.Sprintf(colorise, background)) w.writeEscapedAnsiString(fmt.Sprintf(colorise, bg.ToForeground())) diff --git a/src/segments/owm_test.go b/src/segments/owm_test.go index fed85fd2..6bc85888 100644 --- a/src/segments/owm_test.go +++ b/src/segments/owm_test.go @@ -86,7 +86,7 @@ func TestOWMSegmentSingle(t *testing.T) { for _, tc := range cases { env := &mock.MockedEnvironment{} var props properties.Map - if tc.Latitude != 0 && tc.Longitude != 0 && tc.Location != "" { + if tc.Latitude != 0 && tc.Longitude != 0 && tc.Location != "" { //nolint: gocritic props = properties.Map{ APIKey: "key", Location: tc.Location, diff --git a/src/segments/ui5tooling_test.go b/src/segments/ui5tooling_test.go index 370b7807..12e05e3a 100644 --- a/src/segments/ui5tooling_test.go +++ b/src/segments/ui5tooling_test.go @@ -105,7 +105,7 @@ func mockFilePresence(tc *testCase, ui5tooling *UI5Tooling, env *mock.MockedEnvi } if match { - if tc.DisplayMode == DisplayModeFiles && tc.WorkingDir == WorkingDirRoot { + if tc.DisplayMode == DisplayModeFiles && tc.WorkingDir == WorkingDirRoot { //nolint: gocritic env.On("HasFiles", f).Return(true) env.On("HasFileInParentDirs", f, uint(4)).Return(false) // mode context, working dir != working dir root diff --git a/src/template/text.go b/src/template/text.go index 45df6060..116e0e9c 100644 --- a/src/template/text.go +++ b/src/template/text.go @@ -158,7 +158,7 @@ func (t *Text) cleanTemplate() { continue } // end of a variable, needs to be appended - if !isKnownVariable(property) { + if !isKnownVariable(property) { //nolint: gocritic result += ".Data" + property } else if strings.HasPrefix(property, ".Segments") && !strings.HasSuffix(property, ".Contains") { // as we can't provide a clean way to access the list From 11603e914f5f42a63e3d58667e8708e006cf4fb4 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer <2492783+JanDeDobbeleer@users.noreply.github.com> Date: Mon, 25 Mar 2024 15:53:06 +0100 Subject: [PATCH 053/157] chore(holopin): add helping hands badge --- .github/holopin.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/holopin.yml b/.github/holopin.yml index 20406d5e..2e19a317 100644 --- a/.github/holopin.yml +++ b/.github/holopin.yml @@ -4,3 +4,6 @@ stickers: - id: clg0u51g681700fmfr086ofc6 alias: wizard + - + id: clu72f66x59170fjoo6t2b7zs + alias: helping From c072bb941d63745e9bd0491c8fc8f03e033d14f4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 27 Mar 2024 00:39:21 +0000 Subject: [PATCH 054/157] chore(deps): bump github.com/hashicorp/hcl/v2 in /src Bumps [github.com/hashicorp/hcl/v2](https://github.com/hashicorp/hcl) from 2.20.0 to 2.20.1. - [Release notes](https://github.com/hashicorp/hcl/releases) - [Changelog](https://github.com/hashicorp/hcl/blob/main/CHANGELOG.md) - [Commits](https://github.com/hashicorp/hcl/compare/v2.20.0...v2.20.1) --- updated-dependencies: - dependency-name: github.com/hashicorp/hcl/v2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/go.mod | 2 +- src/go.sum | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/go.mod b/src/go.mod index 62f08666..4fc16ff5 100644 --- a/src/go.mod +++ b/src/go.mod @@ -35,7 +35,7 @@ require ( github.com/goccy/go-json v0.10.2 github.com/goccy/go-yaml v1.11.3 github.com/gookit/goutil v0.6.15 - github.com/hashicorp/hcl/v2 v2.20.0 + github.com/hashicorp/hcl/v2 v2.20.1 github.com/mattn/go-runewidth v0.0.15 github.com/pelletier/go-toml/v2 v2.2.0 github.com/spf13/cobra v1.8.0 diff --git a/src/go.sum b/src/go.sum index 3c86fb7e..3c1562d9 100644 --- a/src/go.sum +++ b/src/go.sum @@ -72,8 +72,8 @@ github.com/gookit/color v1.5.4 h1:FZmqs7XOyGgCAxmWyPslpiok1k05wmY3SJTytgvYFs0= github.com/gookit/color v1.5.4/go.mod h1:pZJOeOS8DM43rXbp4AZo1n9zCU2qjpcRko0b6/QJi9w= github.com/gookit/goutil v0.6.15 h1:mMQ0ElojNZoyPD0eVROk5QXJPh2uKR4g06slgPDF5Jo= github.com/gookit/goutil v0.6.15/go.mod h1:qdKdYEHQdEtyH+4fNdQNZfJHhI0jUZzHxQVAV3DaMDY= -github.com/hashicorp/hcl/v2 v2.20.0 h1:l++cRs/5jQOiKVvqXZm/P1ZEfVXJmvLS9WSVxkaeTb4= -github.com/hashicorp/hcl/v2 v2.20.0/go.mod h1:WmcD/Ym72MDOOx5F62Ly+leloeu6H7m0pG7VBiU6pQk= +github.com/hashicorp/hcl/v2 v2.20.1 h1:M6hgdyz7HYt1UN9e61j+qKJBqR3orTWbI1HKBJEdxtc= +github.com/hashicorp/hcl/v2 v2.20.1/go.mod h1:TZDqQ4kNKCbh1iJp99FdPiUaVDDUPivbqxZulxDYqL4= github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/huandu/xstrings v1.4.0 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU= github.com/huandu/xstrings v1.4.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= @@ -195,6 +195,8 @@ github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= github.com/zclconf/go-cty v1.14.3 h1:1JXy1XroaGrzZuG6X9dt7HL6s9AwbY+l4UNL8o5B6ho= github.com/zclconf/go-cty v1.14.3/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= +github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b h1:FosyBZYxY34Wul7O/MSKey3txpPYyCqVO5ZyceuQJEI= +github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b/go.mod h1:ZRKQfBXbGkpdV6QMzT3rU1kSTAnfu1dO8dPKjYprgj8= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= From 6e1137512cca0adafb3c0d3379cf0f1f9c002aa8 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Sun, 24 Mar 2024 16:38:52 +0100 Subject: [PATCH 055/157] feat(path): highlight git directory resolves #4727 --- src/segments/path.go | 233 +++++++++++++++++++++++---------- src/segments/path_test.go | 76 +++++++++-- website/docs/segments/path.mdx | 3 +- 3 files changed, 227 insertions(+), 85 deletions(-) diff --git a/src/segments/path.go b/src/segments/path.go index b6a67b78..9a626254 100644 --- a/src/segments/path.go +++ b/src/segments/path.go @@ -25,6 +25,7 @@ type Path struct { Location string Writable bool RootDir bool + Folders Folders } const ( @@ -48,8 +49,8 @@ const ( Short string = "short" // Full displays the full path Full string = "full" - // Folder displays the current folder - Folder string = "folder" + // FolderType displays the current folder + FolderType string = "folder" // Mixed like agnoster, but if a folder name is short enough, it is displayed as-is Mixed string = "mixed" // Letter like agnoster, but with the first letter of each folder name @@ -81,6 +82,8 @@ const ( FolderFormat properties.Property = "folder_format" // format to use on the first and last folder of the path EdgeFormat properties.Property = "edge_format" + // GitDirFormat format to use on the git directory + GitDirFormat properties.Property = "gitdir_format" ) func (pt *Path) Template() string { @@ -105,25 +108,34 @@ func (pt *Path) Enabled() bool { } func (pt *Path) setPaths() { + defer func() { + pt.Folders = pt.splitPath() + }() + pt.pwd = pt.env.Pwd() if (pt.env.Shell() == shell.PWSH || pt.env.Shell() == shell.PWSH5) && len(pt.env.Flags().PSWD) != 0 { pt.pwd = pt.env.Flags().PSWD } + if len(pt.pwd) == 0 { return } + // ensure a clean path pt.root, pt.relative = pt.replaceMappedLocations() + // this is a full replacement of the parent if len(pt.root) == 0 { pt.pwd = pt.relative return } + pathSeparator := pt.env.PathSeparator() if !strings.HasSuffix(pt.root, pathSeparator) && len(pt.relative) > 0 { pt.pwd = pt.root + pathSeparator + pt.relative return } + pt.pwd = pt.root + pt.relative } @@ -173,7 +185,7 @@ func (pt *Path) setStyle() { fallthrough case Full: pt.Path = pt.getFullPath() - case Folder: + case FolderType: pt.Path = pt.getFolderPath() case Powerlevel: maxWidth := int(pt.props.GetFloat64(MaxWidth, 0)) @@ -213,15 +225,17 @@ func (pt *Path) getMixedPath() string { threshold := int(pt.props.GetFloat64(MixedThreshold, 4)) folderIcon := pt.props.GetString(FolderIcon, "..") separator := pt.getFolderSeparator() - elements := strings.Split(pt.relative, pt.env.PathSeparator()) + if pt.root != pt.env.PathSeparator() { - elements = append([]string{pt.root}, elements...) + pt.Folders = append(Folders{{Name: pt.root}}, pt.Folders...) } - n := len(elements) - buffer.WriteString(elements[0]) + + n := len(pt.Folders) + buffer.WriteString(pt.Folders[0].Name) + for i := 1; i < n; i++ { - folder := elements[i] - if len(folder) > threshold && i != n-1 { + folder := pt.Folders[i].Name + if len(folder) > threshold && i != n-1 && !pt.Folders[i].Display { folder = folderIcon } buffer.WriteString(fmt.Sprintf("%s%s", separator, folder)) @@ -229,33 +243,27 @@ func (pt *Path) getMixedPath() string { return buffer.String() } -func (pt *Path) pathDepth(pwd string) int { - splitted := strings.Split(pwd, pt.env.PathSeparator()) - depth := 0 - for _, part := range splitted { - if part != "" { - depth++ - } - } - return depth -} - func (pt *Path) getAgnosterPath() string { folderIcon := pt.props.GetString(FolderIcon, "..") - splitted := strings.Split(pt.relative, pt.env.PathSeparator()) + if pt.root == pt.env.PathSeparator() { - pt.root = splitted[0] - splitted = splitted[1:] + pt.root = pt.Folders[0].Name + pt.Folders = pt.Folders[1:] } var elements []string - n := len(splitted) + n := len(pt.Folders) for i := 1; i < n; i++ { + if pt.Folders[i].Display { + elements = append(elements, pt.Folders[i].Name) + continue + } + elements = append(elements, folderIcon) } - if len(splitted) > 0 { - elements = append(elements, splitted[n-1]) + if len(pt.Folders) > 0 { + elements = append(elements, pt.Folders[n-1].Name) } return pt.colorizePath(pt.root, elements) @@ -263,52 +271,66 @@ func (pt *Path) getAgnosterPath() string { func (pt *Path) getAgnosterLeftPath() string { folderIcon := pt.props.GetString(FolderIcon, "..") - splitted := strings.Split(pt.relative, pt.env.PathSeparator()) + if pt.root == pt.env.PathSeparator() { - pt.root = splitted[0] - splitted = splitted[1:] + pt.root = pt.Folders[0].Name + pt.Folders = pt.Folders[1:] } var elements []string - n := len(splitted) - elements = append(elements, splitted[0]) + n := len(pt.Folders) + elements = append(elements, pt.Folders[0].Name) for i := 1; i < n; i++ { + if pt.Folders[i].Display { + elements = append(elements, pt.Folders[i].Name) + continue + } + elements = append(elements, folderIcon) } return pt.colorizePath(pt.root, elements) } -func (pt *Path) getRelevantLetter(folder string) string { +func (pt *Path) getRelevantLetter(folder *Folder) string { + if folder.Display { + return folder.Name + } + // check if there is at least a letter we can use - matches := regex.FindNamedRegexMatch(`(?P[\p{L}0-9]).*`, folder) + matches := regex.FindNamedRegexMatch(`(?P[\p{L}0-9]).*`, folder.Name) if matches == nil || len(matches["letter"]) == 0 { // no letter found, keep the folder unchanged - return folder + return folder.Name } letter := matches["letter"] // handle non-letter characters before the first found letter - letter = folder[0:strings.Index(folder, letter)] + letter + letter = folder.Name[0:strings.Index(folder.Name, letter)] + letter return letter } func (pt *Path) getLetterPath() string { - splitted := strings.Split(pt.relative, pt.env.PathSeparator()) if pt.root == pt.env.PathSeparator() { - pt.root = splitted[0] - splitted = splitted[1:] + pt.root = pt.Folders[0].Name + pt.Folders = pt.Folders[1:] } - pt.root = pt.getRelevantLetter(pt.root) + + pt.root = pt.getRelevantLetter(&Folder{Name: pt.root}) var elements []string - n := len(splitted) + n := len(pt.Folders) for i := 0; i < n-1; i++ { - letter := pt.getRelevantLetter(splitted[i]) + if pt.Folders[i].Display { + elements = append(elements, pt.Folders[i].Name) + continue + } + + letter := pt.getRelevantLetter(pt.Folders[i]) elements = append(elements, letter) } - if len(splitted) > 0 { - elements = append(elements, splitted[n-1]) + if len(pt.Folders) > 0 { + elements = append(elements, pt.Folders[n-1].Name) } return pt.colorizePath(pt.root, elements) @@ -316,98 +338,101 @@ func (pt *Path) getLetterPath() string { func (pt *Path) getUniqueLettersPath(maxWidth int) string { separator := pt.getFolderSeparator() - splitted := strings.Split(pt.relative, pt.env.PathSeparator()) if pt.root == pt.env.PathSeparator() { - pt.root = splitted[0] - splitted = splitted[1:] + pt.root = pt.Folders[0].Name + pt.Folders = pt.Folders[1:] } if maxWidth > 0 { - path := strings.Join(splitted, separator) + path := strings.Join(pt.Folders.List(), separator) if len(path) <= maxWidth { - return pt.colorizePath(pt.root, splitted) + return pt.colorizePath(pt.root, pt.Folders.List()) } } - pt.root = pt.getRelevantLetter(pt.root) + pt.root = pt.getRelevantLetter(&Folder{Name: pt.root}) var elements []string - n := len(splitted) + n := len(pt.Folders) letters := make(map[string]bool) letters[pt.root] = true for i := 0; i < n-1; i++ { - folder := splitted[i] - letter := pt.getRelevantLetter(folder) + folder := pt.Folders[i].Name + letter := pt.getRelevantLetter(pt.Folders[i]) + for letters[letter] { if letter == folder { break } letter += folder[len(letter) : len(letter)+1] } + letters[letter] = true elements = append(elements, letter) + // only return early on maxWidth > 0 // this enables the powerlevel10k behavior if maxWidth > 0 { - list := splitted[i+1:] + list := pt.Folders[i+1:].List() list = append(list, elements...) current := strings.Join(list, separator) leftover := maxWidth - len(current) - len(pt.root) - len(separator) if leftover >= 0 { - elements = append(elements, strings.Join(splitted[i+1:], separator)) + elements = append(elements, strings.Join(pt.Folders[i+1:].List(), separator)) return pt.colorizePath(pt.root, elements) } } } - if len(splitted) > 0 { - elements = append(elements, splitted[n-1]) + if len(pt.Folders) > 0 { + elements = append(elements, pt.Folders[n-1].Name) } return pt.colorizePath(pt.root, elements) } func (pt *Path) getAgnosterFullPath() string { - splitted := strings.Split(pt.relative, pt.env.PathSeparator()) if pt.root == pt.env.PathSeparator() { - pt.root = splitted[0] - splitted = splitted[1:] + pt.root = pt.Folders[0].Name + pt.Folders = pt.Folders[1:] } - return pt.colorizePath(pt.root, splitted) + return pt.colorizePath(pt.root, pt.Folders.List()) } func (pt *Path) getAgnosterShortPath() string { - pathDepth := pt.pathDepth(pt.relative) + pathDepth := len(pt.Folders) + maxDepth := pt.props.GetInt(MaxDepth, 1) if maxDepth < 1 { maxDepth = 1 } + folderIcon := pt.props.GetString(FolderIcon, "..") hideRootLocation := pt.props.GetBool(HideRootLocation, false) + if pathDepth <= maxDepth { if hideRootLocation { pt.root = folderIcon } return pt.getAgnosterFullPath() } + pathSeparator := pt.env.PathSeparator() - rel := strings.TrimPrefix(pt.relative, pathSeparator) - splitted := strings.Split(rel, pathSeparator) splitPos := pathDepth - maxDepth - // var buffer strings.Builder - var elements []string + + var folders []string // unix root, needs to be replaced with the folder we're in at root level root := pt.root room := pathDepth - maxDepth if root == pathSeparator { - root = splitted[0] + root = pt.Folders[0].Name room-- } if hideRootLocation || room > 0 { - elements = append(elements, folderIcon) + folders = append(folders, folderIcon) } if hideRootLocation { @@ -415,14 +440,14 @@ func (pt *Path) getAgnosterShortPath() string { } for i := splitPos; i < pathDepth; i++ { - elements = append(elements, splitted[i]) + folders = append(folders, pt.Folders[i].Name) } - return pt.colorizePath(root, elements) + + return pt.colorizePath(root, folders) } func (pt *Path) getFullPath() string { - elements := strings.Split(pt.relative, pt.env.PathSeparator()) - return pt.colorizePath(pt.root, elements) + return pt.colorizePath(pt.root, pt.Folders.List()) } func (pt *Path) getFolderPath() string { @@ -649,3 +674,69 @@ func (pt *Path) colorizePath(root string, elements []string) string { return builder.String() } + +type Folder struct { + Name string + Display bool + Path string +} + +type Folders []*Folder + +func (f Folders) List() []string { + var list []string + + for _, folder := range f { + list = append(list, folder.Name) + } + + return list +} + +func (pt *Path) splitPath() Folders { + result := Folders{} + folders := []string{} + + if len(pt.relative) != 0 { + folders = strings.Split(pt.relative, pt.env.PathSeparator()) + } + + folderFormatMap := pt.makeFolderFormatMap() + + currentPath := pt.root + if currentPath == "~" { + currentPath = pt.env.Home() + pt.env.PathSeparator() + } + + var display bool + + for _, folder := range folders { + currentPath += folder + + if format := folderFormatMap[currentPath]; len(format) != 0 { + folder = fmt.Sprintf(format, folder) + display = true + } + + result = append(result, &Folder{Name: folder, Path: currentPath, Display: display}) + + currentPath += pt.env.PathSeparator() + + display = false + } + + return result +} + +func (pt *Path) makeFolderFormatMap() map[string]string { + folderFormatMap := make(map[string]string) + + if gitDirFormat := pt.props.GetString(GitDirFormat, ""); len(gitDirFormat) != 0 { + dir, err := pt.env.HasParentFilePath(".git") + if err == nil && dir.IsDir { + folderFormatMap[dir.ParentFolder] = gitDirFormat + } + } + + return folderFormatMap +} diff --git a/src/segments/path_test.go b/src/segments/path_test.go index 8decb2fd..b4854293 100644 --- a/src/segments/path_test.go +++ b/src/segments/path_test.go @@ -787,21 +787,21 @@ func TestFullAndFolderPath(t *testing.T) { {Style: Full, FolderSeparatorIcon: "|", Pwd: homeDir + abc, Expected: "~|abc"}, {Style: Full, FolderSeparatorIcon: "|", Pwd: abcd, Expected: "/a|b|c|d"}, - {Style: Folder, Pwd: "/", Expected: "/"}, - {Style: Folder, Pwd: homeDir, Expected: "~"}, - {Style: Folder, Pwd: homeDir, Expected: "someone", DisableMappedLocations: true}, - {Style: Folder, Pwd: homeDir + abc, Expected: "abc"}, - {Style: Folder, Pwd: abcd, Expected: "d"}, + {Style: FolderType, Pwd: "/", Expected: "/"}, + {Style: FolderType, Pwd: homeDir, Expected: "~"}, + {Style: FolderType, Pwd: homeDir, Expected: "someone", DisableMappedLocations: true}, + {Style: FolderType, Pwd: homeDir + abc, Expected: "abc"}, + {Style: FolderType, Pwd: abcd, Expected: "d"}, - {Style: Folder, FolderSeparatorIcon: "|", Pwd: "/", Expected: "/"}, - {Style: Folder, FolderSeparatorIcon: "|", Pwd: homeDir, Expected: "~"}, - {Style: Folder, FolderSeparatorIcon: "|", Pwd: homeDir, Expected: "someone", DisableMappedLocations: true}, - {Style: Folder, FolderSeparatorIcon: "|", Pwd: homeDir + abc, Expected: "abc"}, - {Style: Folder, FolderSeparatorIcon: "|", Pwd: abcd, Expected: "d"}, + {Style: FolderType, FolderSeparatorIcon: "|", Pwd: "/", Expected: "/"}, + {Style: FolderType, FolderSeparatorIcon: "|", Pwd: homeDir, Expected: "~"}, + {Style: FolderType, FolderSeparatorIcon: "|", Pwd: homeDir, Expected: "someone", DisableMappedLocations: true}, + {Style: FolderType, FolderSeparatorIcon: "|", Pwd: homeDir + abc, Expected: "abc"}, + {Style: FolderType, FolderSeparatorIcon: "|", Pwd: abcd, Expected: "d"}, // for Windows paths - {Style: Folder, FolderSeparatorIcon: "\\", Pwd: "C:\\", Expected: "C:\\", PathSeparator: "\\", GOOS: platform.WINDOWS}, - {Style: Folder, FolderSeparatorIcon: "\\", Pwd: homeDirWindows, Expected: "~", PathSeparator: "\\", GOOS: platform.WINDOWS}, + {Style: FolderType, FolderSeparatorIcon: "\\", Pwd: "C:\\", Expected: "C:\\", PathSeparator: "\\", GOOS: platform.WINDOWS}, + {Style: FolderType, FolderSeparatorIcon: "\\", Pwd: homeDirWindows, Expected: "~", PathSeparator: "\\", GOOS: platform.WINDOWS}, {Style: Full, FolderSeparatorIcon: "\\", Pwd: homeDirWindows, Expected: "~", PathSeparator: "\\", GOOS: platform.WINDOWS}, {Style: Full, FolderSeparatorIcon: "\\", Pwd: homeDirWindows + "\\abc", Expected: "~\\abc", PathSeparator: "\\", GOOS: platform.WINDOWS}, {Style: Full, FolderSeparatorIcon: "\\", Pwd: "C:\\Users\\posh", Expected: "C:\\Users\\posh", PathSeparator: "\\", GOOS: platform.WINDOWS}, @@ -994,7 +994,7 @@ func TestFolderPathCustomMappedLocations(t *testing.T) { path := &Path{ env: env, props: properties.Map{ - properties.Style: Folder, + properties.Style: FolderType, MappedLocations: map[string]string{ abcd: "#", }, @@ -1502,3 +1502,53 @@ func TestReplaceMappedLocations(t *testing.T) { assert.Equal(t, tc.Expected, path.pwd) } } + +func TestSplitPath(t *testing.T) { + cases := []struct { + Case string + Relative string + Root string + GitDir *platform.FileInfo + GitDirFormat string + Expected Folders + }{ + {Case: "Root directory", Root: "/", Expected: Folders{}}, + { + Case: "Regular directory", + Root: "/", + Relative: "c/d", + Expected: Folders{ + {Name: "c", Path: "/c"}, + {Name: "d", Path: "/c/d"}, + }, + }, + { + Case: "Home directory - git folder", + Root: "~", + Relative: "c/d", + GitDir: &platform.FileInfo{IsDir: true, ParentFolder: "/a/b/c"}, + GitDirFormat: "%s", + Expected: Folders{ + {Name: "c", Path: "/a/b/c", Display: true}, + {Name: "d", Path: "/a/b/c/d"}, + }, + }, + } + + for _, tc := range cases { + env := new(mock.MockedEnvironment) + env.On("PathSeparator").Return("/") + env.On("Home").Return("/a/b") + env.On("HasParentFilePath", ".git").Return(tc.GitDir, nil) + path := &Path{ + env: env, + props: properties.Map{ + GitDirFormat: tc.GitDirFormat, + }, + root: tc.Root, + relative: tc.Relative, + } + got := path.splitPath() + assert.Equal(t, tc.Expected, got, tc.Case) + } +} diff --git a/website/docs/segments/path.mdx b/website/docs/segments/path.mdx index 84c2ad1a..648e7e37 100644 --- a/website/docs/segments/path.mdx +++ b/website/docs/segments/path.mdx @@ -40,12 +40,13 @@ import Config from "@site/src/components/Config.js"; | `style` | `enum` | how to display the current path | | `mixed_threshold` | `number` | the maximum length of a path segment that will be displayed when using `Mixed` - defaults to `4` | | `max_depth` | `number` | maximum path depth to display before shortening when using `agnoster_short`, defaults to `1` | -| `max_width` | `number` | maximum path length to display when using `powerlevel`, defaults to `0` | +| `max_width` | `number` | maximum path length to display when using `powerlevel` - defaults to `0` | | `hide_root_location` | `boolean` | hides the root location if it doesn't fit in the last `max_depth` folders, when using `agnoster_short` - defaults to `false` | | `cycle` | `[]string` | a list of color overrides to cycle through to colorize the individual path folders, e.g. `[ "#ffffff,#111111" ]` | | `cycle_folder_separator` | `boolean` | colorize the `folder_separator_icon` as well when using a cycle - defaults to `false` | | `folder_format` | `string` | format to use on individual path folders - defaults to `%s` | | `edge_format` | `string` | format to use on the first and last folder of the path - defaults to `%s` | +| `gitdir_format` | `string` | format to use for a git root directory - defaults to `` | ## Mapped Locations From 6f71fc417a1e4f8dc0b08b0f29ec021e36d4a990 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Sat, 30 Mar 2024 15:32:10 +0100 Subject: [PATCH 056/157] chore: ignore deprecated syscall.Syscall --- src/platform/battery/battery_windows.go | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/platform/battery/battery_windows.go b/src/platform/battery/battery_windows.go index f0c2e47d..1e0b007a 100644 --- a/src/platform/battery/battery_windows.go +++ b/src/platform/battery/battery_windows.go @@ -92,7 +92,7 @@ func uint32ToFloat64(num uint32) (float64, error) { } func setupDiSetup(proc *windows.LazyProc, nargs, a1, a2, a3, a4, a5, a6 uintptr) (uintptr, error) { - r1, _, errno := syscall.Syscall6(proc.Addr(), nargs, a1, a2, a3, a4, a5, a6) + r1, _, errno := syscall.Syscall6(proc.Addr(), nargs, a1, a2, a3, a4, a5, a6) //nolint:staticcheck if windows.Handle(r1) == windows.InvalidHandle { if errno != 0 { return 0, error(errno) @@ -103,7 +103,7 @@ func setupDiSetup(proc *windows.LazyProc, nargs, a1, a2, a3, a4, a5, a6 uintptr) } func setupDiCall(proc *windows.LazyProc, nargs, a1, a2, a3, a4, a5, a6 uintptr) syscall.Errno { - r1, _, errno := syscall.Syscall6(proc.Addr(), nargs, a1, a2, a3, a4, a5, a6) + r1, _, errno := syscall.Syscall6(proc.Addr(), nargs, a1, a2, a3, a4, a5, a6) //nolint:staticcheck if r1 == 0 { if errno != 0 { return errno @@ -144,11 +144,13 @@ func systemGet(idx int) (*battery, error) { 2|16, // DIGCF_PRESENT|DIGCF_DEVICEINTERFACE 0, 0, ) + if err != nil { return nil, err } + defer func() { - _, _, _ = syscall.Syscall(setupDiDestroyDeviceInfoList.Addr(), 1, hdev, 0, 0) + _, _, _ = syscall.Syscall(setupDiDestroyDeviceInfoList.Addr(), 1, hdev, 0, 0) //nolint:staticcheck }() var did spDeviceInterfaceData @@ -163,12 +165,15 @@ func systemGet(idx int) (*battery, error) { uintptr(unsafe.Pointer(&did)), 0, ) + if errno == 259 { // ERROR_NO_MORE_ITEMS return nil, ErrNotFound } + if errno != 0 { return nil, errno } + var cbRequired uint32 errno = setupDiCall( setupDiGetDeviceInterfaceDetailW, @@ -180,9 +185,11 @@ func systemGet(idx int) (*battery, error) { uintptr(unsafe.Pointer(&cbRequired)), 0, ) + if errno != 0 && errno != 122 { // ERROR_INSUFFICIENT_BUFFER return nil, errno } + // The god damn struct with ANYSIZE_ARRAY of utf16 in it is crazy. // So... let's emulate it with array of uint16 ;-D. // Keep in mind that the first two elements are actually cbSize. @@ -193,6 +200,7 @@ func systemGet(idx int) (*battery, error) { } else { *cbSize = 6 } + errno = setupDiCall( setupDiGetDeviceInterfaceDetailW, 6, @@ -203,9 +211,11 @@ func systemGet(idx int) (*battery, error) { uintptr(unsafe.Pointer(&cbRequired)), 0, ) + if errno != 0 { return nil, errno } + devicePath := &didd[2:][0] handle, err := windows.CreateFile( @@ -217,9 +227,11 @@ func systemGet(idx int) (*battery, error) { windows.FILE_ATTRIBUTE_NORMAL, 0, ) + if err != nil { return nil, err } + defer func() { _ = windows.CloseHandle(handle) }() @@ -238,9 +250,11 @@ func systemGet(idx int) (*battery, error) { &dwOut, nil, ) + if err != nil { return nil, err } + if bqi.BatteryTag == 0 { return nil, errors.New("BatteryTag not returned") } @@ -258,6 +272,7 @@ func systemGet(idx int) (*battery, error) { &dwOut, nil, ) + if err != nil { return nil, err } @@ -276,6 +291,7 @@ func systemGet(idx int) (*battery, error) { &dwOut, nil, ) + if err != nil { return nil, err } @@ -283,9 +299,11 @@ func systemGet(idx int) (*battery, error) { if b.Current, err = uint32ToFloat64(bs.Capacity); err != nil { return nil, err } + if b.Voltage, err = uint32ToFloat64(bs.Voltage); err != nil { return nil, err } + b.Voltage /= 1000 b.State = readState(bs.PowerState) From 519784c24061f751d6560a67595b97dea783adca Mon Sep 17 00:00:00 2001 From: ivan-the-terrible Date: Sat, 30 Mar 2024 02:55:31 +0000 Subject: [PATCH 057/157] fix: added missing segment types to enum --- themes/schema.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/themes/schema.json b/themes/schema.json index 1582a047..81034561 100644 --- a/themes/schema.json +++ b/themes/schema.json @@ -252,8 +252,12 @@ "az", "aws", "azfunc", + "argocd", "angular", "battery", + "bazel", + "brewfather", + "buf", "carbonintensity", "command", "connection", @@ -265,6 +269,8 @@ "docker", "dotnet", "dart", + "deno", + "elixir", "executiontime", "flutter", "fossil", @@ -283,6 +289,8 @@ "lastfm", "lua", "mercurial", + "nbgv", + "nightscout", "node", "npm", "nx", @@ -296,6 +304,7 @@ "plastic", "project", "pulumi", + "quasar", "root", "ruby", "rust", @@ -318,6 +327,7 @@ "umbraco", "unity", "upgrade", + "vala", "wakatime", "winreg", "withings", From 9aa8a385cb0ce2177f81e7e4a6594e846e5738d2 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Sat, 30 Mar 2024 14:51:52 +0000 Subject: [PATCH 058/157] docs: update website/docs/contributors.md [skip ci] --- website/docs/contributors.md | 1 + 1 file changed, 1 insertion(+) diff --git a/website/docs/contributors.md b/website/docs/contributors.md index bc8c93a7..d099d95d 100644 --- a/website/docs/contributors.md +++ b/website/docs/contributors.md @@ -332,6 +332,7 @@ Thanks goes to these wonderful people ([emoji key][acek]): Shravan Asati
Shravan Asati

🎨 Luca Zecca
Luca Zecca

💻 🎨 📖 Joshua Reilly
Joshua Reilly

💻 📖 + Ivan
Ivan

🎨 From 0b25d876410d2035fc1963171c7e47d991f36181 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Sat, 30 Mar 2024 14:51:53 +0000 Subject: [PATCH 059/157] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 82ae83f2..fe87e844 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2329,6 +2329,15 @@ "code", "doc" ] + }, + { + "login": "ivan-the-terrible", + "name": "Ivan", + "avatar_url": "https://avatars.githubusercontent.com/u/56458442?v=4", + "profile": "https://ivan-the-terrible.github.io/", + "contributions": [ + "design" + ] } ], "contributorsPerLine": 7, From 26d3425016cdfd2006d04dd04fa137f66659edb8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 2 Apr 2024 00:40:02 +0000 Subject: [PATCH 060/157] chore(deps): bump github.com/shirou/gopsutil/v3 in /src Bumps [github.com/shirou/gopsutil/v3](https://github.com/shirou/gopsutil) from 3.24.2 to 3.24.3. - [Release notes](https://github.com/shirou/gopsutil/releases) - [Commits](https://github.com/shirou/gopsutil/compare/v3.24.2...v3.24.3) --- updated-dependencies: - dependency-name: github.com/shirou/gopsutil/v3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/go.mod | 2 +- src/go.sum | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/go.mod b/src/go.mod index 4fc16ff5..94e11287 100644 --- a/src/go.mod +++ b/src/go.mod @@ -16,7 +16,7 @@ require ( github.com/huandu/xstrings v1.4.0 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect github.com/sergi/go-diff v1.3.1 // indirect - github.com/shirou/gopsutil/v3 v3.24.2 + github.com/shirou/gopsutil/v3 v3.24.3 github.com/stretchr/objx v0.5.2 // indirect github.com/stretchr/testify v1.9.0 github.com/wayneashleyberry/terminal-dimensions v1.1.0 diff --git a/src/go.sum b/src/go.sum index 3c1562d9..df324d16 100644 --- a/src/go.sum +++ b/src/go.sum @@ -148,8 +148,8 @@ github.com/sahilm/fuzzy v0.1.1 h1:ceu5RHF8DGgoi+/dR5PsECjCDH1BE3Fnmpo7aVXOdRA= github.com/sahilm/fuzzy v0.1.1/go.mod h1:VFvziUEIMCrT6A6tw2RFIXPXXmzXbOsSHF0DOI8ZK9Y= github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= -github.com/shirou/gopsutil/v3 v3.24.2 h1:kcR0erMbLg5/3LcInpw0X/rrPSqq4CDPyI6A6ZRC18Y= -github.com/shirou/gopsutil/v3 v3.24.2/go.mod h1:tSg/594BcA+8UdQU2XcW803GWYgdtauFFPgJCJKZlVk= +github.com/shirou/gopsutil/v3 v3.24.3 h1:eoUGJSmdfLzJ3mxIhmOAhgKEKgQkeOwKpz1NbhVnuPE= +github.com/shirou/gopsutil/v3 v3.24.3/go.mod h1:JpND7O217xa72ewWz9zN2eIIkPWsDN/3pl0H8Qt0uwg= github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM= github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ= github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU= @@ -231,7 +231,6 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= From 4e22e4987d7f01885e87e8512a77a70c75ef82f5 Mon Sep 17 00:00:00 2001 From: Ivan <56458442+ivan-the-terrible@users.noreply.github.com> Date: Tue, 2 Apr 2024 15:03:24 -0400 Subject: [PATCH 061/157] chore(schema): add missing properties --- themes/schema.json | 812 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 784 insertions(+), 28 deletions(-) diff --git a/themes/schema.json b/themes/schema.json index 81034561..d79fe3b5 100644 --- a/themes/schema.json +++ b/themes/schema.json @@ -54,6 +54,12 @@ "description": "Milliseconds to use for http request timeouts", "default": 20 }, + "cache_version": { + "type": "boolean", + "title": "Cache Version", + "description": "Cache the executable's version or not", + "default": false + }, "cache_timeout": { "type": "integer", "title": "cache timeout", @@ -457,7 +463,19 @@ }, "then": { "title": "Project Segment", - "description": "https://ohmyposh.dev/docs/segments/project" + "description": "https://ohmyposh.dev/docs/segments/project", + "properties": { + "properties": { + "properties": { + "always_enabled": { + "type": "boolean", + "title": "Always Enabled", + "description": "Always show the segment", + "default": false + } + } + } + } } }, { @@ -488,6 +506,21 @@ }, "version_url_template": { "$ref": "#/definitions/version_url_template" + }, + "cache_version": { + "$ref": "#/definitions/cache_version" + }, + "extensions": { + "type": "array", + "title": "Extensions", + "description": "The extensions to look for when determining if a folder is an NPM workspace", + "default": [ + "package.json", + "package-lock.json" + ], + "items": { + "type": "string" + } } } } @@ -652,11 +685,90 @@ "version_url_template": { "$ref": "#/definitions/version_url_template" }, + "cache_version": { + "$ref": "#/definitions/cache_version" + }, "icon": { "type": "string", "title": "Icon", "description": "The icon representing Bazel's logo", "default": "\ue63a" + }, + "extensions":{ + "type": "array", + "title": "Extensions", + "description": "The extensions to look for when determining if a folder is a Bazel workspace", + "default": [ + "*.bazel", + "*.bzl", + "BUILD", + "WORKSPACE", + ".bazelrc", + ".bazelversion" + ], + "items": { + "type": "string" + } + }, + "folders": { + "type": "array", + "title": "Folders", + "description": "The folders to look for when determining if a folder is a Bazel workspace", + "default": [ + "bazel-bin", + "bazel-out", + "bazel-testlogs" + ], + "items": { + "type": "string" + } + } + } + } + } + } + }, + { + "if": { + "properties": { + "type": { + "const": "buf" + } + } + }, + "then": { + "title": "Buf Segment", + "description": "https://ohmyposh.dev/docs/segments/buf", + "properties": { + "properties": { + "properties": { + "home_enabled": { + "$ref": "#/definitions/home_enabled" + }, + "fetch_version": { + "$ref": "#/definitions/fetch_version" + }, + "display_mode": { + "$ref": "#/definitions/display_mode" + }, + "version_url_template": { + "$ref": "#/definitions/version_url_template" + }, + "cache_version": { + "$ref": "#/definitions/cache_version" + }, + "extensions": { + "type": "array", + "title": "Extensions", + "description": "The extensions to look for when determining if a folder is a Buf workspace", + "default": [ + "buf.yaml", + "buf.gen.yaml", + "buf.work.yaml" + ], + "items": { + "type": "string" + } } } } @@ -802,6 +914,22 @@ }, "version_url_template": { "$ref": "#/definitions/version_url_template" + }, + "cache_version": { + "$ref": "#/definitions/cache_version" + }, + "extensions": { + "type": "array", + "title": "Extensions", + "description": "The extensions to look for when determining if a folder is a CMake workspace", + "default": [ + "*.cmake", + "CMakeLists.txt" + ], + "items": { + "type": "string" + } + } } } @@ -849,6 +977,30 @@ }, "version_url_template": { "$ref": "#/definitions/version_url_template" + }, + "cache_version": { + "$ref": "#/definitions/cache_version" + }, + "extensions": { + "type": "array", + "title": "Extensions", + "description": "The extensions to look for when determining if a folder is a .NET workspace", + "default": [ + "*.cs", + "*.csx", + "*.vb", + "*.fs", + "*.fsx", + "*.sln", + "*.slnf", + "*.csproj", + "*.fsproj", + "*.vbproj", + "global.json" + ], + "items": { + "type": "string" + } } } } @@ -874,6 +1026,12 @@ "title": "Always Enabled", "description": "Always show the status", "default": false + }, + "status_separator": { + "type": "string", + "title": "Status Separator", + "description": "The separator to use between the status segments", + "default": "|" } } } @@ -905,6 +1063,37 @@ }, "missing_command_text": { "$ref": "#/definitions/missing_command_text" + }, + "version_url_template": { + "$ref": "#/definitions/version_url_template" + }, + "cache_version": { + "$ref": "#/definitions/cache_version" + }, + "extensions": { + "type": "array", + "title": "Extensions", + "description": "The extensions to look for when determining if a folder is a Flutter workspace", + "default": [ + "*.dart", + "pubspec.yaml", + "pubspec.yml", + "pubspec.lock" + ], + "items": { + "type": "string" + } + }, + "folders": { + "type": "array", + "title": "Folders", + "description": "The folders to look for when determining if a folder is a Flutter workspace", + "default": [ + ".dart_tool" + ], + "items": { + "type": "string" + } } } } @@ -921,7 +1110,19 @@ }, "then": { "title": "Fossil Segment", - "description": "https://ohmyposh.dev/docs/segments/fossil" + "description": "https://ohmyposh.dev/docs/segments/fossil", + "properties": { + "properties": { + "properties": { + "native_fallback": { + "type": "boolean", + "title": "Native Fallback", + "description": "Use the native fossil command when the fossil executable is not found", + "default": false + } + } + } + } } }, { @@ -1146,11 +1347,26 @@ "version_url_template": { "$ref": "#/definitions/version_url_template" }, + "cache_version": { + "$ref": "#/definitions/cache_version" + }, "parse_mod_file": { "type": "boolean", "title": "Parse go.mod file", "description": "Parse go.mod file instead of calling out to go to improve performance.", "default": false + }, + "extensions": { + "type": "array", + "title": "Extensions", + "description": "The extensions to look for when determining if a folder is a Go workspace", + "default": [ + "*.go", + "go.mod" + ], + "items": { + "type": "string" + } } } } @@ -1185,6 +1401,34 @@ }, "version_url_template": { "$ref": "#/definitions/version_url_template" + }, + "cache_version": { + "$ref": "#/definitions/cache_version" + }, + "extensions": { + "type": "array", + "title": "Extensions", + "description": "The extensions to look for when determining if a folder is a Dart workspace", + "default": [ + "*.dart", + "pubspec.yaml", + "pubspec.yml", + "pubspec.lock" + ], + "items": { + "type": "string" + } + }, + "folders": { + "type": "array", + "title": "Folders", + "description": "The folders to look for when determining if a folder is a Dart workspace", + "default": [ + ".dart_tool" + ], + "items": { + "type": "string" + } } } } @@ -1216,6 +1460,22 @@ }, "version_url_template": { "$ref": "#/definitions/version_url_template" + }, + "cache_version": { + "$ref": "#/definitions/cache_version" + }, + "extensions": { + "type": "array", + "title": "Extensions", + "description": "The extensions to look for when determining if a folder is a Deno workspace", + "default": [ + "*.js", + "*.ts", + "deno.json" + ], + "items": { + "type": "string" + } } } } @@ -1250,6 +1510,21 @@ }, "version_url_template": { "$ref": "#/definitions/version_url_template" + }, + "cache_version": { + "$ref": "#/definitions/cache_version" + }, + "extensions": { + "type": "array", + "title": "Extensions", + "description": "The extensions to look for when determining if a folder is a Crystal workspace", + "default": [ + "*.cr", + "shard.yml" + ], + "items": { + "type": "string" + } } } } @@ -1284,6 +1559,20 @@ }, "version_url_template": { "$ref": "#/definitions/version_url_template" + }, + "cache_version": { + "$ref": "#/definitions/cache_version" + }, + "extensions": { + "type": "array", + "title": "Extensions", + "description": "The extensions to look for when determining if a folder is a Julia workspace", + "default": [ + "*.jl" + ], + "items": { + "type": "string" + } } } } @@ -1315,6 +1604,23 @@ }, "missing_command_text": { "$ref": "#/definitions/missing_command_text" + }, + "cache_version": { + "$ref": "#/definitions/cache_version" + }, + "extensions": { + "type": "array", + "title": "Extensions", + "description": "The extensions to look for when determining if a folder is a Perl workspace", + "default": [ + ".perl-version", + "*.pl", + "*.pm", + "*.t" + ], + "items": { + "type": "string" + } } } } @@ -1349,6 +1655,23 @@ }, "version_url_template": { "$ref": "#/definitions/version_url_template" + }, + "cache_version": { + "$ref": "#/definitions/cache_version" + }, + "extensions": { + "type": "array", + "title": "Extensions", + "description": "The extensions to look for when determining if a folder is a PHP workspace", + "default": [ + "*.php", + "composer.json", + "composer.lock", + ".php-version" + ], + "items": { + "type": "string" + } } } } @@ -1380,6 +1703,29 @@ }, "missing_command_text": { "$ref": "#/definitions/missing_command_text" + }, + "cache_version": { + "$ref": "#/definitions/cache_version" + }, + "extensions": { + "type": "array", + "title": "Extensions", + "description": "The extensions to look for when determining if a folder is a Java workspace", + "default": [ + "pom.xml", + "build.gradle.kts", + "build.sbt", + ".java-version", + ".deps.edn", + "project.clj", + "build.boot", + "*.java", + "*.class", + "*.gradle", + "*.jar", + "*.clj", + "*.cljc" + ] } } } @@ -1411,6 +1757,19 @@ }, "missing_command_text": { "$ref": "#/definitions/missing_command_text" + }, + "cache_version": { + "$ref": "#/definitions/cache_version" + }, + "extensions": { + "type": "array", + "title": "Extensions", + "description": "The extensions to look for when determining if a folder is a Ruby workspace", + "default": [ + "*.rb", + "Rakefile", + "Gemfile" + ] } } } @@ -1442,6 +1801,19 @@ }, "missing_command_text": { "$ref": "#/definitions/missing_command_text" + }, + "cache_version": { + "$ref": "#/definitions/cache_version" + }, + "extensions": { + "type": "array", + "title": "Extensions", + "description": "The extensions to look for when determining if a folder is a Rust workspace", + "default": [ + "*.rs", + "Cargo.toml", + "Cargo.lock" + ] } } } @@ -1473,6 +1845,20 @@ }, "missing_command_text": { "$ref": "#/definitions/missing_command_text" + }, + "cache_version": { + "$ref": "#/definitions/cache_version" + }, + "extensions": { + "type": "array", + "title": "Extensions", + "description": "The extensions to look for when determining if a folder is a XMake workspace", + "default": [ + "xmake.lua" + ], + "items": { + "type": "string" + } } } } @@ -1570,6 +1956,9 @@ "version_url_template": { "$ref": "#/definitions/version_url_template" }, + "cache_version": { + "$ref": "#/definitions/cache_version" + }, "fetch_package_manager": { "type": "boolean", "title": "Fetch Display Package Manager", @@ -1587,6 +1976,23 @@ "title": "NPM Icon", "description": "Icon/text to use for NPM", "default": " \uE71E" + }, + "extensions": { + "type": "array", + "title": "Extensions", + "description": "The extensions to look for when determining if a folder is a Node workspace", + "default": [ + "*.js", + "*.ts", + "package.json", + ".nvmrc", + "pnpm-workspace.yaml", + ".pnpmfile.cjs", + ".vue" + ], + "items": { + "type": "string" + } } } } @@ -1916,6 +2322,12 @@ "title": "The format to use on the start and end folder", "description": "Golang string format to apply to the start and end folder", "pattern": ".*%s.*" + }, + "gitdir_format": { + "type": "string", + "title": "The format to use on a git root directory", + "description": "Golang string format to apply to the .git folder", + "default": "" } } } @@ -1962,6 +2374,38 @@ }, "version_url_template": { "$ref": "#/definitions/version_url_template" + }, + "cache_version": { + "$ref": "#/definitions/cache_version" + }, + "extensions": { + "type": "array", + "title": "Extensions", + "description": "The extensions to look for when determining if a folder is a Python workspace", + "default": [ + "*.py", + "*.ipynb", + "pyproject.toml", + "venv.bak" + ], + "items": { + "type": "string" + } + }, + "folders": { + "type": "array", + "title": "Folders", + "description": "The folders to look for when determining if a folder is a Python workspace", + "default": [ + ".venv", + "venv", + "virtualenv", + "venv-win", + "pyenv-win" + ], + "items": { + "type": "string" + } } } } @@ -1978,7 +2422,25 @@ }, "then": { "title": "Pulumi Segment", - "description": "https://ohmyposh.dev/docs/segments/pulumi" + "description": "https://ohmyposh.dev/docs/segments/pulumi", + "properties": { + "properties": { + "properties": { + "fetch_stack": { + "type": "boolean", + "title": "Fetch Stack", + "description": "Fetch the current pulumi stack or not", + "default": false + }, + "fetch_about": { + "type": "boolean", + "title": "Fetch About", + "description": "Fetch the URL and user for the current stack", + "default": false + } + } + } + } } }, { @@ -2012,6 +2474,9 @@ "title": "Fetch Dependencies", "description": "Fetch the vite and @quasar/app-vite dependency information or not", "default": true + }, + "cache_version": { + "$ref": "#/definitions/cache_version" } } } @@ -2150,27 +2615,21 @@ "properties": { "playing_icon": { "type": "string", - "title": "User Info Separator", + "title": "Playing Icon", "description": "Text/icon to show when playing", "default": "\uE602" }, "paused_icon": { "type": "string", - "title": "SSH Icon", + "title": "Paused Icon", "description": "Text/icon to show when paused", "default": "\uF8E3" }, "stopped_icon": { "type": "string", - "title": "SSH Icon", + "title": "Stopped Icon", "description": "Text/icon to show when stopped", "default": "\uF04D" - }, - "track_separator": { - "type": "string", - "title": "SSH Icon", - "description": "Text/icon to put between the artist and song name", - "default": " - " } } } @@ -2187,7 +2646,19 @@ }, "then": { "title": "Terraform Segment", - "description": "https://ohmyposh.dev/docs/segments/terraform" + "description": "https://ohmyposh.dev/docs/segments/terraform", + "properties": { + "properties": { + "properties": { + "fetch_version": { + "type": "boolean", + "title": "Fetch Version", + "description": "Fetch the version number", + "default": false + } + } + } + } } }, { @@ -2256,28 +2727,22 @@ "properties": { "playing_icon": { "type": "string", - "title": "User Info Separator", + "title": "Playing Icon", "description": "Text/icon to show when playing", "default": "\uE602" }, "paused_icon": { "type": "string", - "title": "SSH Icon", + "title": "Paused Icon", "description": "Text/icon to show when paused", "default": "\uF8E3" }, "stopped_icon": { "type": "string", - "title": "SSH Icon", + "title": "Stopped Icon", "description": "Text/icon to show when stopped", "default": "\uF04D" }, - "track_separator": { - "type": "string", - "title": "SSH Icon", - "description": "Text/icon to put between the artist and song name", - "default": " - " - }, "api_url": { "type": "string", "title": "API URL", @@ -2365,6 +2830,24 @@ }, "missing_command_text": { "$ref": "#/definitions/missing_command_text" + }, + "version_url_template": { + "$ref": "#/definitions/version_url_template" + }, + "cache_version": { + "$ref": "#/definitions/cache_version" + }, + "extensions": { + "type": "array", + "title": "Extensions", + "description": "The extensions to look for when determining if a folder is a Elixir workspace", + "default": [ + "*.ex", + "*.exs" + ], + "items": { + "type": "string" + } } } } @@ -2437,7 +2920,7 @@ "type": "integer", "title": "Precision", "description": "number of decimal places to show", - "default": 0 + "default": 2 } } } @@ -2567,6 +3050,21 @@ }, "version_url_template": { "$ref": "#/definitions/version_url_template" + }, + "cache_version": { + "$ref": "#/definitions/cache_version" + }, + "extensions": { + "type": "array", + "title": "Extensions", + "description": "The extensions to look for when determining if the current directory is an Angular project", + "default": + [ + "angular.json" + ], + "items": { + "type": "string" + } } } } @@ -2598,6 +3096,21 @@ }, "version_url_template": { "$ref": "#/definitions/version_url_template" + }, + "cache_version": { + "$ref": "#/definitions/cache_version" + }, + "extensions": { + "type": "array", + "title": "Extensions", + "description": "The extensions to look for when determining if the current directory is a React project", + "default": + [ + "package.json" + ], + "items": { + "type": "string" + } } } } @@ -2629,6 +3142,22 @@ }, "version_url_template": { "$ref": "#/definitions/version_url_template" + }, + "cache_version": { + "$ref": "#/definitions/cache_version" + }, + "extensions": { + "type": "array", + "title": "Extensions", + "description": "The extensions to look for when determining if the current directory is an Nx project", + "default": + [ + "workspace.json", + "nx.json" + ], + "items": { + "type": "string" + } } } } @@ -2660,6 +3189,25 @@ }, "missing_command_text": { "$ref": "#/definitions/missing_command_text" + }, + "cache_version": { + "$ref": "#/definitions/cache_version" + }, + "extensions": { + "type": "array", + "title": "Extensions", + "description": "The extensions to look for when determining if the current directory is an OCaml project", + "default": + [ + "*.ml", + "*.mli", + "dune", + "dune-project", + "dune-workspace" + ], + "items": { + "type": "string" + } } } } @@ -2782,6 +3330,9 @@ "description": "Display the local changes or not", "default": false }, + "status_formats": { + "$ref": "#/definitions/status_formats" + }, "branch_icon": { "type": "string", "title": "Branch Icon", @@ -2800,6 +3351,12 @@ "description": "Icon/text to display before the seletor label", "default": "\uF412" }, + "truncate_symbol": { + "type": "string", + "title": "Truncate Symbol", + "description": "Icon/text to use to indicate that the branch name has been truncated", + "default": "" + }, "branch_max_length": { "type": "integer", "title": "Branch max length", @@ -2811,9 +3368,6 @@ "title": "Full branch path", "description": "display the full branch path instead of only the branch name", "default": false - }, - "status_formats": { - "$ref": "#/definitions/status_formats" } } } @@ -2862,7 +3416,10 @@ "$ref": "#/definitions/http_timeout" }, "cache_timeout": { - "$ref": "#/definitions/cache_timeout" + "type": "integer", + "title": "cache timeout", + "description": "Minutes the response is cached. A value of 0 disables the cache.", + "default": 5 }, "doubleup_icon": { "type": "string", @@ -3007,6 +3564,9 @@ "version_url_template": { "$ref": "#/definitions/version_url_template" }, + "cache_version": { + "$ref": "#/definitions/cache_version" + }, "stack_ghc_mode": { "type": "string", "title": "Use Stack GHC", @@ -3017,6 +3577,22 @@ "never" ], "default": "never" + }, + "extensions": { + "type": "array", + "title": "Extensions", + "description": "The extensions to look for when determining if the current directory is a Haskell project", + "default": [ + "*.hs", + "*.lhs", + "stack.yaml", + "package.yaml", + "*.cabal", + "cabal.project" + ], + "items": { + "type": "string" + } } } } @@ -3073,6 +3649,20 @@ }, "version_url_template": { "$ref": "#/definitions/version_url_template" + }, + "cache_version": { + "$ref": "#/definitions/cache_version" + }, + "extensions": { + "type": "array", + "title": "Extensions", + "description": "The extensions to look for when determining if the current directory is a UI5 project", + "default": [ + "*ui5*.y*ml" + ], + "items": { + "type": "string" + } } } } @@ -3148,6 +3738,20 @@ }, "missing_command_text": { "$ref": "#/definitions/missing_command_text" + }, + "cache_version": { + "$ref": "#/definitions/cache_version" + }, + "extensions": { + "type": "array", + "title": "Extensions", + "description": "The extensions to look for when determining if the current directory is a Vala project", + "default": [ + "*.vala" + ], + "items": { + "type": "string" + } } } } @@ -3182,6 +3786,22 @@ }, "version_url_template": { "$ref": "#/definitions/version_url_template" + }, + "cache_version": { + "$ref": "#/definitions/cache_version" + }, + "extensions": { + "type": "array", + "title": "Extensions", + "description": "The extensions to look for when determining if the current directory is a Cloud Foundry project", + "default": + [ + "manifest.yml", + "mta.yaml" + ], + "items": { + "type": "string" + } } } } @@ -3238,6 +3858,23 @@ }, "version_url_template": { "$ref": "#/definitions/version_url_template" + }, + "cache_version": { + "$ref": "#/definitions/cache_version" + }, + "extensions": { + "type": "array", + "title": "Extensions", + "description": "The extensions to look for when determining if the current directory is a Kotlin project", + "default": + [ + "*.kt", + "*.kts", + "*.ktm" + ], + "items": { + "type": "string" + } } } } @@ -3322,6 +3959,9 @@ "version_url_template": { "$ref": "#/definitions/version_url_template" }, + "cache_version": { + "$ref": "#/definitions/cache_version" + }, "preferred_executable": { "type": "string", "title": "Preferred Executable", @@ -3331,6 +3971,19 @@ "luajit" ], "default": "lua" + }, + "extensions": { + "type": "array", + "title": "Extensions", + "description": "The extensions to look for when determining if the current directory is a Lua project", + "default": + [ + "*.lua", + "*.rockspec" + ], + "items": { + "type": "string" + } } } } @@ -3365,6 +4018,21 @@ }, "version_url_template": { "$ref": "#/definitions/version_url_template" + }, + "cache_version": { + "$ref": "#/definitions/cache_version" + }, + "extensions": { + "type": "array", + "title": "Extensions", + "description": "The extensions to look for when determining if the current directory is a Swift project", + "default": [ + "*.swift", + "*.SWIFT" + ], + "items": { + "type": "string" + } } } } @@ -3396,6 +4064,24 @@ }, "missing_command_text": { "$ref": "#/definitions/missing_command_text" + }, + "cache_version": { + "$ref": "#/definitions/cache_version" + }, + "extensions": { + "type": "array", + "title": "Extensions", + "description": "The extensions to look for when determining if the current directory is a CDS project", + "default": + [ + ".cdsrc.json", + ".cdsrc-private.json", + "*.cds" + ], + "items": { + "type": "string" + } + } } } @@ -3430,6 +4116,27 @@ }, "version_url_template": { "$ref": "#/definitions/version_url_template" + }, + "cache_version": { + "$ref": "#/definitions/cache_version" + }, + "extensions": { + "type": "array", + "title": "Extensions", + "description": "The extensions to look for when determining if the current directory is an R project", + "default": + [ + "*.R", + "*.Rmd", + "*.Rsx", + "*.Rda", + "*.Rd", + "*.Rproj", + ".Rproj.user" + ], + "items": { + "type": "string" + } } } } @@ -3459,7 +4166,19 @@ }, "then": { "title": "Display GitVersion segment", - "description": "https://ohmyposh.dev/docs/segments/gitversion" + "description": "https://ohmyposh.dev/docs/segments/gitversion", + "properties": { + "properties": { + "properties": { + "cache_timeout": { + "type": "integer", + "title": "cache timeout", + "description": "Minutes the response is cached. A value of 0 disables the cache.", + "default": 30 + } + } + } + } } }, { @@ -3490,6 +4209,43 @@ } } }, + { + "if": { + "properties": { + "type": { + "const": "nightscout" + } + } + }, + "then": { + "title": "Display Nightscout segment", + "description": "https://ohmyposh.dev/docs/segments/nightscout", + "properties": { + "properties": { + "properties": { + "url": { + "type": "string", + "title": "URL", + "description": "The URL to the Nightscout API", + "default": "https://your.nightscout.url/api/v1/entries.json" + }, + "cache_timeout": { + "type": "integer", + "title": "cache timeout", + "description": "Minutes the response is cached. A value of 0 disables the cache.", + "default": 5 + }, + "http_timeout": { + "type": "integer", + "title": "Http request timeout", + "description": "Milliseconds to use for http request timeouts", + "default": 500 + } + } + } + } + } + }, { "if": { "properties": { From c4e11fe48d8ceff1947d7e9d61c979eb1afc5a61 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Wed, 3 Apr 2024 16:16:02 +0200 Subject: [PATCH 062/157] feat(path): allow left and right formatting --- src/segments/path.go | 13 ++++++++++--- website/docs/segments/path.mdx | 2 ++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/segments/path.go b/src/segments/path.go index 9a626254..c3d0a674 100644 --- a/src/segments/path.go +++ b/src/segments/path.go @@ -82,6 +82,10 @@ const ( FolderFormat properties.Property = "folder_format" // format to use on the first and last folder of the path EdgeFormat properties.Property = "edge_format" + // format to use on first folder of the path + LeftFormat properties.Property = "left_format" + // format to use on the last folder of the path + RightFormat properties.Property = "right_format" // GitDirFormat format to use on the git directory GitDirFormat properties.Property = "gitdir_format" ) @@ -622,7 +626,10 @@ func (pt *Path) colorizePath(root string, elements []string) string { folderSeparator := pt.getFolderSeparator() colorSeparator := pt.props.GetBool(CycleFolderSeparator, false) folderFormat := pt.props.GetString(FolderFormat, "%s") + edgeFormat := pt.props.GetString(EdgeFormat, folderFormat) + leftFormat := pt.props.GetString(LeftFormat, edgeFormat) + rightFormat := pt.props.GetString(RightFormat, edgeFormat) colorizeElement := func(element string) string { if skipColorize || len(element) == 0 { @@ -635,7 +642,7 @@ func (pt *Path) colorizePath(root string, elements []string) string { } if len(elements) == 0 { - root := fmt.Sprintf(edgeFormat, root) + root := fmt.Sprintf(leftFormat, root) return colorizeElement(root) } @@ -648,7 +655,7 @@ func (pt *Path) colorizePath(root string, elements []string) string { var builder strings.Builder - root = fmt.Sprintf(edgeFormat, root) + root = fmt.Sprintf(leftFormat, root) builder.WriteString(colorizeElement(root)) if root != pt.env.PathSeparator() && len(root) != 0 { @@ -662,7 +669,7 @@ func (pt *Path) colorizePath(root string, elements []string) string { format := folderFormat if i == len(elements)-1 { - format = edgeFormat + format = rightFormat } element = fmt.Sprintf(format, element) diff --git a/website/docs/segments/path.mdx b/website/docs/segments/path.mdx index 648e7e37..957a83e4 100644 --- a/website/docs/segments/path.mdx +++ b/website/docs/segments/path.mdx @@ -46,6 +46,8 @@ import Config from "@site/src/components/Config.js"; | `cycle_folder_separator` | `boolean` | colorize the `folder_separator_icon` as well when using a cycle - defaults to `false` | | `folder_format` | `string` | format to use on individual path folders - defaults to `%s` | | `edge_format` | `string` | format to use on the first and last folder of the path - defaults to `%s` | +| `left_format` | `string` | format to use on the firstfolder of the path - defaults to `edge_format` | +| `right_format` | `string` | format to use on the last folder of the path - defaults to `edge_format` | | `gitdir_format` | `string` | format to use for a git root directory - defaults to `` | ## Mapped Locations From 7c149f2bdbac31a0c6e3c4b0298a6fed760cc269 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 5 Apr 2024 01:03:43 +0000 Subject: [PATCH 063/157] chore(deps): bump golang.org/x/sys from 0.18.0 to 0.19.0 in /src Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.18.0 to 0.19.0. - [Commits](https://github.com/golang/sys/compare/v0.18.0...v0.19.0) --- updated-dependencies: - dependency-name: golang.org/x/sys dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- src/go.mod | 2 +- src/go.sum | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/go.mod b/src/go.mod index 94e11287..e9b91a3a 100644 --- a/src/go.mod +++ b/src/go.mod @@ -22,7 +22,7 @@ require ( github.com/wayneashleyberry/terminal-dimensions v1.1.0 golang.org/x/crypto v0.21.0 // indirect golang.org/x/image v0.15.0 - golang.org/x/sys v0.18.0 + golang.org/x/sys v0.19.0 golang.org/x/text v0.14.0 gopkg.in/ini.v1 v1.67.0 ) diff --git a/src/go.sum b/src/go.sum index df324d16..15a59e4c 100644 --- a/src/go.sum +++ b/src/go.sum @@ -231,8 +231,9 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= +golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= From 7a6ecba7c756a449d191f04941b8802e51730f40 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 5 Apr 2024 01:03:39 +0000 Subject: [PATCH 064/157] chore(deps): bump golang.org/x/mod from 0.16.0 to 0.17.0 in /src Bumps [golang.org/x/mod](https://github.com/golang/mod) from 0.16.0 to 0.17.0. - [Commits](https://github.com/golang/mod/compare/v0.16.0...v0.17.0) --- updated-dependencies: - dependency-name: golang.org/x/mod dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- src/go.mod | 2 +- src/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/go.mod b/src/go.mod index e9b91a3a..ec914610 100644 --- a/src/go.mod +++ b/src/go.mod @@ -41,7 +41,7 @@ require ( github.com/spf13/cobra v1.8.0 github.com/spf13/pflag v1.0.5 golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 - golang.org/x/mod v0.16.0 + golang.org/x/mod v0.17.0 gopkg.in/yaml.v3 v3.0.1 ) diff --git a/src/go.sum b/src/go.sum index 15a59e4c..f08687e9 100644 --- a/src/go.sum +++ b/src/go.sum @@ -207,8 +207,8 @@ golang.org/x/exp v0.0.0-20240222234643-814bf88cf225/go.mod h1:CxmFvTBINI24O/j8iY golang.org/x/image v0.15.0 h1:kOELfmgrmJlw4Cdb7g/QGuB3CvDrXbqEIww/pNtNBm8= golang.org/x/image v0.15.0/go.mod h1:HUYqC05R2ZcZ3ejNQsIHQDQiwWM4JBqmm6MKANTp4LE= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.16.0 h1:QX4fJ0Rr5cPQCF7O9lh9Se4pmwfwskqZfq5moyldzic= -golang.org/x/mod v0.16.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= From 95f7a3feae5502df5f8986d31b2dc4c4ef1d79c4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 11 Apr 2024 01:02:48 +0000 Subject: [PATCH 065/157] chore(deps): bump sigstore/cosign-installer from 3.4.0 to 3.5.0 Bumps [sigstore/cosign-installer](https://github.com/sigstore/cosign-installer) from 3.4.0 to 3.5.0. - [Release notes](https://github.com/sigstore/cosign-installer/releases) - [Commits](https://github.com/sigstore/cosign-installer/compare/e1523de7571e31dbe865fd2e80c5c7c23ae71eb4...59acb6260d9c0ba8f4a2f9d9b48431a222b68e20) --- updated-dependencies: - dependency-name: sigstore/cosign-installer dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ef081132..84556656 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -50,7 +50,7 @@ jobs: git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" git tag ${{ needs.changelog.outputs.tag }} - name: Install cosign 🔑 - uses: sigstore/cosign-installer@e1523de7571e31dbe865fd2e80c5c7c23ae71eb4 + uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 with: cosign-release: 'v1.4.0' - name: Private Key 🔐 From 2335e61de42d9947ac290f2e0a2def5059922186 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Apr 2024 00:58:10 +0000 Subject: [PATCH 066/157] chore(deps): bump github.com/pelletier/go-toml/v2 in /src Bumps [github.com/pelletier/go-toml/v2](https://github.com/pelletier/go-toml) from 2.2.0 to 2.2.1. - [Release notes](https://github.com/pelletier/go-toml/releases) - [Changelog](https://github.com/pelletier/go-toml/blob/v2/.goreleaser.yaml) - [Commits](https://github.com/pelletier/go-toml/compare/v2.2.0...v2.2.1) --- updated-dependencies: - dependency-name: github.com/pelletier/go-toml/v2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/go.mod | 2 +- src/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/go.mod b/src/go.mod index ec914610..7c2b5f71 100644 --- a/src/go.mod +++ b/src/go.mod @@ -37,7 +37,7 @@ require ( github.com/gookit/goutil v0.6.15 github.com/hashicorp/hcl/v2 v2.20.1 github.com/mattn/go-runewidth v0.0.15 - github.com/pelletier/go-toml/v2 v2.2.0 + github.com/pelletier/go-toml/v2 v2.2.1 github.com/spf13/cobra v1.8.0 github.com/spf13/pflag v1.0.5 golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 diff --git a/src/go.sum b/src/go.sum index f08687e9..8dfa993d 100644 --- a/src/go.sum +++ b/src/go.sum @@ -130,8 +130,8 @@ github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s= github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8= github.com/muesli/termenv v0.15.2 h1:GohcuySI0QmI3wN8Ok9PtKGkgkFIk7y6Vpb5PvrY+Wo= github.com/muesli/termenv v0.15.2/go.mod h1:Epx+iuz8sNs7mNKhxzH4fWXGNpZwUaJKRS1noLXviQ8= -github.com/pelletier/go-toml/v2 v2.2.0 h1:QLgLl2yMN7N+ruc31VynXs1vhMZa7CeHHejIeBAsoHo= -github.com/pelletier/go-toml/v2 v2.2.0/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pelletier/go-toml/v2 v2.2.1 h1:9TA9+T8+8CUCO2+WYnDLCgrYi9+omqKXyjDtosvtEhg= +github.com/pelletier/go-toml/v2 v2.2.1/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= From 0f58cf82260596805d2125a18f04d75c94bfebdc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 17 Apr 2024 00:51:29 +0000 Subject: [PATCH 067/157] chore(deps): bump azure/login from 2.0.0 to 2.1.0 Bumps [azure/login](https://github.com/azure/login) from 2.0.0 to 2.1.0. - [Release notes](https://github.com/azure/login/releases) - [Commits](https://github.com/azure/login/compare/8c334a195cbb38e46038007b304988d888bf676a...6b2456866fc08b011acb422a92a4aa20e2c4de32) --- updated-dependencies: - dependency-name: azure/login dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index ee0130eb..a03ed388 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -44,7 +44,7 @@ jobs: - name: Set default Kubernetes namespace run: | kubectl config set-context posh --namespace demo - - uses: azure/login@8c334a195cbb38e46038007b304988d888bf676a + - uses: azure/login@6b2456866fc08b011acb422a92a4aa20e2c4de32 with: creds: ${{ secrets.AZURE_CREDENTIALS }} - name: Build oh-my-posh 🔧 From e75554b24bc76d210b855f895d9d44e56314eaf7 Mon Sep 17 00:00:00 2001 From: mountcount Date: Tue, 9 Apr 2024 12:27:15 +0800 Subject: [PATCH 068/157] chore: fix some comments Signed-off-by: mountcount --- website/docs/configuration/templates.mdx | 2 +- website/docs/contributing/plastic.mdx | 2 +- website/docs/segments/plastic.mdx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/website/docs/configuration/templates.mdx b/website/docs/configuration/templates.mdx index d4f6859d..c6e037ae 100644 --- a/website/docs/configuration/templates.mdx +++ b/website/docs/configuration/templates.mdx @@ -140,7 +140,7 @@ end | `{{.Var}}` | Variable in a struct, where Var is a variable. | | `{{- .Var -}}` | Remove extra white space surrounding the .Var variable and remove the newline. Either side is fine too. | | `{{ $planet := "Earth"}}` | `{{ $planet }}` Store a value in a custom variable to reference later. Note that .$ is used to reference the global/parent context, like in the full example below with $. | -| `Hi {{if .Name}} {{.Name}} {{else}} visitor {{end}}` | If-else statement. If will will evaluate whether or not the argument is empty. Using the elseif conditional is also an option. The not negation is available too. | +| `Hi {{if .Name}} {{.Name}} {{else}} visitor {{end}}` | If-else statement. If will evaluate whether or not the argument is empty. Using the elseif conditional is also an option. The not negation is available too. | | `{{if and .Arg1 .Arg2}} both complete. {{else}} incomplete. {{end}}` | The and function compares multiple arguments to return the boolean AND (if arg1 then arg2 else arg1). Both arguments are evaluated. The or function compares multiple arguments to return the boolean OR. Similar to if arg1 then arg1 else arg2, so arg2 will never be evaluated if arg1 is false (not empty). | | `{{with .Var}} {{end}}` | With statement, where Var is a variable. It skips the block if the variable is absent. | | `{{range .Array}} {{end}}` | Range statement, where Array is an array, slice, map, or channel. | diff --git a/website/docs/contributing/plastic.mdx b/website/docs/contributing/plastic.mdx index a884502d..61e321fc 100644 --- a/website/docs/contributing/plastic.mdx +++ b/website/docs/contributing/plastic.mdx @@ -152,7 +152,7 @@ cm status **Test hint:** Both `Private` and `Added` files should be counted towards the `Added` property of the `plastic` segment. -### Commiting changes +### Committing changes After locally adding, changing, moving or deleting files you want to commit them to create a new changeset. Run this command to commit all local changes: diff --git a/website/docs/segments/plastic.mdx b/website/docs/segments/plastic.mdx index d2e18da8..2c6e51b6 100644 --- a/website/docs/segments/plastic.mdx +++ b/website/docs/segments/plastic.mdx @@ -90,7 +90,7 @@ You can set the following property to `true` to enable fetching additional infor | `.Selector` | `string` | the current selector context (branch/changeset/label) | | `.Behind` | `bool` | the current workspace is behind and changes are incoming | | `.Status` | `Status` | changes in the workspace (see below) | -| `.MergePending` | `bool` | if a merge is pending and needs to be commited (known issue: when no file is left after a _Change/Delete conflict_ merge, the `MergePending` property is not set) | +| `.MergePending` | `bool` | if a merge is pending and needs to be committed (known issue: when no file is left after a _Change/Delete conflict_ merge, the `MergePending` property is not set) | ### Status From de98fd05e55c02b5f30cc9b4e7d38a459b5901f0 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 17 Apr 2024 07:37:21 +0000 Subject: [PATCH 069/157] docs: update website/docs/contributors.md [skip ci] --- website/docs/contributors.md | 1 + 1 file changed, 1 insertion(+) diff --git a/website/docs/contributors.md b/website/docs/contributors.md index d099d95d..097592e2 100644 --- a/website/docs/contributors.md +++ b/website/docs/contributors.md @@ -333,6 +333,7 @@ Thanks goes to these wonderful people ([emoji key][acek]): Luca Zecca
Luca Zecca

💻 🎨 📖 Joshua Reilly
Joshua Reilly

💻 📖 Ivan
Ivan

🎨 + mountcount
mountcount

📖 From 8e2d3caff55da32d9c36ca34b97be503dd0d4c0d Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 17 Apr 2024 07:37:22 +0000 Subject: [PATCH 070/157] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index fe87e844..bbdd4647 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2338,6 +2338,15 @@ "contributions": [ "design" ] + }, + { + "login": "mountcount", + "name": "mountcount", + "avatar_url": "https://avatars.githubusercontent.com/u/166301065?v=4", + "profile": "https://github.com/mountcount", + "contributions": [ + "doc" + ] } ], "contributorsPerLine": 7, From b7ec14535460b5bbcdce55bc5fbfe7de4e344d31 Mon Sep 17 00:00:00 2001 From: ivan-the-terrible Date: Thu, 4 Apr 2024 19:31:28 +0000 Subject: [PATCH 071/157] fix: added polling flag for hot reloading to work in dev container --- website/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/package.json b/website/package.json index 323f8129..049d8eff 100644 --- a/website/package.json +++ b/website/package.json @@ -3,7 +3,7 @@ "version": "0.0.0", "private": true, "scripts": { - "start": "cross-env NODE_ENV=development docusaurus start", + "start": "cross-env NODE_ENV=development docusaurus start --poll 1000", "build": "docusaurus build", "serve": "docusaurus serve", "themes": "node export_themes.js" From aaaa83f0a5b0e4d4c078b761fcec25cd98787cdc Mon Sep 17 00:00:00 2001 From: ivan-the-terrible Date: Thu, 4 Apr 2024 20:29:19 +0000 Subject: [PATCH 072/157] fix: correct property names --- website/docs/segments/strava.mdx | 24 ++++++++++++------------ website/docs/segments/terraform.mdx | 8 +++----- website/docs/segments/withings.mdx | 14 +++++++------- 3 files changed, 22 insertions(+), 24 deletions(-) diff --git a/website/docs/segments/strava.mdx b/website/docs/segments/strava.mdx index da2d2227..8d4097b5 100644 --- a/website/docs/segments/strava.mdx +++ b/website/docs/segments/strava.mdx @@ -58,18 +58,18 @@ import Config from '@site/src/components/Config.js'; ## Properties -| Name | Type | Description | -| --------------------- | -------- | --------------------------------------------------------------------------------------------------------------- | -| `access_token` | `string` | token from Strava login, see login link in section above. | -| `refresh_token` | `string` | token from Strava login, see login link in section above. | -| `expires_in` | `int` | the default timeout of the token from the Strava login | -| `http_timeout` | `int` | how long do you want to wait before you want to see your prompt more than your strava data? - defaults to 500ms | -| `CacheTimeout` | `int` | in minutes - How long do you want your Strava data cached? - defaults to 5 min | -| `RideIcon` | `string` | defaults to `\uf206` | -| `RunIcon` | `string` | defaults to `\ue213` | -| `SkiingIcon` | `string` | defaults to `\ue213` | -| `WorkOutIcon` | `string` | defaults to `\ue213` | -| `UnknownActivityIcon` | `string` | defaults to `\ue213` | +| Name | Type | Description | +| ----------------------- | -------- | --------------------------------------------------------------------------------------------------------------- | +| `access_token` | `string` | token from Strava login, see login link in section above. | +| `refresh_token` | `string` | token from Strava login, see login link in section above. | +| `expires_in` | `int` | the default timeout of the token from the Strava login | +| `http_timeout` | `int` | how long do you want to wait before you want to see your prompt more than your strava data? - defaults to 500ms | +| `cache_timeout` | `int` | in minutes - How long do you want your Strava data cached? - defaults to 5 min | +| `ride_icon` | `string` | defaults to `\uf206` | +| `run_icon` | `string` | defaults to `\ue213` | +| `skiing_icon` | `string` | defaults to `\ue213` | +| `workout_icon` | `string` | defaults to `\ue213` | +| `unknown_activity_icon` | `string` | defaults to `\ue213` | ## Template ([info][templates]) diff --git a/website/docs/segments/terraform.mdx b/website/docs/segments/terraform.mdx index 7db5da03..363097fd 100644 --- a/website/docs/segments/terraform.mdx +++ b/website/docs/segments/terraform.mdx @@ -27,11 +27,9 @@ import Config from '@site/src/components/Config.js'; ## Properties -| Name | Type | Description | -| --------------- | --------- | ---------------------------------------------------------------------------------- | -| `fetch_version` | `boolean` | fetch the version information from `versions.tf`, `main.tf` or `terraform.tfstate` | - -defaults to `false` +| Name | Type | Description | +| --------------- | --------- | -------------------------------------------------------------------------------------------------------- | +| `fetch_version` | `boolean` | fetch the version information from `versions.tf`, `main.tf` or `terraform.tfstate` - defaults to `false` | ## Template ([info][templates]) diff --git a/website/docs/segments/withings.mdx b/website/docs/segments/withings.mdx index 1735001e..23e78ace 100644 --- a/website/docs/segments/withings.mdx +++ b/website/docs/segments/withings.mdx @@ -44,13 +44,13 @@ import Config from '@site/src/components/Config.js'; ## Properties -| Name | Type | Description | -| --------------- | -------- | ----------------------------------------------------------------------------------------------------------------- | -| `access_token` | `string` | token from Withings login, see login link in section above. | -| `refresh_token` | `string` | token from Withings login, see login link in section above. | -| `expires_in` | `int` | the default timeout of the token from the Withings login | -| `http_timeout` | `int` | how long do you want to wait before you want to see your prompt more than your Withings data? - defaults to 500ms | -| `CacheTimeout` | `int` | in minutes - How long do you want your Withings data cached? - defaults to 5 min | +| Name | Type | Description | +| ---------------- | -------- | ----------------------------------------------------------------------------------------------------------------- | +| `access_token` | `string` | token from Withings login, see login link in section above. | +| `refresh_token` | `string` | token from Withings login, see login link in section above. | +| `expires_in` | `int` | the default timeout of the token from the Withings login | +| `http_timeout` | `int` | how long do you want to wait before you want to see your prompt more than your Withings data? - defaults to 500ms | +| `cache_timeout` | `int` | in minutes - How long do you want your Withings data cached? - defaults to 5 min | ## Template ([info][templates]) From 2b5a62386be161da5d5a335de9f1d259cefb7af3 Mon Sep 17 00:00:00 2001 From: ivan-the-terrible Date: Thu, 4 Apr 2024 21:20:48 +0000 Subject: [PATCH 073/157] docs: add default column to properties table --- themes/schema.json | 424 ++++++++++++++-------- website/docs/segments/angular.mdx | 19 +- website/docs/segments/aws.mdx | 6 +- website/docs/segments/az.mdx | 6 +- website/docs/segments/azfunc.mdx | 22 +- website/docs/segments/battery.mdx | 14 +- website/docs/segments/bazel.mdx | 22 +- website/docs/segments/brewfather.mdx | 16 +- website/docs/segments/buf.mdx | 19 +- website/docs/segments/carbonintensity.mdx | 8 +- website/docs/segments/cds.mdx | 22 +- website/docs/segments/cf.mdx | 20 +- website/docs/segments/cftarget.mdx | 6 +- website/docs/segments/cmake.mdx | 20 +- website/docs/segments/command.mdx | 10 +- website/docs/segments/connection.mdx | 6 +- website/docs/segments/crystal.mdx | 20 +- website/docs/segments/dart.mdx | 20 +- website/docs/segments/deno.mdx | 19 +- website/docs/segments/dotnet.mdx | 17 +- website/docs/segments/elixir.mdx | 20 +- website/docs/segments/executiontime.mdx | 10 +- website/docs/segments/flutter.mdx | 20 +- website/docs/segments/fossil.mdx | 6 +- website/docs/segments/git.mdx | 76 ++-- website/docs/segments/gitversion.mdx | 6 +- website/docs/segments/golang.mdx | 22 +- website/docs/segments/haskell.mdx | 22 +- website/docs/segments/helm.mdx | 6 +- website/docs/segments/ipify.mdx | 10 +- website/docs/segments/java.mdx | 22 +- website/docs/segments/julia.mdx | 20 +- website/docs/segments/kotlin.mdx | 22 +- website/docs/segments/kubectl.mdx | 10 +- website/docs/segments/lastfm.mdx | 14 +- website/docs/segments/lua.mdx | 22 +- website/docs/segments/mercurial.mdx | 8 +- website/docs/segments/nightscout.mdx | 10 +- website/docs/segments/node.mdx | 26 +- website/docs/segments/npm.mdx | 20 +- website/docs/segments/nx.mdx | 19 +- website/docs/segments/ocaml.mdx | 20 +- website/docs/segments/os.mdx | 56 +-- website/docs/segments/owm.mdx | 19 +- website/docs/segments/path.mdx | 46 +-- website/docs/segments/perl.mdx | 19 +- website/docs/segments/php.mdx | 20 +- website/docs/segments/plastic.mdx | 28 +- website/docs/segments/project.mdx | 6 +- website/docs/segments/pulumi.mdx | 2 +- website/docs/segments/python.mdx | 26 +- website/docs/segments/quasar.mdx | 21 +- website/docs/segments/r.mdx | 20 +- website/docs/segments/react.mdx | 19 +- website/docs/segments/ruby.mdx | 20 +- website/docs/segments/rust.mdx | 20 +- website/docs/segments/sapling.mdx | 10 +- website/docs/segments/shell.mdx | 4 +- website/docs/segments/sitecore.mdx | 6 +- website/docs/segments/spotify.mdx | 10 +- website/docs/segments/status.mdx | 10 +- website/docs/segments/strava.mdx | 24 +- website/docs/segments/svn.mdx | 10 +- website/docs/segments/swift.mdx | 20 +- website/docs/segments/sysinfo.mdx | 6 +- website/docs/segments/terraform.mdx | 6 +- website/docs/segments/time.mdx | 6 +- website/docs/segments/ui5tooling.mdx | 20 +- website/docs/segments/unity.mdx | 6 +- website/docs/segments/upgrade.mdx | 6 +- website/docs/segments/vala.mdx | 20 +- website/docs/segments/wakatime.mdx | 10 +- website/docs/segments/winreg.mdx | 8 +- website/docs/segments/withings.mdx | 14 +- website/docs/segments/xmake.mdx | 22 +- website/docs/segments/ytm.mdx | 12 +- 76 files changed, 923 insertions(+), 756 deletions(-) diff --git a/themes/schema.json b/themes/schema.json index d79fe3b5..5ffcbe07 100644 --- a/themes/schema.json +++ b/themes/schema.json @@ -114,6 +114,39 @@ "description": "Override the status format for a specific change. Example: {\"Added\": \"Added: %d\"}", "default": {} }, + "folders": { + "type": "array", + "title": "Folders", + "description": "The folders to look for when determining if a folder is a workspace", + "default": [], + "items": { + "type": "string" + } + }, + "branch_max_length": { + "type": "integer", + "title": "Branch max length", + "description": "the max length for the displayed branch name where 0 implies full length", + "default": 0 + }, + "truncate_symbol": { + "type": "string", + "title": "Truncate Symbol", + "description": "Icon/text to use to indicate that the branch name has been truncated", + "default": "" + }, + "native_fallback": { + "type": "boolean", + "title": "Native Fallback", + "description": "Use the native command when executable is not found", + "default": false + }, + "full_branch_path": { + "type": "boolean", + "title": "Full branch path", + "description": "display the full branch path instead of only the branch name", + "default": true + }, "extra_prompt": { "type": "object", "default": {}, @@ -514,13 +547,13 @@ "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if a folder is an NPM workspace", - "default": [ - "package.json", - "package-lock.json" - ], + "default": ["package.json", "package-lock.json"], "items": { "type": "string" } + }, + "folders": { + "$ref": "#/definitions/folders" } } } @@ -748,6 +781,9 @@ "fetch_version": { "$ref": "#/definitions/fetch_version" }, + "missing_command_text": { + "$ref": "#/definitions/missing_command_text" + }, "display_mode": { "$ref": "#/definitions/display_mode" }, @@ -761,14 +797,13 @@ "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if a folder is a Buf workspace", - "default": [ - "buf.yaml", - "buf.gen.yaml", - "buf.work.yaml" - ], + "default": ["buf.yaml", "buf.gen.yaml", "buf.work.yaml"], "items": { "type": "string" } + }, + "folders": { + "$ref": "#/definitions/folders" } } } @@ -922,14 +957,13 @@ "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if a folder is a CMake workspace", - "default": [ - "*.cmake", - "CMakeLists.txt" - ], + "default": ["*.cmake", "CMakeLists.txt"], "items": { "type": "string" } - + }, + "folders": { + "$ref": "#/definitions/folders" } } } @@ -1001,6 +1035,9 @@ "items": { "type": "string" } + }, + "folders": { + "$ref": "#/definitions/folders" } } } @@ -1027,6 +1064,12 @@ "description": "Always show the status", "default": false }, + "status_template": { + "type": "string", + "title": "Status Template", + "description": "The template to use for the status segment", + "default": "|" + }, "status_separator": { "type": "string", "title": "Status Separator", @@ -1115,10 +1158,7 @@ "properties": { "properties": { "native_fallback": { - "type": "boolean", - "title": "Native Fallback", - "description": "Use the native fossil command when the fossil executable is not found", - "default": false + "$ref": "#/definitions/native_fallback" } } } @@ -1312,6 +1352,12 @@ }, "status_formats": { "$ref": "#/definitions/status_formats" + }, + "upstream_icons": { + "type": "object", + "title": "Status string formats", + "description": "a key, value map representing the remote URL (or a part of that URL) and icon to use in case the upstream URL contains the key. These get precedence over the standard icons", + "default": {} } } } @@ -1360,13 +1406,13 @@ "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if a folder is a Go workspace", - "default": [ - "*.go", - "go.mod" - ], + "default": ["*.go", "go.mod"], "items": { "type": "string" } + }, + "folders": { + "$ref": "#/definitions/folders" } } } @@ -1455,6 +1501,9 @@ "fetch_version": { "$ref": "#/definitions/fetch_version" }, + "missing_command_text": { + "$ref": "#/definitions/missing_command_text" + }, "display_mode": { "$ref": "#/definitions/display_mode" }, @@ -1468,14 +1517,13 @@ "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if a folder is a Deno workspace", - "default": [ - "*.js", - "*.ts", - "deno.json" - ], + "default": ["*.js", "*.ts", "deno.json"], "items": { "type": "string" } + }, + "folders": { + "$ref": "#/definitions/folders" } } } @@ -1518,13 +1566,13 @@ "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if a folder is a Crystal workspace", - "default": [ - "*.cr", - "shard.yml" - ], + "default": ["*.cr", "shard.yml"], "items": { "type": "string" } + }, + "folders": { + "$ref": "#/definitions/folders" } } } @@ -1567,12 +1615,13 @@ "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if a folder is a Julia workspace", - "default": [ - "*.jl" - ], + "default": ["*.jl"], "items": { "type": "string" } + }, + "folders": { + "$ref": "#/definitions/folders" } } } @@ -1605,6 +1654,9 @@ "missing_command_text": { "$ref": "#/definitions/missing_command_text" }, + "version_url_template": { + "$ref": "#/definitions/version_url_template" + }, "cache_version": { "$ref": "#/definitions/cache_version" }, @@ -1612,15 +1664,13 @@ "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if a folder is a Perl workspace", - "default": [ - ".perl-version", - "*.pl", - "*.pm", - "*.t" - ], + "default": [".perl-version", "*.pl", "*.pm", "*.t"], "items": { "type": "string" } + }, + "folders": { + "$ref": "#/definitions/folders" } } } @@ -1672,6 +1722,9 @@ "items": { "type": "string" } + }, + "folders": { + "$ref": "#/definitions/folders" } } } @@ -1707,6 +1760,9 @@ "cache_version": { "$ref": "#/definitions/cache_version" }, + "version_url_template": { + "$ref": "#/definitions/version_url_template" + }, "extensions": { "type": "array", "title": "Extensions", @@ -1726,6 +1782,9 @@ "*.clj", "*.cljc" ] + }, + "folders": { + "$ref": "#/definitions/folders" } } } @@ -1761,15 +1820,17 @@ "cache_version": { "$ref": "#/definitions/cache_version" }, + "version_url_template": { + "$ref": "#/definitions/version_url_template" + }, "extensions": { "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if a folder is a Ruby workspace", - "default": [ - "*.rb", - "Rakefile", - "Gemfile" - ] + "default": ["*.rb", "Rakefile", "Gemfile"] + }, + "folders": { + "$ref": "#/definitions/folders" } } } @@ -1805,15 +1866,17 @@ "cache_version": { "$ref": "#/definitions/cache_version" }, + "version_url_template": { + "$ref": "#/definitions/version_url_template" + }, "extensions": { "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if a folder is a Rust workspace", - "default": [ - "*.rs", - "Cargo.toml", - "Cargo.lock" - ] + "default": ["*.rs", "Cargo.toml", "Cargo.lock"] + }, + "folders": { + "$ref": "#/definitions/folders" } } } @@ -1849,16 +1912,20 @@ "cache_version": { "$ref": "#/definitions/cache_version" }, + "version_url_template": { + "$ref": "#/definitions/version_url_template" + }, "extensions": { "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if a folder is a XMake workspace", - "default": [ - "xmake.lua" - ], + "default": ["xmake.lua"], "items": { "type": "string" } + }, + "folders": { + "$ref": "#/definitions/folders" } } } @@ -1969,13 +2036,13 @@ "type": "string", "title": "Yarn Icon", "description": "Icon/text to use for Yarn", - "default": " \udb80\udd1b" + "default": "\uF011B" }, "npm_icon": { "type": "string", "title": "NPM Icon", "description": "Icon/text to use for NPM", - "default": " \uE71E" + "default": "\uE71E" }, "extensions": { "type": "array", @@ -1993,6 +2060,9 @@ "items": { "type": "string" } + }, + "folders": { + "$ref": "#/definitions/folders" } } } @@ -2231,11 +2301,17 @@ "description": "The symbol to use as a separator between folders", "default": "/" }, + "folder_separator_template": { + "type": "string", + "title": "Folder Separator Template", + "description": "the path which is split will be separated by this template", + "pattern": "" + }, "home_icon": { "type": "string", "title": "Home Icon", "description": "The icon to display when at $HOME", - "default": "/" + "default": "~" }, "folder_icon": { "type": "string", @@ -2247,7 +2323,7 @@ "type": "string", "title": "Windows Registry Icon", "description": "The icon to display when in the Windows registry", - "default": "\uE0B1" + "default": "\uF013" }, "style": { "type": "string", @@ -2266,7 +2342,7 @@ "unique", "powerlevel" ], - "default": "folder" + "default": "agnoster" }, "mapped_locations": { "type": "object", @@ -2280,6 +2356,12 @@ "description": "Maximum path depth to display without shortening", "default": 1 }, + "max_width": { + "type": "integer", + "title": "Maximum Width", + "description": "Maximum path width to display for powerlevel style", + "default": 0 + }, "mapped_locations_enabled": { "type": "boolean", "title": "Enable the Mapped Locations feature", @@ -2315,13 +2397,25 @@ "type": "string", "title": "The folder format", "description": "Golang string format to apply to the folder name", - "pattern": ".*%s.*" + "pattern": "%s" }, "edge_format": { "type": "string", "title": "The format to use on the start and end folder", "description": "Golang string format to apply to the start and end folder", - "pattern": ".*%s.*" + "pattern": "%s" + }, + "left_format": { + "type": "string", + "title": "The format to use on first folder of the path", + "description": "Will default to whatever edge_format is set to", + "pattern": "%s" + }, + "right_format": { + "type": "string", + "title": "The format to use on the last folder of the path", + "description": "Will default to whatever edge_format is set to", + "pattern": "%s" }, "gitdir_format": { "type": "string", @@ -2463,6 +2557,9 @@ "fetch_version": { "$ref": "#/definitions/fetch_version" }, + "display_mode": { + "$ref": "#/definitions/display_mode" + }, "missing_command_text": { "$ref": "#/definitions/missing_command_text" }, @@ -2477,6 +2574,15 @@ }, "cache_version": { "$ref": "#/definitions/cache_version" + }, + "extensions": { + "type": "array", + "title": "Extensions", + "description": "The extensions to look for when determining if a folder is a Quasar workspace", + "default": ["quasar.config", "quasar.config.js"] + }, + "folders": { + "$ref": "#/definitions/folders" } } } @@ -2518,6 +2624,9 @@ }, "status_formats": { "$ref": "#/definitions/status_formats" + }, + "native_fallback": { + "$ref": "#/definitions/native_fallback" } } } @@ -2729,19 +2838,19 @@ "type": "string", "title": "Playing Icon", "description": "Text/icon to show when playing", - "default": "\uE602" + "default": "\uE602 " }, "paused_icon": { "type": "string", "title": "Paused Icon", "description": "Text/icon to show when paused", - "default": "\uF8E3" + "default": "\uF8E3 " }, "stopped_icon": { "type": "string", "title": "Stopped Icon", "description": "Text/icon to show when stopped", - "default": "\uF04D" + "default": "\uF04D " }, "api_url": { "type": "string", @@ -2780,9 +2889,21 @@ "location": { "type": "string", "title": "location", - "description": "Location to use for the API call. Formatted as ,,. City name, state code and country code divided by comma. Please, refer to ISO 3166 for the state codes or country codes.", + "description": "Location to use for the API call interpretted only if valid coordinates aren't given. Formatted as ,,. City name, state code and country code divided by comma. Please, refer to ISO 3166 for the state codes or country codes.", "default": "De Bilt,NL" }, + "latitude" : { + "type": "number", + "title": "Latitude", + "description": "The latitude of the requested location, valid between -90 and 90", + "default": 91 + }, + "longitude" : { + "type": "number", + "title": "Longitude", + "description": "The longitude of the requested location, valid between -180 and 180", + "default": 181 + }, "units": { "type": "string", "title": "units", @@ -2841,13 +2962,13 @@ "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if a folder is a Elixir workspace", - "default": [ - "*.ex", - "*.exs" - ], + "default": ["*.ex", "*.exs"], "items": { "type": "string" } + }, + "folders": { + "$ref": "#/definitions/folders" } } } @@ -2949,25 +3070,25 @@ }, "ride_icon": { "type": "string", - "title": "Alternative icon", + "title": "Ride icon", "description": "Alternative icon for this activity type", "default": "\uf206" }, "run_icon": { "type": "string", - "title": "Alternative icon", + "title": "Run icon", "description": "Alternative icon for this activity type", "default": "\ue213" }, "skiing_icon": { "type": "string", - "title": "Alternative icon", + "title": "Skiing icon", "description": "Alternative icon for this activity type", "default": "\ue213" }, "workout_icon": { "type": "string", - "title": "Alternative icon", + "title": "Workout icon", "description": "Alternative icon for this activity type", "default": "\ue213" }, @@ -3019,6 +3140,9 @@ }, "status_formats": { "$ref": "#/definitions/status_formats" + }, + "native_fallback": { + "$ref": "#/definitions/native_fallback" } } } @@ -3045,6 +3169,9 @@ "fetch_version": { "$ref": "#/definitions/fetch_version" }, + "missing_command_text": { + "$ref": "#/definitions/missing_command_text" + }, "display_mode": { "$ref": "#/definitions/display_mode" }, @@ -3065,6 +3192,9 @@ "items": { "type": "string" } + }, + "folders": { + "$ref": "#/definitions/folders" } } } @@ -3094,6 +3224,9 @@ "display_mode": { "$ref": "#/definitions/display_mode" }, + "missing_command_text": { + "$ref": "#/definitions/missing_command_text" + }, "version_url_template": { "$ref": "#/definitions/version_url_template" }, @@ -3104,13 +3237,13 @@ "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if the current directory is a React project", - "default": - [ - "package.json" - ], + "default": ["package.json"], "items": { "type": "string" } + }, + "folders": { + "$ref": "#/definitions/folders" } } } @@ -3137,6 +3270,9 @@ "fetch_version": { "$ref": "#/definitions/fetch_version" }, + "missing_command_text": { + "$ref": "#/definitions/missing_command_text" + }, "display_mode": { "$ref": "#/definitions/display_mode" }, @@ -3150,14 +3286,13 @@ "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if the current directory is an Nx project", - "default": - [ - "workspace.json", - "nx.json" - ], + "default": ["workspace.json", "nx.json"], "items": { "type": "string" } + }, + "folders": { + "$ref": "#/definitions/folders" } } } @@ -3193,12 +3328,14 @@ "cache_version": { "$ref": "#/definitions/cache_version" }, + "version_url_template": { + "$ref": "#/definitions/version_url_template" + }, "extensions": { "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if the current directory is an OCaml project", - "default": - [ + "default": [ "*.ml", "*.mli", "dune", @@ -3208,6 +3345,9 @@ "items": { "type": "string" } + }, + "folders": { + "$ref": "#/definitions/folders" } } } @@ -3352,22 +3492,16 @@ "default": "\uF412" }, "truncate_symbol": { - "type": "string", - "title": "Truncate Symbol", - "description": "Icon/text to use to indicate that the branch name has been truncated", - "default": "" + "$ref": "#/definitions/truncate_symbol" }, "branch_max_length": { - "type": "integer", - "title": "Branch max length", - "description": "the max length for the displayed branch name where 0 implies full length", - "default": 0 + "$ref": "#/definitions/branch_max_length" }, "full_branch_path": { - "type": "boolean", - "title": "Full branch path", - "description": "display the full branch path instead of only the branch name", - "default": false + "$ref": "#/definitions/full_branch_path" + }, + "native_fallback": { + "$ref": "#/definitions/native_fallback" } } } @@ -3571,11 +3705,7 @@ "type": "string", "title": "Use Stack GHC", "description": "Get the GHC version used by Stack. Will decrease performance. Boolean indicating whether stack ghc was used available in template as .StackGhc", - "enum": [ - "always", - "package", - "never" - ], + "enum": ["always", "package", "never"], "default": "never" }, "extensions": { @@ -3593,6 +3723,9 @@ "items": { "type": "string" } + }, + "folders": { + "$ref": "#/definitions/folders" } } } @@ -3657,12 +3790,13 @@ "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if the current directory is a UI5 project", - "default": [ - "*ui5*.y*ml" - ], + "default": ["*ui5*.y*ml"], "items": { "type": "string" } + }, + "folders": { + "$ref": "#/definitions/folders" } } } @@ -3742,16 +3876,20 @@ "cache_version": { "$ref": "#/definitions/cache_version" }, + "version_url_template": { + "$ref": "#/definitions/version_url_template" + }, "extensions": { "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if the current directory is a Vala project", - "default": [ - "*.vala" - ], + "default": ["*.vala"], "items": { "type": "string" } + }, + "folders": { + "$ref": "#/definitions/folders" } } } @@ -3794,14 +3932,13 @@ "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if the current directory is a Cloud Foundry project", - "default": - [ - "manifest.yml", - "mta.yaml" - ], + "default": ["manifest.yml", "mta.yaml"], "items": { "type": "string" } + }, + "folders": { + "$ref": "#/definitions/folders" } } } @@ -3823,7 +3960,14 @@ "properties": { "properties": { "display_mode": { - "$ref": "#/definitions/display_mode" + "type": "string", + "title": "Display Mode", + "description": "Determines whether the segment is displayed always or only if a file matching the extensions are present in the current folder", + "enum": [ + "always", + "files" + ], + "default": "always" } } } @@ -3866,15 +4010,13 @@ "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if the current directory is a Kotlin project", - "default": - [ - "*.kt", - "*.kts", - "*.ktm" - ], + "default": ["*.kt", "*.kts", "*.ktm"], "items": { "type": "string" } + }, + "folders": { + "$ref": "#/definitions/folders" } } } @@ -3966,24 +4108,20 @@ "type": "string", "title": "Preferred Executable", "description": "The preferred executable to use when fetching the version.", - "enum": [ - "lua", - "luajit" - ], + "enum": ["lua", "luajit"], "default": "lua" }, "extensions": { "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if the current directory is a Lua project", - "default": - [ - "*.lua", - "*.rockspec" - ], + "default": ["*.lua", "*.rockspec"], "items": { "type": "string" } + }, + "folders": { + "$ref": "#/definitions/folders" } } } @@ -4026,13 +4164,13 @@ "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if the current directory is a Swift project", - "default": [ - "*.swift", - "*.SWIFT" - ], + "default": ["*.swift", "*.SWIFT"], "items": { "type": "string" } + }, + "folders": { + "$ref": "#/definitions/folders" } } } @@ -4068,20 +4206,20 @@ "cache_version": { "$ref": "#/definitions/cache_version" }, + "version_url_template": { + "$ref": "#/definitions/version_url_template" + }, "extensions": { "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if the current directory is a CDS project", - "default": - [ - ".cdsrc.json", - ".cdsrc-private.json", - "*.cds" - ], + "default": [".cdsrc.json", ".cdsrc-private.json", "*.cds"], "items": { "type": "string" } - + }, + "folders": { + "$ref": "#/definitions/folders" } } } @@ -4124,8 +4262,7 @@ "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if the current directory is an R project", - "default": - [ + "default": [ "*.R", "*.Rmd", "*.Rsx", @@ -4137,6 +4274,9 @@ "items": { "type": "string" } + }, + "folders": { + "$ref": "#/definitions/folders" } } } @@ -4199,7 +4339,7 @@ "type": "boolean", "title": "Display Status", "description": "Display the local changes or not", - "default": true + "default": false }, "status_formats": { "$ref": "#/definitions/status_formats" @@ -4227,7 +4367,7 @@ "type": "string", "title": "URL", "description": "The URL to the Nightscout API", - "default": "https://your.nightscout.url/api/v1/entries.json" + "default": "" }, "cache_timeout": { "type": "integer", diff --git a/website/docs/segments/angular.mdx b/website/docs/segments/angular.mdx index 31c86ba3..9b142596 100644 --- a/website/docs/segments/angular.mdx +++ b/website/docs/segments/angular.mdx @@ -25,15 +25,16 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| ---------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | -| `fetch_version` | `boolean` | fetch the active version or not; useful if all you need is an icon indicating `ng` | -| `display_mode` | `string` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when `angular.json` file is present (**default**)
| -| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | -| `extensions` | `[]string` | allows to override the default list of file extensions to validate | -| `folders` | `[]string` | allows to override the list of folder names to validate | -| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` | +| Name | Type | Default | Description | +| ---------------------- | :--------: | :------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `home_enabled` | `boolean` | `false` | display the segment in the HOME folder or not | +| `fetch_version` | `boolean` | `true` | fetch the angular version | +| `missing_command_text` | `string` | | text to display when the command is missing | +| `display_mode` | `string` | `context` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when file `extensions` listed are present
  • `context`: displays the segment when the environment or files is active
| +| `version_url_template` | `string` | | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | +| `extensions` | `[]string` | `angular.json` | allows to override the default list of file extensions to validate | +| `folders` | `[]string` | | allows to override the list of folder names to validate | +| `cache_version` | `boolean` | `false` | cache the executable's version or not | ## Template ([info][templates]) diff --git a/website/docs/segments/aws.mdx b/website/docs/segments/aws.mdx index e2ea15da..02eb2403 100644 --- a/website/docs/segments/aws.mdx +++ b/website/docs/segments/aws.mdx @@ -25,9 +25,9 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| ----------------- | ------------------------------------------------------------------------------ | ------------------ | -| `display_default` | `boolean` - display the segment or not when the user profile matches `default` | defaults to `true` | +| Name | Type | Default | Description | +| ----------------- | :-------: | :-----: | -------------------------------------------- | +| `display_default` | `boolean` | `true` | display the segment when default user or not | ## Template ([info][templates]) diff --git a/website/docs/segments/az.mdx b/website/docs/segments/az.mdx index 0b20188d..cf3fe87b 100644 --- a/website/docs/segments/az.mdx +++ b/website/docs/segments/az.mdx @@ -29,9 +29,9 @@ import Config from '@site/src/components/Config.js'; ## Properties -| Name | Type | Description | -| -------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `source` | `string` |
  • `first_match`: try the CLI config first, then the PowerShell module. The first to resolve is displayed (**default**)
  • `cli`: fetch the information from the CLI config
  • `pwsh`: fetch the information from the PowerShell Module config
| +| Name | Type | Default | Description | +| -------- | :------: | :-----------: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `source` | `string` | `first_match` |
  • `first_match`: try the CLI config first, then the PowerShell module. The first to resolve is displayed
  • `cli`: fetch the information from the CLI config
  • `pwsh`: fetch the information from the PowerShell Module config
| ## Template ([info][templates]) diff --git a/website/docs/segments/azfunc.mdx b/website/docs/segments/azfunc.mdx index 525906c9..887f068c 100644 --- a/website/docs/segments/azfunc.mdx +++ b/website/docs/segments/azfunc.mdx @@ -29,15 +29,16 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| ---------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | -| `fetch_version` | `boolean` | fetch the Azure Functions CLI version - defaults to `true` | -| `missing_command_text` | `string` | text to display when the command is missing - defaults to empty | -| `display_mode` | `string` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when a `host.json` or `local.settings.json` files is present (**default**)
| -| `extensions` | `[]string` | allows to override the default list of file extensions to validate | -| `folders` | `[]string` | allows to override the list of folder names to validate | -| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` | +| Name | Type | Default | Description | +| ---------------------- | :--------: | :---------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `home_enabled` | `boolean` | `false` | display the segment in the HOME folder or not | +| `fetch_version` | `boolean` | `true` | fetch the Azure Functions CLI version | +| `missing_command_text` | `string` | | text to display when the command is missing | +| `display_mode` | `string` | `context` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when file `extensions` listed are present
  • `context`: displays the segment when the environment or files is active
| +| `version_url_template` | `string` | | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | +| `extensions` | `[]string` | `host.json, local.settings.json, function.json` | allows to override the default list of file extensions to validate | +| `folders` | `[]string` | | allows to override the list of folder names to validate | +| `cache_version` | `boolean` | `false` | cache the executable's version or not | ## Template ([info][templates]) @@ -59,5 +60,6 @@ import Config from "@site/src/components/Config.js"; | `.Patch` | `string` | patch number | | `.Error` | `string` | error encountered when fetching the version string | -[templates]: /docs/configuration/templates +[go-text-template]: https://golang.org/pkg/text/template/ +[templates]: configuration/templates.mdx [az-func-core-tools]: https://github.com/Azure/azure-functions-core-tools diff --git a/website/docs/segments/battery.mdx b/website/docs/segments/battery.mdx index cf00f2bb..818349a9 100644 --- a/website/docs/segments/battery.mdx +++ b/website/docs/segments/battery.mdx @@ -37,13 +37,13 @@ import Config from '@site/src/components/Config.js'; ## Properties -| Name | Type | Description | -| ------------------- | --------- | --------------------------------------------------------------------------------------------- | -| `display_error` | `boolean` | show the error context when failing to retrieve the battery information - defaults to `false` | -| `charging_icon` | `string` | icon to display when charging - defaults to empty | -| `discharging_icon` | `string` | icon to display when discharging - defaults to empty | -| `charged_icon` | `string` | icon to display when fully charged - defaults to empty | -| `not_charging_icon` | `string` | icon to display when fully charged - defaults to empty | +| Name | Type | Default | Description | +| ------------------- | :-------: | :-----: | ----------------------------------------------------------------------- | +| `display_error` | `boolean` | `false` | show the error context when failing to retrieve the battery information | +| `charging_icon` | `string` | | icon to display when charging | +| `discharging_icon` | `string` | | icon to display when discharging | +| `charged_icon` | `string` | | icon to display when fully charged | +| `not_charging_icon` | `string` | | icon to display when fully charged | ## Template ([info][templates]) diff --git a/website/docs/segments/bazel.mdx b/website/docs/segments/bazel.mdx index 7aadcb67..ca82d162 100644 --- a/website/docs/segments/bazel.mdx +++ b/website/docs/segments/bazel.mdx @@ -24,17 +24,17 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| ---------------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | -| `fetch_version` | `boolean` | display the Bazel version - defaults to `true` | -| `missing_command_text` | `string` | text to display when the command is missing - defaults to empty | -| `display_mode` | `string` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when `*.bazel`, `*.bzl`, `.bazelrc`, `.bazelversion`, `BUILD` or `WORKSPACE` files or any of Bazel's output folders are present (**default**)
| -| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info documentation | -| `icon` | `string` | the icon for the segment - defaults to `"\ue63a"` | -| `extensions` | `[]string` | allows to override the default list of file extensions to validate | -| `folders` | `[]string` | | -| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` | +| Name | Type | Default | Description | +| ---------------------- | :--------: | :---------------------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `home_enabled` | `boolean` | `false` | display the segment in the HOME folder or not | +| `fetch_version` | `boolean` | `true` | display the Bazel version - defaults to | +| `missing_command_text` | `string` | | text to display when the command is missing | +| `display_mode` | `string` | `context` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when file `extensions` listed are present
  • `context`: displays the segment when the environment or files is active
| +| `version_url_template` | `string` | | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info documentation | +| `icon` | `string` | `\ue63a` | the icon for the segment | +| `extensions` | `[]string` | `*.bazel, *.bzl, BUILD, WORKSPACE, .bazelrc, .bazelversion` | allows to override the default list of file extensions to validate | +| `folders` | `[]string` | | | +| `cache_version` | `boolean` | `false` | cache the executable's version or not | ## Template ([info][templates]) diff --git a/website/docs/segments/brewfather.mdx b/website/docs/segments/brewfather.mdx index cea1bf11..71514b92 100644 --- a/website/docs/segments/brewfather.mdx +++ b/website/docs/segments/brewfather.mdx @@ -43,14 +43,14 @@ import Config from '@site/src/components/Config.js'; ## Properties -| Name | Type | Description | -| --------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------- | -| `user_id` | `string` | as provided by Brewfather's Generate API Key screen | -| `api_key` | `string` | as provided by Brewfather's Generate API Key screen | -| `batch_id` | `string` | Get this by navigating to the desired batch on the brewfather website, the batch id is at the end of the URL in the address bar | -| `http_timeout` | `int` | in milliseconds - How long to wait for the Brewfather service to answer the request. Default 2 seconds | -| `cache_timeout` | `int` | in minutes - How long to wait before updating the data from Brewfather. Default is 5 minutes | -| `day_icon` | `string` | icon or letter to use to indicate days. Default is "d" | +| Name | Type | Default | Description | +| --------------- | :------: | :-----: | ------------------------------------------------------------------------------------------------------------------------------- | +| `user_id` | `string` | | as provided by Brewfather's Generate API Key screen | +| `api_key` | `string` | | as provided by Brewfather's Generate API Key screen | +| `batch_id` | `string` | | Get this by navigating to the desired batch on the brewfather website, the batch id is at the end of the URL in the address bar | +| `http_timeout` | `int` | `2` | in milliseconds - How long to wait for the Brewfather service to answer the request | +| `cache_timeout` | `int` | `5` | in minutes - How long to wait before updating the data from Brewfather | +| `day_icon` | `string` | `d` | icon or letter to use to indicate days | ## Icons diff --git a/website/docs/segments/buf.mdx b/website/docs/segments/buf.mdx index 874ef755..e787c5c0 100644 --- a/website/docs/segments/buf.mdx +++ b/website/docs/segments/buf.mdx @@ -23,15 +23,16 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| ---------------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | -| `fetch_version` | `boolean` | fetch the active version or not; useful if all you need is an icon indicating `buf` | -| `display_mode` | `string` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when `buf.yaml`, `buf.gen.yaml` or `buf.work.yaml` files are present (**default**)
| -| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | -| `extensions` | `[]string` | allows to override the default list of file extensions to validate | -| `folders` | `[]string` | allows to override the list of folder names to validate | -| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` | +| Name | Type | Default | Description | +| ---------------------- | :--------: | :-------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `home_enabled` | `boolean` | `false` | display the segment in the HOME folder or not | +| `fetch_version` | `boolean` | `true` | fetch the active version or not; useful if all you need is an icon indicating `buf` | +| `missing_command_text` | `string` | | text to display when the command is missing | +| `display_mode` | `string` | `context` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when file `extensions` listed are present
  • `context`: displays the segment when the environment or files is active
| +| `version_url_template` | `string` | | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | +| `extensions` | `[]string` | `buf.yaml, buf.gen.yaml, buf.work.yaml` | allows to override the default list of file extensions to validate | +| `folders` | `[]string` | | allows to override the list of folder names to validate | +| `cache_version` | `boolean` | `false` | cache the executable's version or not | ## Template ([info][templates]) diff --git a/website/docs/segments/carbonintensity.mdx b/website/docs/segments/carbonintensity.mdx index 65b4cacb..228395ec 100644 --- a/website/docs/segments/carbonintensity.mdx +++ b/website/docs/segments/carbonintensity.mdx @@ -45,10 +45,10 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| --------------- | ----- | ------------------------------------------------------------------------------------------------------------------------------------------------ | -| `http_timeout` | `int` | Timeout (in milliseconds) for HTTP requests. The default is 20ms, but you may need to set this to as high as 5000ms to handle slow API requests. | -| `cache_timeout` | `int` | Timeout (in minutes) for the response cache. The default is 10m. A value of 0 disables the cache. | +| Name | Type | Default | Description | +| --------------- | :---: | :-----: | ------------------------------------------------------------------------------------------------------------------------------------------------ | +| `http_timeout` | `int` | `20` | Timeout (in milliseconds) for HTTP requests. The default is 20ms, but you may need to set this to as high as 5000ms to handle slow API requests. | +| `cache_timeout` | `int` | `10` | Timeout (in minutes) for the response cache. The default is 10m. A value of 0 disables the cache. | ## Template ([info][templates]) diff --git a/website/docs/segments/cds.mdx b/website/docs/segments/cds.mdx index 42d1cacf..bd48bf12 100644 --- a/website/docs/segments/cds.mdx +++ b/website/docs/segments/cds.mdx @@ -25,15 +25,16 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| ---------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | -| `fetch_version` | `boolean` | fetch the CDS version - defaults to `true` | -| `missing_command_text` | `string` | text to display when the cds command is missing - defaults to empty | -| `display_mode` | `string` |
  • `always`: the segment is always displayed
  • `files`: the segment is displayed when `.cdsrc.json`, `.cdsrc-private` or `*.cds` file is present
  • `context`: the segment is displayed when conditions from `files` mode are fulfilled or `package.json` file is present and `@sap/cds` is in `dependencies` section (**default**)
| -| `extensions` | `[]string` | allows to override the default list of file extensions to validate | -| `folders` | `[]string` | allows to override the list of folder names to validate | -| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` | +| Name | Type | Default | Description | +| ---------------------- | :--------: | :---------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `home_enabled` | `boolean` | `false` | display the segment in the HOME folder or not | +| `fetch_version` | `boolean` | `true` | fetch the CDS version | +| `missing_command_text` | `string` | `""` | text to display when the cds command is missing | +| `display_mode` | `string` | `context` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when file `extensions` listed are present
  • `context`: displays the segment when the environment or files is active
| +| `version_url_template` | `string` | | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | +| `extensions` | `[]string` | `.cdsrc.json, .cdsrc-private.json, *.cds` | allows to override the default list of file extensions to validate | +| `folders` | `[]string` | | allows to override the list of folder names to validate | +| `cache_version` | `boolean` | `false` | cache the executable's version or not | ## Template ([info][templates]) @@ -56,5 +57,6 @@ import Config from "@site/src/components/Config.js"; | `.Error` | `string` | error encountered when fetching the version string | | `.HasDependency` | `bool` | a flag if `@sap/cds` was found in `package.json` | -[templates]: /docs/configuration/templates +[go-text-template]: https://golang.org/pkg/text/template/ +[templates]: configuration/templates.mdx [sap-cap-cds]: https://cap.cloud.sap/docs/tools/#command-line-interface-cli diff --git a/website/docs/segments/cf.mdx b/website/docs/segments/cf.mdx index 1d923e85..859f4cd0 100644 --- a/website/docs/segments/cf.mdx +++ b/website/docs/segments/cf.mdx @@ -25,16 +25,16 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| ---------------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | -| `fetch_version` | `boolean` | display the Cloud Foundry CLI version - defaults to `true` | -| `missing_command_text` | `string` | text to display when the java command is missing - defaults to empty | -| `display_mode` | `string` |
  • `always`: the segment is always displayed
  • `files`: the segment is displayed when `manifest.yml` or `mta.yaml` file is present (**default**)
| -| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | -| `extensions` | `[]string` | allows to override the default list of file extensions to validate | -| `folders` | `[]string` | allows to override the list of folder names to validate | -| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` | +| Name | Type | Default | Description | +| ---------------------- | :--------: | :----------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `home_enabled` | `boolean` | `false` | display the segment in the HOME folder or not | +| `fetch_version` | `boolean` | `true` | display the Cloud Foundry CLI version | +| `missing_command_text` | `string` | | text to display when the java command is missing | +| `display_mode` | `string` | `context` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when file `extensions` listed are present
  • `context`: displays the segment when the environment or files is active
| +| `version_url_template` | `string` | | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | +| `extensions` | `[]string` | `manifest.yml, mta.yaml` | allows to override the default list of file extensions to validate | +| `folders` | `[]string` | | allows to override the list of folder names to validate | +| `cache_version` | `boolean` | `false` | cache the executable's version or not | ## Template ([info][templates]) diff --git a/website/docs/segments/cftarget.mdx b/website/docs/segments/cftarget.mdx index 68297179..58da8934 100644 --- a/website/docs/segments/cftarget.mdx +++ b/website/docs/segments/cftarget.mdx @@ -23,9 +23,9 @@ import Config from '@site/src/components/Config.js'; ## Properties -| Name | Type | Description | -| -------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `display_mode` | `string` |
  • `always`: the segment is always displayed (**default**)
  • `files`: the segment is only displayed when a `manifest.yml` file is present
| +| Name | Type | Default | Description | +| -------------- | :------: | :------: | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `display_mode` | `string` | `always` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when a `manifest.yml` file is present
| ## Template ([info][templates]) diff --git a/website/docs/segments/cmake.mdx b/website/docs/segments/cmake.mdx index ad9afcb1..3ed5b238 100644 --- a/website/docs/segments/cmake.mdx +++ b/website/docs/segments/cmake.mdx @@ -25,16 +25,16 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| ---------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | -| `fetch_version` | `boolean` | display the cmake version - defaults to `true` | -| `missing_command_text` | `string` | text to display when the command is missing - defaults to empty | -| `display_mode` | `string` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when `*.cmake` or `CMakeLists.txt` files are present (**default**)
| -| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | -| `extensions` | `[]string` | allows to override the default list of file extensions to validate | -| `folders` | `[]string` | allows to override the list of folder names to validate | -| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` | +| Name | Type | Default | Description | +| ---------------------- | :--------: | :-----------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `home_enabled` | `boolean` | `false` | display the segment in the HOME folder or not | +| `fetch_version` | `boolean` | `true` | display the cmake version | +| `missing_command_text` | `string` | | text to display when the command is missing | +| `display_mode` | `string` | `context` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when file `extensions` listed are present
  • `context`: displays the segment when the environment or files is active
| +| `version_url_template` | `string` | | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | +| `extensions` | `[]string` | `*.cmake, CMakeLists.txt` | allows to override the default list of file extensions to validate | +| `folders` | `[]string` | | allows to override the list of folder names to validate | +| `cache_version` | `boolean` | `false` | cache the executable's version or not | ## Template ([info][templates]) diff --git a/website/docs/segments/command.mdx b/website/docs/segments/command.mdx index 520b3582..2f149e8d 100644 --- a/website/docs/segments/command.mdx +++ b/website/docs/segments/command.mdx @@ -42,11 +42,11 @@ import Config from '@site/src/components/Config.js'; ## Properties -| Name | Type | Description | -| --------- | -------- | --------------------------------------------------------------------------------- | -| `shell` | `string` | the shell in which to run the command in. Uses `shell -c command` under the hood. | -| `command` | `string` | the command(s) to run | -| `script` | `string` | the path to a script to run | +| Name | Type | Default | Description | +| --------- | :------: | :-----: | --------------------------------------------------------------------------------- | +| `shell` | `string` | `bash` | the shell in which to run the command in. Uses `shell -c command` under the hood. | +| `command` | `string` | | the command(s) to run | +| `script` | `string` | | the path to a script to run | ## Template ([info][templates]) diff --git a/website/docs/segments/connection.mdx b/website/docs/segments/connection.mdx index 12b05265..e957ac54 100644 --- a/website/docs/segments/connection.mdx +++ b/website/docs/segments/connection.mdx @@ -26,9 +26,9 @@ import Config from '@site/src/components/Config.js'; ## Properties -| Name | Type | Description | -| ------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `type` | `string` | the type of connection to display. Can be a single value or multiple joined by \| . The first to resolve is shown (**default value** is wifi\|ethernet). Possible values:
  • `wifi`
  • `ethernet`
  • `bluetooth`
  • `cellular`
| +| Name | Type | Default | Description | +| ------ | :------: | :--------------: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `type` | `string` | `wifi\|ethernet` | the type of connection to display. Can be a single value or multiple joined by a pipe \| . The first to resolve is shown. Possible values:
  • `wifi`
  • `ethernet`
  • `bluetooth`
  • `cellular`
| ## Template ([info][templates]) diff --git a/website/docs/segments/crystal.mdx b/website/docs/segments/crystal.mdx index 06537ac6..a552c2f8 100644 --- a/website/docs/segments/crystal.mdx +++ b/website/docs/segments/crystal.mdx @@ -25,16 +25,16 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| ---------------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | -| `fetch_version` | `boolean` | fetch the julia version - defaults to `true` | -| `missing_command_text` | `string` | text to display when the command is missing - defaults to empty | -| `display_mode` | `string` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when `*.cr` or `shard.yml` files are present (**default**)
| -| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | -| `extensions` | `[]string` | allows to override the default list of file extensions to validate | -| `folders` | `[]string` | allows to override the list of folder names to validate | -| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` | +| Name | Type | Default | Description | +| ---------------------- | :--------: | :---------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `home_enabled` | `boolean` | `false` | display the segment in the HOME folder or not | +| `fetch_version` | `boolean` | `true` | fetch the crystal version | +| `missing_command_text` | `string` | | text to display when the command is missing | +| `display_mode` | `string` | `context` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when file `extensions` listed are present
  • `context`: displays the segment when the environment or files is active
| +| `version_url_template` | `string` | | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | +| `extensions` | `[]string` | `*.cr, shard.yml` | allows to override the default list of file extensions to validate | +| `folders` | `[]string` | | allows to override the list of folder names to validate | +| `cache_version` | `boolean` | `false` | cache the executable's version or not | ## Template ([info][templates]) diff --git a/website/docs/segments/dart.mdx b/website/docs/segments/dart.mdx index b0518473..db2e4200 100644 --- a/website/docs/segments/dart.mdx +++ b/website/docs/segments/dart.mdx @@ -25,16 +25,16 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| ---------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | -| `fetch_version` | `boolean` | fetch the dart version - defaults to `true` | -| `missing_command_text` | `string` | text to display when the command is missing - defaults to empty | -| `display_mode` | `string` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when `*.dart`, `pubspec.yaml`, `pubspec.yml`, `pubspec.lock` files or the `.dart_tool` folder are present (**default**)
| -| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | -| `extensions` | `[]string` | allows to override the default list of file extensions to validate | -| `folders` | `[]string` | allows to override the list of folder names to validate | -| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` | +| Name | Type | Default | Description | +| ---------------------- | :--------: | :-----------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `home_enabled` | `boolean` | `false` | display the segment in the HOME folder or not | +| `fetch_version` | `boolean` | `true` | fetch the dart version | +| `missing_command_text` | `string` | | text to display when the command is missing | +| `display_mode` | `string` | `context` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when file `extensions` listed are present
  • `context`: displays the segment when the environment or files is active
| +| `version_url_template` | `string` | | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | +| `extensions` | `[]string` | `*.dart, pubspec.yaml, pubspec.yml, pubspec.lock` | allows to override the default list of file extensions to validate | +| `folders` | `[]string` | `.dart_tool` | allows to override the list of folder names to validate | +| `cache_version` | `boolean` | `false` | cache the executable's version or not | ## Template ([info][templates]) diff --git a/website/docs/segments/deno.mdx b/website/docs/segments/deno.mdx index fc6ef849..1cf8de2f 100644 --- a/website/docs/segments/deno.mdx +++ b/website/docs/segments/deno.mdx @@ -23,15 +23,16 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| ---------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | -| `fetch_version` | `boolean` | fetch the active version or not; useful if all you need is an icon indicating `deno` | -| `display_mode` | `string` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when `*.ts*`, `*.js` or `deno.json` files are present (**default**)
| -| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | -| `extensions` | `[]string` | allows to override the default list of file extensions to validate | -| `folders` | `[]string` | allows to override the list of folder names to validate | -| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` | +| Name | Type | Default | Description | +| ---------------------- | :--------: | :---------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `home_enabled` | `boolean` | `false` | display the segment in the HOME folder or not | +| `fetch_version` | `boolean` | `true` | fetch the active version or not; useful if all you need is an icon indicating `deno` | +| `missing_command_text` | `string` | | text to display when the command is missing | +| `display_mode` | `string` | `context` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when file `extensions` listed are present
  • `context`: displays the segment when the environment or files is active
| +| `version_url_template` | `string` | | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | +| `extensions` | `[]string` | `*.ts, *.js, deno.json` | allows to override the default list of file extensions to validate | +| `folders` | `[]string` | | allows to override the list of folder names to validate | +| `cache_version` | `boolean` | `false` | cache the executable's version or not | ## Template ([info][templates]) diff --git a/website/docs/segments/dotnet.mdx b/website/docs/segments/dotnet.mdx index efe2ef35..640ae519 100644 --- a/website/docs/segments/dotnet.mdx +++ b/website/docs/segments/dotnet.mdx @@ -23,13 +23,16 @@ import Config from '@site/src/components/Config.js'; ## Properties -| Name | Type | Description | -| ---------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | -| `fetch_version` | `boolean` | fetch the active version or not; useful if all you need is an icon indicating `dotnet` is present - defaults to `true` | -| `missing_command_text` | `string` | text to display when the command is missing - defaults to empty | -| `display_mode` | `string` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when `*.cs`, `*.vb`, `*.fs`, `*.fsx`, `*.sln`, `*.slnf`, `*.csproj`, `*.vbproj`, or `*.fsproj` files are present (**default**)
| -| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | +| Name | Type | Default | Description | +| ---------------------- | :--------: | :----------------------------------------------------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `home_enabled` | `boolean` | `false` | display the segment in the HOME folder or not | +| `fetch_version` | `boolean` | `true` | fetch the active version or not; useful if all you need is an icon indicating `dotnet` | +| `missing_command_text` | `string` | | text to display when the command is missing | +| `display_mode` | `string` | `context` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when file `extensions` listed are present
  • `context`: displays the segment when the environment or files is active
| +| `version_url_template` | `string` | | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | +| `extensions` | `[]string` | `*.cs, *.csx, *.vb, *.fs, *.fsx, *.sln, *.slnf, *.csproj, *.fsproj, *.vbproj, global.json` | allows to override the default list of file extensions to validate | +| `folders` | `[]string` | | allows to override the list of folder names to validate | +| `cache_version` | `boolean` | `false` | cache the executable's version or not | ## Template ([info][templates]) diff --git a/website/docs/segments/elixir.mdx b/website/docs/segments/elixir.mdx index b99da6c2..b5c844e5 100644 --- a/website/docs/segments/elixir.mdx +++ b/website/docs/segments/elixir.mdx @@ -25,16 +25,16 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| ---------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | -| `fetch_version` | `boolean` | fetch the elixir version - defaults to `true` | -| `missing_command_text` | `string` | text to display when the command is missing - defaults to empty | -| `display_mode` | `string` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when `*.ex` or `*.exs` files are present (**default**)
| -| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | -| `extensions` | `[]string` | allows to override the default list of file extensions to validate | -| `folders` | `[]string` | allows to override the list of folder names to validate | -| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` | +| Name | Type | Default | Description | +| ---------------------- | :--------: | :-----------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `home_enabled` | `boolean` | `false` | display the segment in the HOME folder or not | +| `fetch_version` | `boolean` | `true` | fetch the elixir version | +| `missing_command_text` | `string` | | text to display when the command is missing | +| `display_mode` | `string` | `context` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when file `extensions` listed are present
  • `context`: displays the segment when the environment or files is active
| +| `version_url_template` | `string` | | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | +| `extensions` | `[]string` | `*.ex, *.exs` | allows to override the default list of file extensions to validate | +| `folders` | `[]string` | | allows to override the list of folder names to validate | +| `cache_version` | `boolean` | `false` | cache the executable's version or not | ## Template ([info][templates]) diff --git a/website/docs/segments/executiontime.mdx b/website/docs/segments/executiontime.mdx index 89fb8685..405cb032 100644 --- a/website/docs/segments/executiontime.mdx +++ b/website/docs/segments/executiontime.mdx @@ -28,11 +28,11 @@ import Config from '@site/src/components/Config.js'; ## Properties -| Name | Type | Description | -| ---------------- | --------- | ----------------------------------------------------------------------------------- | -| `always_enabled` | `boolean` | always show the duration - defaults to `false` | -| `threshold` | `number` | minimum duration (milliseconds) required to enable this segment - defaults to `500` | -| `style` | `enum` | one of the available format options - defaults to `austin` | +| Name | Type | Default | Description | +| ---------------- | :-------: | :------: | ------------------------------------------------------------------------- | +| `always_enabled` | `boolean` | `false` | always show the duration | +| `threshold` | `number` | `500` | minimum duration (milliseconds) required to enable this segment | +| `style` | `enum` | `austin` | one of the available format options | ### Style diff --git a/website/docs/segments/flutter.mdx b/website/docs/segments/flutter.mdx index 7d94ecda..2b7d2bd2 100644 --- a/website/docs/segments/flutter.mdx +++ b/website/docs/segments/flutter.mdx @@ -25,16 +25,16 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| ---------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | -| `fetch_version` | `boolean` | fetch the flutter version - defaults to `true` | -| `missing_command_text` | `string` | text to display when the command is missing - defaults to empty | -| `display_mode` | `string` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when `*.dart`, `pubspec.yaml`, `pubspec.yml`, `pubspec.lock` files or the `.dart_tool` folder are present (**default**)
| -| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | -| `extensions` | `[]string` | allows to override the default list of file extensions to validate | -| `folders` | `[]string` | allows to override the list of folder names to validate | -| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` | +| Name | Type | Default | Description | +| ---------------------- | :--------: | :-----------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `home_enabled` | `boolean` | `false` | display the segment in the HOME folder or not | +| `fetch_version` | `boolean` | `true` | fetch the flutter version | +| `missing_command_text` | `string` | | text to display when the command is missing | +| `display_mode` | `string` | `context` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when file `extensions` listed are present
  • `context`: displays the segment when the environment or files is active
| +| `version_url_template` | `string` | | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | +| `extensions` | `[]string` | `*.dart, pubspec.yaml, pubspec.yml, pubspec.lock` | allows to override the default list of file extensions to validate | +| `folders` | `[]string` | `.dart_tool` | allows to override the list of folder names to validate | +| `cache_version` | `boolean` | `false` | cache the executable's version or not | ## Template ([info][templates]) diff --git a/website/docs/segments/fossil.mdx b/website/docs/segments/fossil.mdx index 5047fd3c..b586c5f9 100644 --- a/website/docs/segments/fossil.mdx +++ b/website/docs/segments/fossil.mdx @@ -22,9 +22,9 @@ import Config from '@site/src/components/Config.js'; ## Properties -| Name | Type | Description | -| ----------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `native_fallback` | `boolean` | when set to `true` and `fossil.exe` is not available when inside a WSL2 shared Windows drive, we will fallback to the native fossil executable to fetch data. Not all information can be displayed in this case. Defaults to `false` | +| Name | Type | Default | Description | +| ----------------- | :-------: | :-----: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `native_fallback` | `boolean` | `false` | when set to `true` and `fossil.exe` is not available when inside a WSL2 shared Windows drive, we will fallback to the native fossil executable to fetch data. Not all information can be displayed in this case | ## Template ([info][templates]) diff --git a/website/docs/segments/git.mdx b/website/docs/segments/git.mdx index 753baf82..3569260e 100644 --- a/website/docs/segments/git.mdx +++ b/website/docs/segments/git.mdx @@ -69,55 +69,55 @@ import Config from "@site/src/components/Config.js"; As doing multiple git calls can slow down the prompt experience, we do not fetch information by default. You can set the following properties to `true` to enable fetching additional information (and populate the template). -| Name | Type | Description | -| --------------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `fetch_status` | `boolean` | fetch the local changes - defaults to `false` | -| `ignore_status` | `[]string` | do not fetch status for these repo's. Uses the repo's root folder and same logic as the [exclude_folders][exclude_folders] property | -| `fetch_upstream_icon` | `boolean` | fetch upstream icon - defaults to `false` | -| `fetch_bare_info` | `boolean` | fetch bare repo info - defaults to `false` | -| `untracked_modes` | `map[string]string` | map of repo's where to override the default [untracked files mode][untracked]:
  • `no`
  • `normal`
  • `all`
For example `"untracked_modes": { "/Users/me/repos/repo1": "no" }` - defaults to `normal` for all repo's. If you want to override for all repo's, use `*` to set the mode instead of the repo path | -| `ignore_submodules` | `map[string]string` | map of repo's where to change the [--ignore-submodules][submodules] flag (`none`, `untracked`, `dirty` or `all`). For example `"ignore_submodules": { "/Users/me/repos/repo1": "all" }`. If you want to override for all repo's, use `*` to set the mode instead of the repo path | -| `native_fallback` | `boolean` | when set to `true` and `git.exe` is not available when inside a WSL2 shared Windows drive, we will fallback to the native git executable to fetch data. Not all information can be displayed in this case. Defaults to `false` | -| `fetch_user` | [`User`](#user) | fetch the current configured user for the repository - defaults to `false` | -| `status_formats` | `map[string]string` | a key, value map allowing to override how individual status items are displayed. For example, `"status_formats": { "Added": "Added: %d" }` will display the added count as `Added: 1` instead of `+1`. See the [Status](#status) section for available overrides. Defaults to an empty map. | +| Name | Type | Default | Description | +| --------------------- | :-----------------: | :-----: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `fetch_status` | `boolean` | `false` | fetch the local changes | +| `ignore_status` | `[]string` | | do not fetch status for these repo's. Uses the repo's root folder and same logic as the [exclude_folders][exclude_folders] property | +| `fetch_upstream_icon` | `boolean` | `false` | fetch upstream icon | +| `fetch_bare_info` | `boolean` | `false` | fetch bare repo info | +| `untracked_modes` | `map[string]string` | | map of repo's where to override the default [untracked files mode][untracked]:
  • `no`
  • `normal`
  • `all`
For example `"untracked_modes": { "/Users/me/repos/repo1": "no" }` - defaults to `normal` for all repo's. If you want to override for all repo's, use `*` to set the mode instead of the repo path | +| `ignore_submodules` | `map[string]string` | | map of repo's where to change the [--ignore-submodules][submodules] flag (`none`, `untracked`, `dirty` or `all`). For example `"ignore_submodules": { "/Users/me/repos/repo1": "all" }`. If you want to override for all repo's, use `*` to set the mode instead of the repo path | +| `native_fallback` | `boolean` | `false` | when set to `true` and `git.exe` is not available when inside a WSL2 shared Windows drive, we will fallback to the native git executable to fetch data. Not all information can be displayed in this case | +| `fetch_user` | [`User`](#user) | `false` | fetch the current configured user for the repository | +| `status_formats` | `map[string]string` | | a key, value map allowing to override how individual status items are displayed. For example, `"status_formats": { "Added": "Added: %d" }` will display the added count as `Added: 1` instead of `+1`. See the [Status](#status) section for available overrides. | ### Icons #### Branch -| Name | Type | Description | -| ----------------------- | -------- | -------------------------------------------------------------------------------------------- | -| `branch_icon` | `string` | the icon to use in front of the git branch name - defaults to `\uE0A0 ` | -| `branch_identical_icon` | `string` | the icon to display when remote and local are identical - defaults to `\u2261` | -| `branch_ahead_icon` | `string` | the icon to display when the local branch is ahead of its remote - defaults to `\u2191` | -| `branch_behind_icon` | `string` | the icon to display when the local branch is behind its remote - defaults to `\u2193` | -| `branch_gone_icon` | `string` | the icon to display when there's no remote branch - defaults to `\u2262` | -| `branch_max_length` | `int` | the max length for the displayed branch name where `0` implies full length - defaults to `0` | -| `truncate_symbol` | `string` | the icon to display when a branch name is truncated - defaults to empty | +| Name | Type | Default | Description | +| ----------------------- | :------: | :------: | -------------------------------------------------------------------------- | +| `branch_icon` | `string` | `\uE0A0` | the icon to use in front of the git branch name | +| `branch_identical_icon` | `string` | `\u2261` | the icon to display when remote and local are identical | +| `branch_ahead_icon` | `string` | `\u2191` | the icon to display when the local branch is ahead of its remote | +| `branch_behind_icon` | `string` | `\u2193` | the icon to display when the local branch is behind its remote | +| `branch_gone_icon` | `string` | `\u2262` | the icon to display when there's no remote branch | +| `branch_max_length` | `int` | `0` | the max length for the displayed branch name where `0` implies full length | +| `truncate_symbol` | `string` | | the icon to display when a branch name is truncated | #### HEAD -| Name | Type | Description | -| ------------------ | -------- | ---------------------------------------------------------------------------------------- | -| `commit_icon` | `string` | icon/text to display before the commit context (detached HEAD) - defaults to `\uF417` | -| `tag_icon` | `string` | icon/text to display before the tag context - defaults to `\uF412` | -| `rebase_icon` | `string` | icon/text to display before the context when in a rebase - defaults to `\uE728 ` | -| `cherry_pick_icon` | `string` | icon/text to display before the context when doing a cherry-pick - defaults to `\uE29B ` | -| `revert_icon` | `string` | icon/text to display before the context when doing a revert - defaults to `\uF0E2 ` | -| `merge_icon` | `string` | icon/text to display before the merge context - defaults to `\uE727 ` | -| `no_commits_icon` | `string` | icon/text to display when there are no commits in the repo - defaults to `\uF594 ` | +| Name | Type | Default | Description | +| ------------------ | :------: | :------: | ---------------------------------------------------------------- | +| `commit_icon` | `string` | `\uF417` | icon/text to display before the commit context (detached HEAD) | +| `tag_icon` | `string` | `\uF412` | icon/text to display before the tag context | +| `rebase_icon` | `string` | `\uE728` | icon/text to display before the context when in a rebase | +| `cherry_pick_icon` | `string` | `\uE29B` | icon/text to display before the context when doing a cherry-pick | +| `revert_icon` | `string` | `\uF0E2` | icon/text to display before the context when doing a revert | +| `merge_icon` | `string` | `\uE727` | icon/text to display before the merge context | +| `no_commits_icon` | `string` | `\uF594` | icon/text to display when there are no commits in the repo | #### Upstream -| Name | Type | Description | -| ------------------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `github_icon` | `string` | icon/text to display when the upstream is Github - defaults to `\uF408 ` | -| `gitlab_icon` | `string` | icon/text to display when the upstream is Gitlab - defaults to `\uF296 ` | -| `bitbucket_icon` | `string` | icon/text to display when the upstream is Bitbucket - defaults to `\uF171 ` | -| `azure_devops_icon` | `string` | icon/text to display when the upstream is Azure DevOps - defaults to `\uEBE8 ` | -| `codecommit_icon` | `string` | icon/text to display when the upstream is AWS CodeCommit - defaults to `\uF270 ` | -| `git_icon` | `string` | icon/text to display when the upstream is not known/mapped - defaults to `\uE5FB ` | -| `upstream_icons` | `map[string]string` | a key, value map representing the remote URL (or a part of that URL) and icon to use in case the upstream URL contains the key. These get precedence over the standard icons | +| Name | Type | Default | Description | +| ------------------- | :-----------------: | :------: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `github_icon` | `string` | `\uF408` | icon/text to display when the upstream is Github | +| `gitlab_icon` | `string` | `\uF296` | icon/text to display when the upstream is Gitlab | +| `bitbucket_icon` | `string` | `\uF171` | icon/text to display when the upstream is Bitbucket | +| `azure_devops_icon` | `string` | `\uEBE8` | icon/text to display when the upstream is Azure DevOps | +| `codecommit_icon` | `string` | `\uF270` | icon/text to display when the upstream is AWS CodeCommit | +| `git_icon` | `string` | `\uE5FB` | icon/text to display when the upstream is not known/mapped | +| `upstream_icons` | `map[string]string` | | a key, value map representing the remote URL (or a part of that URL) and icon to use in case the upstream URL contains the key. These get precedence over the standard icons | ## Template ([info][templates]) diff --git a/website/docs/segments/gitversion.mdx b/website/docs/segments/gitversion.mdx index c90038c6..deea1433 100644 --- a/website/docs/segments/gitversion.mdx +++ b/website/docs/segments/gitversion.mdx @@ -29,9 +29,9 @@ import Config from '@site/src/components/Config.js'; ## Properties -| Name | Type | Description | -| --------------- | ----- | ----------------------------------------------------------------------------------------------------------------------------------------------- | -| `cache_timeout` | `int` | in minutes - How long to wait before fetching new information using the gitversion CLI. Default is 30 minutes, a value of 0 disables the cache. | +| Name | Type | Default | Description | +| --------------- | :---: | :------: | ------------------------------------------------------------------------------------------------------------------------ | +| `cache_timeout` | `int` | `30` | in minutes - How long to wait before fetching new information using the gitversion CLI. A value of 0 disables the cache. | ## Template ([info][templates]) diff --git a/website/docs/segments/golang.mdx b/website/docs/segments/golang.mdx index 50dfb981..5f31b6de 100644 --- a/website/docs/segments/golang.mdx +++ b/website/docs/segments/golang.mdx @@ -25,17 +25,17 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| ---------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | -| `fetch_version` | `boolean` | display the golang version - defaults to `true` | -| `missing_command_text` | `string` | text to display when the command is missing - defaults to empty | -| `display_mode` | `string` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when `*.go` or `go.mod` files are present (**default**)
| -| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | -| `parse_mod_file` | `boolean` | parse the go.mod file instead of calling `go version` | -| `extensions` | `[]string` | allows to override the default list of file extensions to validate | -| `folders` | `[]string` | allows to override the list of folder names to validate | -| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` | +| Name | Type | Default | Description | +| ---------------------- | :--------: | :------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `home_enabled` | `boolean` | `false` | display the segment in the HOME folder or not | +| `fetch_version` | `boolean` | `true` | fetch the golang version | +| `missing_command_text` | `string` | | text to display when the command is missing | +| `display_mode` | `string` | `context` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when file `extensions` listed are present
  • `context`: displays the segment when the environment or files is active
| +| `version_url_template` | `string` | | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | +| `parse_mod_file` | `boolean` | `false` | parse the go.mod file instead of calling `go version` | +| `extensions` | `[]string` | `*.go, go.mod` | allows to override the default list of file extensions to validate | +| `folders` | `[]string` | | allows to override the list of folder names to validate | +| `cache_version` | `boolean` | `false` | cache the executable's version or not | ## Template ([info][templates]) diff --git a/website/docs/segments/haskell.mdx b/website/docs/segments/haskell.mdx index ad63e00a..0264c1dd 100644 --- a/website/docs/segments/haskell.mdx +++ b/website/docs/segments/haskell.mdx @@ -25,17 +25,17 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| ---------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | -| `fetch_version` | `boolean` | display the GHC version - defaults to `true` | -| `missing_command_text` | `string` | text to display when the command is missing - defaults to empty | -| `display_mode` | `string` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when `*.hs`, `*.lhs`, `stack.yaml`, `package.yaml`, `*.cabal`, or `cabal.project` files are present (**default**)
| -| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | -| `stack_ghc_mode` | `string` | determines when to use `stack ghc` to retrieve the version information. Using `stack ghc` will decrease performance.
  • `never`: never use `stack ghc` (**default**)
  • `package`: only use `stack ghc` when `stack.yaml` is in the root of the
  • `always`: always use `stack ghc`
| -| `extensions` | `[]string` | allows to override the default list of file extensions to validate | -| `folders` | `[]string` | allows to override the list of folder names to validate | -| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` | +| Name | Type | Default | Description | +| ---------------------- | :--------: | :-------------------------------------------------------------: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `home_enabled` | `boolean` | `false` | display the segment in the HOME folder or not | +| `fetch_version` | `boolean` | `true` | fetch the GHC version | +| `missing_command_text` | `string` | | text to display when the command is missing | +| `display_mode` | `string` | `context` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when file `extensions` listed are present
  • `context`: displays the segment when the environment or files is active
| +| `version_url_template` | `string` | | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | +| `stack_ghc_mode` | `string` | `never` | determines when to use `stack ghc` to retrieve the version information. Using `stack ghc` will decrease performance.
  • `never`: never use `stack ghc`
  • `package`: only use `stack ghc` when `stack.yaml` is in the root of the
  • `always`: always use `stack ghc`
| +| `extensions` | `[]string` | `*.hs, *.lhs, stack.yaml, package.yaml, *.cabal, cabal.project` | allows to override the default list of file extensions to validate | +| `folders` | `[]string` | | allows to override the list of folder names to validate | +| `cache_version` | `boolean` | `false` | cache the executable's version or not | ## Template ([info][templates]) diff --git a/website/docs/segments/helm.mdx b/website/docs/segments/helm.mdx index 3edff120..b232c151 100644 --- a/website/docs/segments/helm.mdx +++ b/website/docs/segments/helm.mdx @@ -23,9 +23,9 @@ import Config from '@site/src/components/Config.js'; ## Properties -| Name | Type | Description | -| -------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `display_mode` | `string` |
  • `always`: the segment is always displayed (**default**)
  • `files`: the segment is only displayed when a `Chart.yaml` (or `Chart.yml`) file is present
| +| Name | Type | Default | Description | +| -------------- | :------: | :------: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `display_mode` | `string` | `always` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when a `Chart.yaml` (or `Chart.yml`) file is present
| ## Template ([info][templates]) diff --git a/website/docs/segments/ipify.mdx b/website/docs/segments/ipify.mdx index 82dd1139..f36a73eb 100644 --- a/website/docs/segments/ipify.mdx +++ b/website/docs/segments/ipify.mdx @@ -28,11 +28,11 @@ import Config from '@site/src/components/Config.js'; ## Properties -| Name | Type | Description | -| --------------- | -------- | -------------------------------------------------------------------------------------------------------------------- | -| `url` | `string` | The Ipify URL, by default IPv4 is used, use `https://api64.ipify.org` for IPv6 - defaults to `https://api.ipify.org` | -| `http_timeout` | `int` | How long may the segment wait for a response of the ipify API? - defaults to 20ms | -| `cache_timeout` | `int` | in minutes - How long you want your IP address cached - defaults to 10 min | +| Name | Type | Default | Description | +| --------------- | :------: | :---------------------: | ------------------------------------------------------------------------------- | +| `url` | `string` | `https://api.ipify.org` | The Ipify URL, by default IPv4 is used, use `https://api64.ipify.org` for IPv6 | +| `http_timeout` | `int` | `20` | in milliseconds - how long may the segment wait for a response of the ipify API | +| `cache_timeout` | `int` | `10` | in minutes - How long you want your IP address cached | ## Template ([info][templates]) diff --git a/website/docs/segments/java.mdx b/website/docs/segments/java.mdx index f79e17d1..18ac4813 100644 --- a/website/docs/segments/java.mdx +++ b/website/docs/segments/java.mdx @@ -25,15 +25,16 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| ---------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | -| `fetch_version` | `boolean` | display the java version - defaults to `true` | -| `missing_command_text` | `string` | text to display when the java command is missing - defaults to empty | -| `display_mode` | `string` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when one of the following files is present
    • `pom.xml`
    • `build.gradle.kts`
    • `build.sbt`
    • `.java-version`
    • `.deps.edn`
    • `project.clj`
    • `build.boot`
    • `*.java`
    • `*.class`
    • `*.gradle`
    • `*.jar`
    • `*.clj`
    • `*.cljc`
| -| `extensions` | `[]string` | allows to override the default list of file extensions to validate | -| `folders` | `[]string` | allows to override the list of folder names to validate | -| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` | +| Name | Type | Default | Description | +| ---------------------- | :--------: | :----------------------------------------------------------------------------------------------------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `home_enabled` | `boolean` | `false` | display the segment in the HOME folder or not | +| `fetch_version` | `boolean` | `true` | fetch the java version | +| `missing_command_text` | `string` | | text to display when the command is missing | +| `display_mode` | `string` | `context` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when file `extensions` listed are present
  • `context`: displays the segment when the environment or files is active
| +| `version_url_template` | `string` | | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | +| `extensions` | `[]string` | `*.java, *.class, *.gradle, *.jar, *.clj, *.cljr, pom.xml, build.gradle.kts, build.sbt, .java-version, .deps.edn, project.clj, build.boot` | allows to override the default list of file extensions to validate | +| `folders` | `[]string` | | allows to override the list of folder names to validate | +| `cache_version` | `boolean` | `false` | cache the executable's version or not | ## Template ([info][templates]) @@ -55,4 +56,5 @@ import Config from "@site/src/components/Config.js"; | `.Patch` | `string` | patch number | | `.Error` | `string` | error encountered when fetching the version string | -[templates]: /docs/configuration/templates +[go-text-template]: https://golang.org/pkg/text/template/ +[templates]: configuration/templates.mdx diff --git a/website/docs/segments/julia.mdx b/website/docs/segments/julia.mdx index 7866eda5..d54f7ff3 100644 --- a/website/docs/segments/julia.mdx +++ b/website/docs/segments/julia.mdx @@ -25,16 +25,16 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| ---------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | -| `fetch_version` | `boolean` | display the julia version - defaults to `true` | -| `missing_command_text` | `string` | text to display when the command is missing - defaults to empty | -| `display_mode` | `string` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when `*.jl` files are present (**default**)
| -| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | -| `extensions` | `[]string` | allows to override the default list of file extensions to validate | -| `folders` | `[]string` | allows to override the list of folder names to validate | -| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` | +| Name | Type | Default | Description | +| ---------------------- | :--------: | :-------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `home_enabled` | `boolean` | `false` | display the segment in the HOME folder or not | +| `fetch_version` | `boolean` | `true` | fetch the julia version | +| `missing_command_text` | `string` | | text to display when the command is missing | +| `display_mode` | `string` | `context` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when file `extensions` listed are present
  • `context`: displays the segment when the environment or files is active
| +| `version_url_template` | `string` | | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | +| `extensions` | `[]string` | `*.jl` | allows to override the default list of file extensions to validate | +| `folders` | `[]string` | | allows to override the list of folder names to validate | +| `cache_version` | `boolean` | `false` | cache the executable's version or not | ## Template ([info][templates]) diff --git a/website/docs/segments/kotlin.mdx b/website/docs/segments/kotlin.mdx index 9772b4de..cfcfbe27 100644 --- a/website/docs/segments/kotlin.mdx +++ b/website/docs/segments/kotlin.mdx @@ -25,16 +25,18 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| ---------------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | -| `fetch_version` | `boolean` | display the kotlin version - defaults to `true` | -| `missing_command_text` | `string` | text to display when the command is missing - defaults to empty | -| `display_mode` | `string` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when `*.kt`, `*.kts` or `*.ktm` files are present (**default**)
| -| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | -| `extensions` | `[]string` | allows to override the default list of file extensions to validate | -| `folders` | `[]string` | allows to override the list of folder names to validate | -| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` | +## Properties + +| Name | Type | Default | Description | +| ---------------------- | :--------: | :------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `home_enabled` | `boolean` | `false` | display the segment in the HOME folder or not | +| `fetch_version` | `boolean` | `true` | fetch the kotlin version | +| `missing_command_text` | `string` | | text to display when the command is missing | +| `display_mode` | `string` | `context` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when file `extensions` listed are present
  • `context`: displays the segment when the environment or files is active
| +| `version_url_template` | `string` | | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | +| `extensions` | `[]string` | `*.kt, *.kts, *.ktm` | allows to override the default list of file extensions to validate | +| `folders` | `[]string` | | allows to override the list of folder names to validate | +| `cache_version` | `boolean` | `false` | cache the executable's version or not | ## Template ([info][templates]) diff --git a/website/docs/segments/kubectl.mdx b/website/docs/segments/kubectl.mdx index 77cbde8f..7f2485f3 100644 --- a/website/docs/segments/kubectl.mdx +++ b/website/docs/segments/kubectl.mdx @@ -30,11 +30,11 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| ------------------ | --------- | ----------------------------------------------------------------------------------------------------- | -| `display_error` | `boolean` | show the error context when failing to retrieve the kubectl information - defaults to `false` | -| `parse_kubeconfig` | `boolean` | parse kubeconfig files instead of calling out to kubectl to improve performance - defaults to `false` | -| `context_aliases` | `object` | custom context names | +| Name | Type | Default | Description | +| ------------------ | :-------: | :-----: | ------------------------------------------------------------------------------- | +| `display_error` | `boolean` | `false` | show the error context when failing to retrieve the kubectl information | +| `parse_kubeconfig` | `boolean` | `false` | parse kubeconfig files instead of calling out to kubectl to improve performance | +| `context_aliases` | `object` | | custom context namespace | ## Template ([info][templates]) diff --git a/website/docs/segments/lastfm.mdx b/website/docs/segments/lastfm.mdx index c6722224..be099837 100644 --- a/website/docs/segments/lastfm.mdx +++ b/website/docs/segments/lastfm.mdx @@ -40,12 +40,12 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| -------------- | -------- | ------------------------------------------------------ | -| `playing_icon` | `string` | text/icon to show when playing - defaults to `\uE602 ` | -| `stopped_icon` | `string` | text/icon to show when stopped - defaults to `\uF04D ` | -| `api_key` | `string` | your LastFM [API key][api-key] | -| `username` | `string` | your LastFM username | +| Name | Type | Default | Description | +| -------------- | :------: | :-------: | ------------------------------ | +| `playing_icon` | `string` | `\uE602 ` | text/icon to show when playing | +| `stopped_icon` | `string` | `\uF04D ` | text/icon to show when stopped | +| `api_key` | `string` | | your LastFM [API key][api-key] | +| `username` | `string` | | your LastFM username | ## Template ([info][templates]) @@ -67,6 +67,6 @@ import Config from "@site/src/components/Config.js"; | `.Full` | `string` | will output `Artist - Track` | | `.Icon` | `string` | icon (based on `.Status`) | -[templates]: /docs/configuration/templates +[templates]: configuration/templates.mdx [lastfm]: https://www.last.fm [api-key]: https://www.last.fm/api/account/create diff --git a/website/docs/segments/lua.mdx b/website/docs/segments/lua.mdx index ead88c0a..edc7eeb2 100644 --- a/website/docs/segments/lua.mdx +++ b/website/docs/segments/lua.mdx @@ -25,17 +25,17 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| ---------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | -| `fetch_version` | `boolean` | display the lua version - defaults to `true` | -| `missing_command_text` | `string` | text to display when the command is missing - defaults to empty | -| `display_mode` | `string` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when `*.lua`, `*.rockspec` files or the `lua` folder are present (**default**)
| -| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | -| `preferred_executable` | `string` | the preferred executable to use when fetching the version
  • `lua`: the Lua executable (**default**)
  • `luajit`: the LuaJIT executable
| -| `extensions` | `[]string` | allows to override the default list of file extensions to validate | -| `folders` | `[]string` | allows to override the list of folder names to validate | -| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` | +| Name | Type | Default | Description | +| ---------------------- | :--------: | :-----------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `home_enabled` | `boolean` | `false` | display the segment in the HOME folder or not | +| `fetch_version` | `boolean` | `true` | fetch the lua version | +| `missing_command_text` | `string` | | text to display when the command is missing | +| `display_mode` | `string` | `context` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when file `extensions` listed are present
  • `context`: displays the segment when the environment or files is active
| +| `version_url_template` | `string` | | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | +| `preferred_executable` | `string` | `lua` | the preferred executable to use when fetching the version
  • `lua`: the Lua executable (**default**)
  • `luajit`: the LuaJIT executable
| +| `extensions` | `[]string` | `*.lua, *.rockspec` | allows to override the default list of file extensions to validate | +| `folders` | `[]string` | | allows to override the list of folder names to validate | +| `cache_version` | `boolean` | `false` | cache the executable's version or not | ## Template ([info][templates]) diff --git a/website/docs/segments/mercurial.mdx b/website/docs/segments/mercurial.mdx index 9d6e19fe..b97623b7 100644 --- a/website/docs/segments/mercurial.mdx +++ b/website/docs/segments/mercurial.mdx @@ -33,10 +33,10 @@ import Config from "@site/src/components/Config.js"; As doing Mercurial (hg) calls can slow down the prompt experience, we do not fetch information by default. You can set the following properties to `true` to enable fetching additional information (and populate the template). -| Name | Type | Description | -| ---------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `fetch_status` | `boolean` | fetch the local changes - defaults to `false` | -| `status_formats` | `map[string]string` | a key, value map allowing to override how individual status items are displayed. For example, `"status_formats": { "Added": "Added: %d" }` will display the added count as `Added: 1` instead of `+1`. See the [Status](#status) section for available overrides. Defaults to an empty map. | +| Name | Type | Default | Description | +| ---------------- | :-----------------: | :-----: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `fetch_status` | `boolean` | `false` | fetch the local changes | +| `status_formats` | `map[string]string` | | a key, value map allowing to override how individual status items are displayed. For example, `"status_formats": { "Added": "Added: %d" }` will display the added count as `Added: 1` instead of `+1`. See the [Status](#status) section for available overrides | ## Template ([info][templates]) diff --git a/website/docs/segments/nightscout.mdx b/website/docs/segments/nightscout.mdx index 16e98d57..ad8e09f0 100644 --- a/website/docs/segments/nightscout.mdx +++ b/website/docs/segments/nightscout.mdx @@ -57,11 +57,11 @@ Or display in mmol/l (instead of the default mg/dl) with the following template: ## Properties -| Name | Type | Description | -| --------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `url` | `string` | Your Nightscout URL, including the full path to entries.json AND count=1 AND token. Example above. You'll know this works if you can curl it yourself and get a single value. - defaults to `` | -| `http_timeout` | `int` | How long do you want to wait before you want to see your prompt more than your sugar? I figure a half second is a good default - defaults to 500ms | -| `cache_timeout` | `int` | in minutes - How long do you want your numbers cached? - defaults to 5 min | +| Name | Type | Default | Description | +| --------------- | :------: | :-----: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `url` | `string` | | Your Nightscout URL, including the full path to entries.json AND count=1 AND token. Example above. You'll know this works if you can curl it yourself and get a single value | +| `http_timeout` | `int` | `500` | in milliseconds - how long do you want to wait before you want to see your prompt more than your sugar? I figure a half second is a good default | +| `cache_timeout` | `int` | `5` | in minutes - how long do you want your numbers cached? | :::info You can change the icons for trend, put the trend elsewhere, add text, however you like! diff --git a/website/docs/segments/node.mdx b/website/docs/segments/node.mdx index 446c9b0e..c308f101 100644 --- a/website/docs/segments/node.mdx +++ b/website/docs/segments/node.mdx @@ -25,19 +25,19 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| ----------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | -| `fetch_version` | `boolean` | display the Node.js version - defaults to `true` | -| `missing_command_text` | `string` | text to display when the command is missing - defaults to empty | -| `display_mode` | `string` |
  • `always`: The segment is always displayed
  • `files`: The segment is only displayed when one of the following files is present (**default**):
    • `*.js`
    • `*.ts`
    • `package.json`
    • `.nvmrc`
    • `pnpm-workspace.yaml`
    • `.pnpmfile.cjs`
    • `.vue`
| -| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | -| `fetch_package_manager` | `boolean` | define if the current project uses Yarn or NPM - defaults to `false` | -| `yarn_icon` | `string` | the icon/text to display when using Yarn - defaults to ` \uF011B` | -| `npm_icon` | `string` | the icon/text to display when using NPM - defaults to ` \uE71E` | -| `extensions` | `[]string` | allows to override the default list of file extensions to validate | -| `folders` | `[]string` | allows to override the list of folder names to validate | -| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` | +| Name | Type | Default | Description | +| ----------------------- | :--------: | :--------------------------------------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `home_enabled` | `boolean` | `false` | display the segment in the HOME folder or not | +| `fetch_version` | `boolean` | `true` | fetch the Node.js version | +| `missing_command_text` | `string` | | text to display when the command is missing | +| `display_mode` | `string` | `context` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when file `extensions` listed are present
  • `context`: displays the segment when the environment or files is active
| +| `version_url_template` | `string` | | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | +| `fetch_package_manager` | `boolean` | `false` | define if the current project uses Yarn or NPM | +| `yarn_icon` | `string` | `\uF011B` | the icon/text to display when using Yarn | +| `npm_icon` | `string` | `\uE71E` | the icon/text to display when using NPM | +| `extensions` | `[]string` | `*.js, *.ts, package.json, .nvmrc, pnpm-workspace.yaml, .pnpmfile.cjs, .vue` | allows to override the default list of file extensions to validate | +| `folders` | `[]string` | | allows to override the list of folder names to validate | +| `cache_version` | `boolean` | `false` | cache the executable's version or not | ## Template ([info][templates]) diff --git a/website/docs/segments/npm.mdx b/website/docs/segments/npm.mdx index 2afb42de..4a4b764d 100644 --- a/website/docs/segments/npm.mdx +++ b/website/docs/segments/npm.mdx @@ -25,16 +25,16 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| ---------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | -| `missing_command_text` | `string` | text to display when the command is missing - defaults to empty | -| `fetch_version` | `boolean` | fetch the NPM version - defaults to `true` | -| `display_mode` | `string` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when `package.json` or `package-lock.json` file are present (**default**)
| -| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | -| `extensions` | `[]string` | allows to override the default list of file extensions to validate | -| `folders` | `[]string` | allows to override the list of folder names to validate | -| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` | +| Name | Type | Default | Description | +| ---------------------- | :--------: | :-------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `home_enabled` | `boolean` | `false` | display the segment in the HOME folder or not | +| `fetch_version` | `boolean` | `true` | fetch the NPM version | +| `missing_command_text` | `string` | | text to display when the command is missing | +| `display_mode` | `string` | `context` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when file `extensions` listed are present
  • `context`: displays the segment when the environment or files is active
| +| `version_url_template` | `string` | | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | +| `extensions` | `[]string` | `package.json, package-lock.json` | allows to override the default list of file extensions to validate | +| `folders` | `[]string` | | allows to override the list of folder names to validate | +| `cache_version` | `boolean` | `false` | cache the executable's version or not | ## Template ([info][templates]) diff --git a/website/docs/segments/nx.mdx b/website/docs/segments/nx.mdx index 69a85710..76b1f2c6 100644 --- a/website/docs/segments/nx.mdx +++ b/website/docs/segments/nx.mdx @@ -25,15 +25,16 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| ---------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | -| `fetch_version` | `boolean` | fetch the active version or not; useful if all you need is an icon indicating `ng` | -| `display_mode` | `string` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when a `workspace.json` or `nx.json` file is present (**default**)
| -| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | -| `extensions` | `[]string` | allows to override the default list of file extensions to validate | -| `folders` | `[]string` | allows to override the list of folder names to validate | -| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` | +| Name | Type | Default | Description | +| ---------------------- | :--------: | :-----------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `home_enabled` | `boolean` | `false` | display the segment in the HOME folder or not | +| `fetch_version` | `boolean` | `true` | fetch the active version or not | +| `missing_command_text` | `string` | | text to display when the command is missing | +| `display_mode` | `string` | `context` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when file `extensions` listed are present
  • `context`: displays the segment when the environment or files is active
| +| `version_url_template` | `string` | | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | +| `extensions` | `[]string` | `workspace.json, nx.json` | allows to override the default list of file extensions to validate | +| `folders` | `[]string` | | allows to override the list of folder names to validate | +| `cache_version` | `boolean` | `false` | cache the executable's version or not | ## Template ([info][templates]) diff --git a/website/docs/segments/ocaml.mdx b/website/docs/segments/ocaml.mdx index 3a91583a..2ec1581a 100644 --- a/website/docs/segments/ocaml.mdx +++ b/website/docs/segments/ocaml.mdx @@ -24,15 +24,16 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| ---------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | -| `fetch_version` | `boolean` | display the ocaml version (`ocaml -version`) - defaults to `true` | -| `missing_command_text` | `string` | text to display when the command is missing - defaults to empty | -| `display_mode` | `string` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when `*.rs`, `Cargo.toml` or `Cargo.lock` files are present (**default**)
| -| `extensions` | `[]string` | allows to override the default list of file extensions to validate | -| `folders` | `[]string` | allows to override the list of folder names to validate | -| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` | +| Name | Type | Default | Description | +| ---------------------- | :--------: | :-----------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `home_enabled` | `boolean` | `false` | display the segment in the HOME folder or not | +| `fetch_version` | `boolean` | `true` | display the ocaml version (`ocaml -version`) | +| `missing_command_text` | `string` | | text to display when the command is missing | +| `display_mode` | `string` | `context` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when file `extensions` listed are present
  • `context`: displays the segment when the environment or files is active
| +| `version_url_template` | `string` | | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | +| `extensions` | `[]string` | `*.ml, *.mli, dune, dune-project, dune-workspace` | allows to override the default list of file extensions to validate | +| `folders` | `[]string` | | allows to override the list of folder names to validate | +| `cache_version` | `boolean` | `false` | cache the executable's version or not | ## Template ([info][templates]) @@ -55,4 +56,5 @@ import Config from "@site/src/components/Config.js"; | `.Prerelease` | `string` | channel name | | `.Error` | `string` | error encountered when fetching the version string | +[go-text-template]: https://golang.org/pkg/text/template/ [templates]: /docs/configuration/templates diff --git a/website/docs/segments/os.mdx b/website/docs/segments/os.mdx index 84bccdfb..f7359a98 100644 --- a/website/docs/segments/os.mdx +++ b/website/docs/segments/os.mdx @@ -25,34 +25,34 @@ import Config from '@site/src/components/Config.js'; ## Properties -| Name | Type | Description | -| --------------------- | --------- | ------------------------------------------------------------------------- | -| `macos` | `string` | the string to use for macOS - defaults to `\uF179` | -| `linux` | `string` | the icon to use for Linux - defaults to `\uF17C` | -| `windows` | `string` | the icon to use for Windows - defaults to `\uE62A` | -| `display_distro_name` | `boolean` | display the distro name or icon (for WSL and Linux) - defaults to `false` | -| `alma` | `string` | the icon to use for Alma - defaults to `\uF31D` | -| `alpine` | `string` | the icon to use for Alpine - defaults to `\uF300` | -| `aosc` | `string` | the icon to use for Aosc - defaults to `\uF301` | -| `arch` | `string` | the icon to use for Arch - defaults to `\uF303` | -| `centos` | `string` | the icon to use for Centos - defaults to `\uF304` | -| `coreos` | `string` | the icon to use for Coreos - defaults to `\uF305` | -| `debian` | `string` | the icon to use for Debian - defaults to `\uF306` | -| `devuan` | `string` | the icon to use for Devuan - defaults to `\uF307` | -| `raspbian` | `string` | the icon to use for Raspbian - defaults to `\uF315` | -| `elementary` | `string` | the icon to use for Elementary - defaults to `\uF309` | -| `fedora` | `string` | the icon to use for Fedora - defaults to `\uF30a` | -| `gentoo` | `string` | the icon to use for Gentoo - defaults to `\uF30d` | -| `mageia` | `string` | the icon to use for Mageia - defaults to `\uF310` | -| `manjaro` | `string` | the icon to use for Manjaro - defaults to `\uF312` | -| `mint` | `string` | the icon to use for Mint - defaults to `\uF30e` | -| `nixos` | `string` | the icon to use for Nixos - defaults to `\uF313` | -| `opensuse` | `string` | the icon to use for Opensuse - defaults to `\uF314` | -| `redhat` | `string` | the icon to use for Redhat - defaults to `\uF316` | -| `rocky` | `string` | the icon to use for Rocky - defaults to `\uF32B` | -| `sabayon` | `string` | the icon to use for Sabayon - defaults to `\uF317` | -| `slackware` | `string` | the icon to use for Slackware - defaults to `\uF319` | -| `ubuntu` | `string` | the icon to use for Ubuntu - defaults to `\uF31b` | +| Name | Type | Default | Description | +| --------------------- | :-------: | :------: | --------------------------------------------------- | +| `macos` | `string` | `\uF179` | the string to use for macOS | +| `linux` | `string` | `\uF17C` | the icon to use for Linux | +| `windows` | `string` | `\uE62A` | the icon to use for Windows | +| `display_distro_name` | `boolean` | `false` | display the distro name or icon (for WSL and Linux) | +| `alma` | `string` | `\uF31D` | the icon to use for Alma | +| `alpine` | `string` | `\uF300` | the icon to use for Alpine | +| `aosc` | `string` | `\uF301` | the icon to use for Aosc | +| `arch` | `string` | `\uF303` | the icon to use for Arch | +| `centos` | `string` | `\uF304` | the icon to use for Centos | +| `coreos` | `string` | `\uF305` | the icon to use for Coreos | +| `debian` | `string` | `\uF306` | the icon to use for Debian | +| `devuan` | `string` | `\uF307` | the icon to use for Devuan | +| `raspbian` | `string` | `\uF315` | the icon to use for Raspbian | +| `elementary` | `string` | `\uF309` | the icon to use for Elementary | +| `fedora` | `string` | `\uF30a` | the icon to use for Fedora | +| `gentoo` | `string` | `\uF30d` | the icon to use for Gentoo | +| `mageia` | `string` | `\uF310` | the icon to use for Mageia | +| `manjaro` | `string` | `\uF312` | the icon to use for Manjaro | +| `mint` | `string` | `\uF30e` | the icon to use for Mint | +| `nixos` | `string` | `\uF313` | the icon to use for Nixos | +| `opensuse` | `string` | `\uF314` | the icon to use for Opensuse | +| `redhat` | `string` | `\uF316` | the icon to use for Redhat | +| `rocky` | `string` | `\uF32B` | the icon to use for Rocky | +| `sabayon` | `string` | `\uF317` | the icon to use for Sabayon | +| `slackware` | `string` | `\uF319` | the icon to use for Slackware | +| `ubuntu` | `string` | `\uF31b` | the icon to use for Ubuntu | ## Template ([info][templates]) diff --git a/website/docs/segments/owm.mdx b/website/docs/segments/owm.mdx index 7e75f715..4f362ba8 100644 --- a/website/docs/segments/owm.mdx +++ b/website/docs/segments/owm.mdx @@ -37,16 +37,15 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| --------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `api_key` | `string` | Your API key from [Open Weather Map][owm]. Can also be set using the `POSH_OWM_API_KEY` environment variable. | -| `latitude` | `float64` | The latitude of the requested location. | -| `longitude` | `float64` | The longitude of the requested location. | -| `location` | `string` | The requested location. Formatted as \. City name, state code and country code divided by comma. Please, refer to ISO 3166 for the state codes or country codes - defaults to `DE BILT,NL` | -| `units` | `string` | Units of measurement. Available values are standard (kelvin), metric (celsius), and imperial (fahrenheit) - defaults to `standard` | -| `http_timeout` | `int` | The default timeout for http request is 20ms. | -| `cache_timeout` | `int` | The default timeout for request caching is 10m. A value of 0 disables the cache. | -| `template` | `string` | A go [text/template][go-text-template] template extended with [sprig][sprig] utilizing the properties below - defaults to `{{.Weather}} ({{.Temperature}}{{.UnitIcon}})` | +| Name | Type | Default | Description | +| --------------- | :-------: | :----------: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `api_key` | `string` | `.` | Your API key from [Open Weather Map][owm]. Can also be set using the `POSH_OWM_API_KEY` environment variable. | +| `latitude` | `float64` | `91` | The latitude of the requested location, valid between -90 and 90 | +| `longitude` | `float64` | `181` | The longitude of the requested location, valid between -180 and 180 | +| `location` | `string` | `De Bilt,NL` | The requested location interpretted only if valid coordinates aren't given. Formatted as \. City name, state code and country code divided by comma. Please, refer to ISO 3166 for the state codes or country codes | +| `units` | `string` | `standard` | Units of measurement. Available values are standard (kelvin), metric (celsius), and imperial (fahrenheit) | +| `http_timeout` | `int` | `20` | in milliseconds, the timeout for http request | +| `cache_timeout` | `int` | `10` | in minutes, the timeout for request caching. A value of 0 disables the cache. | ### Specifying Location diff --git a/website/docs/segments/path.mdx b/website/docs/segments/path.mdx index 957a83e4..92ef1515 100644 --- a/website/docs/segments/path.mdx +++ b/website/docs/segments/path.mdx @@ -30,25 +30,25 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| --------------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------- | -| `folder_separator_icon` | `string` | the symbol to use as a separator between folders - defaults to platform path separator | -| `folder_separator_template` | `string` | the [template][templates] to use as a separator between folders - defaults to `` | -| `home_icon` | `string` | the icon to display when at `$HOME` - defaults to `~` | -| `folder_icon` | `string` | the icon to use as a folder indication - defaults to `..` | -| `windows_registry_icon` | `string` | the icon to display when in the Windows registry - defaults to `\uE0B1` | -| `style` | `enum` | how to display the current path | -| `mixed_threshold` | `number` | the maximum length of a path segment that will be displayed when using `Mixed` - defaults to `4` | -| `max_depth` | `number` | maximum path depth to display before shortening when using `agnoster_short`, defaults to `1` | -| `max_width` | `number` | maximum path length to display when using `powerlevel` - defaults to `0` | -| `hide_root_location` | `boolean` | hides the root location if it doesn't fit in the last `max_depth` folders, when using `agnoster_short` - defaults to `false` | -| `cycle` | `[]string` | a list of color overrides to cycle through to colorize the individual path folders, e.g. `[ "#ffffff,#111111" ]` | -| `cycle_folder_separator` | `boolean` | colorize the `folder_separator_icon` as well when using a cycle - defaults to `false` | -| `folder_format` | `string` | format to use on individual path folders - defaults to `%s` | -| `edge_format` | `string` | format to use on the first and last folder of the path - defaults to `%s` | -| `left_format` | `string` | format to use on the firstfolder of the path - defaults to `edge_format` | -| `right_format` | `string` | format to use on the last folder of the path - defaults to `edge_format` | -| `gitdir_format` | `string` | format to use for a git root directory - defaults to `` | +| Name | Type | Default | Description | +| --------------------------- | :--------: | :--------: | ---------------------------------------------------------------------------------------------------------------- | +| `folder_separator_icon` | `string` | `/` | the symbol to use as a separator between folders | +| `folder_separator_template` | `string` | | the [template][templates] to use as a separator between folders | +| `home_icon` | `string` | `~` | the icon to display when at `$HOME` | +| `folder_icon` | `string` | `..` | the icon to use as a folder indication | +| `windows_registry_icon` | `string` | `\uF013` | the icon to display when in the Windows registry | +| `style` | `enum` | `agnoster` | how to display the current path | +| `mixed_threshold` | `number` | `4` | the maximum length of a path segment that will be displayed when using `Mixed` | +| `max_depth` | `number` | `1` | maximum path depth to display before shortening when using `agnoster_short` | +| `max_width` | `number` | `0` | maximum path length to display when using `powerlevel` | +| `hide_root_location` | `boolean` | `false` | ides the root location if it doesn't fit in the last `max_depth` folders, when using `agnoster_short` | +| `cycle` | `[]string` | | a list of color overrides to cycle through to colorize the individual path folders, e.g. `[ "#ffffff,#111111" ]` | +| `cycle_folder_separator` | `boolean` | `false` | colorize the `folder_separator_icon` as well when using a cycle | +| `folder_format` | `string` | `%s` | format to use on individual path folders | +| `edge_format` | `string` | `%s` | format to use on the first and last folder of the path | +| `left_format` | `string` | `%s` | format to use on the firstfolder of the path - defaults to `edge_format` | +| `right_format` | `string` | `%s` | format to use on the last folder of the path - defaults to `edge_format` | +| `gitdir_format` | `string` | | format to use for a git root directory | ## Mapped Locations @@ -56,10 +56,10 @@ Allows you to override a location with an icon/string. It validates if the current path **starts with the specific elements** and replaces it with the icon/string if there's a match. To avoid issues with nested overrides, Oh My Posh will sort the list of mapped locations before doing a replacement. -| Name | Type | Description | -| -------------------------- | --------- | -------------------------------------------------------------------------------------------------------- | -| `mapped_locations_enabled` | `boolean` | replace known locations in the path with the replacements before applying the style - defaults to `true` | -| `mapped_locations` | `object` | custom glyph/text for specific paths. Works regardless of the `mapped_locations_enabled` | +| Name | Type | Default | Description | +| -------------------------- | :-------: | :-----: | ---------------------------------------------------------------------------------------- | +| `mapped_locations_enabled` | `boolean` | `true` | replace known locations in the path with the replacements before applying the style | +| `mapped_locations` | `object` | | custom glyph/text for specific paths. Works regardless of the `mapped_locations_enabled` | setting. diff --git a/website/docs/segments/perl.mdx b/website/docs/segments/perl.mdx index 233486b0..ad834a2d 100644 --- a/website/docs/segments/perl.mdx +++ b/website/docs/segments/perl.mdx @@ -25,15 +25,16 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| ---------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | -| `fetch_version` | `boolean` | display the perl version - defaults to `true` | -| `missing_command_text` | `string` | text to display when the perl command is missing - defaults to empty | -| `display_mode` | `string` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when one of the following files is present (**default**):
    • `.perl-version`
    • `*.pl`
    • `*.p`
    • `*.t`
| -| `extensions` | `[]string` | allows to override the default list of file extensions to validate | -| `folders` | `[]string` | allows to override the list of folder names to validate | -| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` | +| Name | Type | Default | Description | +| ---------------------- | :--------: | :------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `home_enabled` | `boolean` | `false` | display the segment in the HOME folder or not | +| `fetch_version` | `boolean` | `true` | fetch the perl version | +| `missing_command_text` | `string` | | text to display when the command is missing | +| `display_mode` | `string` | `context` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when file `extensions` listed are present
  • `context`: displays the segment when the environment or files is active
| +| `version_url_template` | `string` | | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | +| `extensions` | `[]string` | `*.pl, *.pm, *.t, .perl-version` | allows to override the default list of file extensions to validate | +| `folders` | `[]string` | | allows to override the list of folder names to validate | +| `cache_version` | `boolean` | `false` | cache the executable's version or not | ## Template ([info][templates]) diff --git a/website/docs/segments/php.mdx b/website/docs/segments/php.mdx index 17f0792a..25371270 100644 --- a/website/docs/segments/php.mdx +++ b/website/docs/segments/php.mdx @@ -25,16 +25,16 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| ---------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | -| `fetch_version` | `boolean` | display the php version - defaults to `true` | -| `missing_command_text` | `string` | text to display when the command is missing - defaults to empty | -| `display_mode` | `string` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when one of the following files is present (**default**):
    • `*.php`
    • `composer.json`
    • `composer.lock`
    • `.php-version`
    • `blade.php`
| -| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | -| `extensions` | `[]string` | allows to override the default list of file extensions to validate | -| `folders` | `[]string` | allows to override the list of folder names to validate | -| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` | +| Name | Type | Default | Description | +| ---------------------- | :--------: | :-------------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `home_enabled` | `boolean` | `false` | display the segment in the HOME folder or not | +| `fetch_version` | `boolean` | `true` | fetch the php version | +| `missing_command_text` | `string` | | text to display when the command is missing | +| `display_mode` | `string` | `context` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when file `extensions` listed are present
  • `context`: displays the segment when the environment or files is active
| +| `version_url_template` | `string` | | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | +| `extensions` | `[]string` | `*.php, .php-version, composer.json, composer.lock` | allows to override the default list of file extensions to validate | +| `folders` | `[]string` | | allows to override the list of folder names to validate | +| `cache_version` | `boolean` | `false` | cache the executable's version or not | ## Template ([info][templates]) diff --git a/website/docs/segments/plastic.mdx b/website/docs/segments/plastic.mdx index 2c6e51b6..751bf68a 100644 --- a/website/docs/segments/plastic.mdx +++ b/website/docs/segments/plastic.mdx @@ -50,28 +50,28 @@ by leaving a like! As doing multiple `cm` calls can slow down the prompt experience, we do not fetch information by default. You can set the following property to `true` to enable fetching additional information (and populate the template). -| Name | Type | Description | -| ---------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `fetch_status` | `boolean` | fetch the local changes - defaults to `false` | -| `status_formats` | `map[string]string` | a key, value map allowing to override how individual status items are displayed. For example, `"status_formats": { "Added": "Added: %d" }` will display the added count as `Added: 1` instead of `+1`. See the [Status](#status) section for available overrides. Defaults to an empty map. | +| Name | Type | Default | Description | +| ---------------- | :-----------------: | :-----: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `fetch_status` | `boolean` | `false` | fetch the local changes | +| `status_formats` | `map[string]string` | | a key, value map allowing to override how individual status items are displayed. For example, `"status_formats": { "Added": "Added: %d" }` will display the added count as `Added: 1` instead of `+1`. See the [Status](#status) section for available overrides | ### Icons #### Branch -| Name | Type | Description | -| ------------------- | -------- | -------------------------------------------------------------------------------------------- | -| `branch_icon` | `string` | the icon to use in front of the git branch name - defaults to `\uE0A0 ` | -| `full_branch_path` | `bool` | display the full branch path: `_/main/fix-001_` instead of `_fix-001_` - defaults to `true` | -| `branch_max_length` | `int` | the max length for the displayed branch name where `0` implies full length - defaults to `0` | -| `truncate_symbol` | `string` | the icon to display when a branch name is truncated - defaults to empty | +| Name | Type | Default | Description | +| ------------------- | :------: | :------: | -------------------------------------------------------------------------- | +| `branch_icon` | `string` | `\uE0A0` | the icon to use in front of the git branch name | +| `full_branch_path` | `bool` | `true` | display the full branch path: `_/main/fix-001_` instead of `_fix-001_` | +| `branch_max_length` | `int` | `0` | the max length for the displayed branch name where `0` implies full length | +| `truncate_symbol` | `string` | | the icon to display when a branch name is truncated | #### Selector -| Name | Type | Description | -| ------------- | -------- | ------------------------------------------------------------------------------------- | -| `commit_icon` | `string` | icon/text to display before the commit context (detached HEAD) - defaults to `\uF417` | -| `tag_icon` | `string` | icon/text to display before the tag context - defaults to `\uF412` | +| Name | Type | Default | Description | +| ------------- | :------: | :------: | -------------------------------------------------------------- | +| `commit_icon` | `string` | `\uF417` | icon/text to display before the commit context (detached HEAD) | +| `tag_icon` | `string` | `\uF412` | icon/text to display before the tag context | ## Template ([info][templates]) diff --git a/website/docs/segments/project.mdx b/website/docs/segments/project.mdx index bd2ae74a..0c173076 100644 --- a/website/docs/segments/project.mdx +++ b/website/docs/segments/project.mdx @@ -37,9 +37,9 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| ---------------- | --------- | --------------------------------------------- | -| `always_enabled` | `boolean` | always show the segment - defaults to `false` | +| Name | Type | Default | Description | +| ---------------- | :-------: | :-----: | ----------------------- | +| `always_enabled` | `boolean` | `false` | always show the segment | ## Template ([info][templates]) diff --git a/website/docs/segments/pulumi.mdx b/website/docs/segments/pulumi.mdx index 0b1177dc..3b746cfc 100644 --- a/website/docs/segments/pulumi.mdx +++ b/website/docs/segments/pulumi.mdx @@ -31,7 +31,7 @@ import Config from "@site/src/components/Config.js"; ## Properties | Name | Type | Default | Description | -| ------------- | --------- | ------- | ---------------------------------------------------------------------------------- | +| ------------- | :-------: | :-----: | ---------------------------------------------------------------------------------- | | `fetch_stack` | `boolean` | `false` | fetch the current stack name | | `fetch_about` | `boolean` | `false` | fetch the URL and user for the current stask. Requires `fetch_stack` set to `true` | diff --git a/website/docs/segments/python.mdx b/website/docs/segments/python.mdx index 3e5a706f..2d78dc82 100644 --- a/website/docs/segments/python.mdx +++ b/website/docs/segments/python.mdx @@ -26,19 +26,19 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| ---------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | -| `fetch_virtual_env` | `boolean` | fetch the name of the virtualenv or not - defaults to `true` | -| `display_default` | `boolean` | show the name of the virtualenv when it's default (`system`, `base`) or not - defaults to `true` | -| `fetch_version` | `boolean` | fetch the python version - defaults to `true` | -| `missing_command_text` | `string` | text to display when the command is missing - defaults to empty | -| `display_mode` | `string` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when one of the following files is present:
    • `*.py`
    • `*.ipynb`
    • `pyproject.toml`
    • `venv.bak`
    • `venv`
    • `.venv`
  • `environment`: the segment is only displayed when a virtual env is present (**default**)
  • `context`: the segment is only displayed when either `environment` or `files` is active
| -| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | -| `extensions` | `[]string` | allows to override the default list of file extensions to validate | -| `folders` | `[]string` | allows to override the list of folder names to validate | -| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` | -| `folder_name_fallback` | `boolean` | instead of `venv` or `.venv` (case sensitive), use the parent folder name as the virtual environment's name or not - defaults to `true` | +| Name | Type | Default | Description | +| ---------------------- | :--------: | :---------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `home_enabled` | `boolean` | `false` | display the segment in the HOME folder or not | +| `fetch_virtual_env` | `boolean` | `true` | fetch the name of the virtualenv or not | +| `display_default` | `boolean` | `true` | show the name of the virtualenv when it's default (`system`, `base`) or not | +| `fetch_version` | `boolean` | `true` | fetch the python version | +| `missing_command_text` | `string` | | text to display when the command is missing | +| `display_mode` | `string` | `context` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when file `extensions` listed are present
  • `context`: displays the segment when the environment or files is active
| +| `version_url_template` | `string` | | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | +| `extensions` | `[]string` | `*.py, *.ipynb, pyproject.toml, venv.bak` | allows to override the default list of file extensions to validate | +| `folders` | `[]string` | | allows to override the list of folder names to validate | +| `cache_version` | `boolean` | `false` | cache the executable's version or not | +| `folder_name_fallback` | `boolean` | `true` | instead of `venv` or `.venv` (case sensitive), use the parent folder name as the virtual environment's name or not | ## Template ([info][templates]) diff --git a/website/docs/segments/quasar.mdx b/website/docs/segments/quasar.mdx index 5b287646..ace5900b 100644 --- a/website/docs/segments/quasar.mdx +++ b/website/docs/segments/quasar.mdx @@ -26,16 +26,17 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| ---------------------- | ---------- | --------------------------------------------------------------------------------------------------------------------- | -| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | -| `missing_command_text` | `string` | text to display when the command is missing - defaults to empty | -| `fetch_version` | `boolean` | fetch the NPM version - defaults to `true` | -| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | -| `fetch_dependencies` | `boolean` | fetch the version number of the `vite` and `@quasar/app-vite` dependencies if present - defaults to `false` | -| `extensions` | `[]string` | allows to override the default list of file extensions to validate | -| `folders` | `[]string` | allows to override the list of folder names to validate | -| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` | +| Name | Type | Default | Description | +| ---------------------- | :--------: | :-------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `home_enabled` | `boolean` | `false` | display the segment in the HOME folder or not | +| `missing_command_text` | `string` | | text to display when the command is missing | +| `fetch_version` | `boolean` | `true` | fetch the NPM version | +| `display_mode` | `string` | `context` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when file `extensions` listed are present
  • `context`: displays the segment when the environment or files is active
| +| `version_url_template` | `string` | | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | +| `fetch_dependencies` | `boolean` | `false` | fetch the version number of the `vite` and `@quasar/app-vite` dependencies if present | +| `extensions` | `[]string` | `quasar.config, quasar.config.js` | allows to override the default list of file extensions to validate | +| `folders` | `[]string` | | allows to override the list of folder names to validate | +| `cache_version` | `boolean` | `false` | cache the executable's version or not | ## Template ([info][templates]) diff --git a/website/docs/segments/r.mdx b/website/docs/segments/r.mdx index 475d19c5..c2448263 100644 --- a/website/docs/segments/r.mdx +++ b/website/docs/segments/r.mdx @@ -25,16 +25,16 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| ---------------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | -| `fetch_version` | `boolean` | display the R version - defaults to `true` | -| `missing_command_text` | `string` | text to display when the command is missing - defaults to empty | -| `display_mode` | `string` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when one of the following files is present (**default**):
    • `*.R`
    • `*.Rmd`
    • `*.Rsx`
    • `*.Rda`
    • `*.Rd`
    • `*.Rproj`
    • `.Rproj.user`
| -| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | -| `extensions` | `[]string` | allows to override the default list of file extensions to validate | -| `folders` | `[]string` | allows to override the list of folder names to validate | -| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` | +| Name | Type | Default | Description | +| ---------------------- | :--------: | :----------------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `home_enabled` | `boolean` | `false` | display the segment in the HOME folder or not | +| `fetch_version` | `boolean` | `true` | fetch the R version or not | +| `missing_command_text` | `string` | | text to display when the command is missing | +| `display_mode` | `string` | `context` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when file `extensions` listed are present
  • `context`: displays the segment when the environment or files is active
| +| `version_url_template` | `string` | | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | +| `extensions` | `[]string` | `*.R, *.Rmd, *.Rsx, *.Rda, *.Rd, *.Rproj, .Rproj.user` | allows to override the default list of file extensions to validate | +| `folders` | `[]string` | | allows to override the list of folder names to validate | +| `cache_version` | `boolean` | `false` | cache the executable's version or not | ## Template ([info][templates]) diff --git a/website/docs/segments/react.mdx b/website/docs/segments/react.mdx index 11730b41..3a2f8893 100644 --- a/website/docs/segments/react.mdx +++ b/website/docs/segments/react.mdx @@ -24,15 +24,16 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| ---------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | -| `fetch_version` | `boolean` | fetch the active version or not; useful if all you need is an icon indicating `ng` | -| `display_mode` | `string` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when `package.json` file is present (**default**)
| -| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | -| `extensions` | `[]string` | allows to override the default list of file extensions to validate | -| `folders` | `[]string` | allows to override the list of folder names to validate | -| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` | +| Name | Type | Default | Description | +| ---------------------- | :--------: | :------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `home_enabled` | `boolean` | `false` | display the segment in the HOME folder or not | +| `fetch_version` | `boolean` | `true` | fetch the react version | +| `missing_command_text` | `string` | | text to display when the command is missing | +| `display_mode` | `string` | `context` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when file `extensions` listed are present
  • `context`: displays the segment when the environment or files is active
| +| `version_url_template` | `string` | | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | +| `extensions` | `[]string` | `package.json` | allows to override the default list of file extensions to validate | +| `folders` | `[]string` | | allows to override the list of folder names to validate | +| `cache_version` | `boolean` | `false` | cache the executable's version or not | ## Template ([info][templates]) diff --git a/website/docs/segments/ruby.mdx b/website/docs/segments/ruby.mdx index 8bc71906..e1bfb810 100644 --- a/website/docs/segments/ruby.mdx +++ b/website/docs/segments/ruby.mdx @@ -25,15 +25,16 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| ---------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | -| `fetch_version` | `boolean` | display the ruby version - defaults to `true` | -| `missing_command_text` | `string` | text to display when the command is missing - defaults to empty | -| `display_mode` | `string` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when `*.rb`, `Gemfile` or `Rakefile` files are present (**default**)
| -| `extensions` | `[]string` | allows to override the default list of file extensions to validate | -| `folders` | `[]string` | allows to override the list of folder names to validate | -| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` | +| Name | Type | Default | Description | +| ---------------------- | :--------: | :-----------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `home_enabled` | `boolean` | `false` | display the segment in the HOME folder or not | +| `fetch_version` | `boolean` | `true` | fetch the ruby version | +| `missing_command_text` | `string` | | text to display when the command is missing | +| `display_mode` | `string` | `context` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when file `extensions` listed are present
  • `context`: displays the segment when the environment or files is active
| +| `version_url_template` | `string` | | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | +| `extensions` | `[]string` | `*.rb, Rakefile, Gemfile` | allows to override the default list of file extensions to validate | +| `folders` | `[]string` | | allows to override the list of folder names to validate | +| `cache_version` | `boolean` | `false` | cache the executable's version or not | ## Template ([info][templates]) @@ -52,4 +53,5 @@ import Config from "@site/src/components/Config.js"; | `.Full` | `string` | the full version | | `.Error` | `string` | error encountered when fetching the version string | +[go-text-template]: https://golang.org/pkg/text/template/ [templates]: /docs/configuration/templates diff --git a/website/docs/segments/rust.mdx b/website/docs/segments/rust.mdx index e9448441..c0ae724c 100644 --- a/website/docs/segments/rust.mdx +++ b/website/docs/segments/rust.mdx @@ -25,15 +25,16 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| ---------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | -| `fetch_version` | `boolean` | display the rust version (`rustc --version`) - defaults to `true` | -| `missing_command_text` | `string` | text to display when the command is missing - defaults to empty | -| `display_mode` | `string` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when `*.rs`, `Cargo.toml` or `Cargo.lock` files are present (**default**)
| -| `extensions` | `[]string` | allows to override the default list of file extensions to validate | -| `folders` | `[]string` | allows to override the list of folder names to validate | -| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` | +| Name | Type | Default | Description | +| ---------------------- | :--------: | :----------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `home_enabled` | `boolean` | `false` | display the segment in the HOME folder or not | +| `fetch_version` | `boolean` | `true` | fetch the rust version (`rustc --version`) | +| `missing_command_text` | `string` | | text to display when the command is missing | +| `display_mode` | `string` | `context` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when file `extensions` listed are present
  • `context`: displays the segment when the environment or files is active
| +| `version_url_template` | `string` | | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | +| `extensions` | `[]string` | `*.rs, Cargo.toml, Cargo.lock` | allows to override the default list of file extensions to validate | +| `folders` | `[]string` | | allows to override the list of folder names to validate | +| `cache_version` | `boolean` | `false` | cache the executable's version or not | ## Template ([info][templates]) @@ -56,4 +57,5 @@ import Config from "@site/src/components/Config.js"; | `.Prerelease` | `string` | channel name | | `.Error` | `string` | error encountered when fetching the version string | +[go-text-template]: https://golang.org/pkg/text/template/ [templates]: /docs/configuration/templates diff --git a/website/docs/segments/sapling.mdx b/website/docs/segments/sapling.mdx index abcd96c5..b4f6fea2 100644 --- a/website/docs/segments/sapling.mdx +++ b/website/docs/segments/sapling.mdx @@ -30,11 +30,11 @@ import Config from "@site/src/components/Config.js"; ### Fetching information -| Name | Type | Description | -| ----------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `fetch_status` | `boolean` | fetch the local changes - defaults to `true` | -| `native_fallback` | `boolean` | when set to `true` and `sl.exe` is not available when inside a WSL2 shared Windows drive, we will fallback to the native sapling executable to fetch data. Not all information can be displayed in this case. Defaults to `false` | -| `status_formats` | `map[string]string` | a key, value map allowing to override how individual status items are displayed. For example, `"status_formats": { "Added": "Added: %d" }` will display the added count as `Added: 1` instead of `+1`. See the [Status](#status) section for available overrides. Defaults to an empty map. | +| Name | Type | Default | Description | +| ------------------- | :-----------------: | :-----: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `fetch_status` | `boolean` | `true` | fetch the local changes - defaults to | +| `native_fallback` | `boolean` | `false` | when set to `true` and `sl.exe` is not available when inside a WSL2 shared Windows drive, we will fallback to the native sapling executable to fetch data. Not all information can be displayed in this case | +| `status_formats` | `map[string]string` | | a key, value map allowing to override how individual status items are displayed. For example, `"status_formats": { "Added": "Added: %d" }` will display the added count as `Added: 1` instead of `+1`. See the [Status](#status) section for available overrides | ## Template ([info][templates]) diff --git a/website/docs/segments/shell.mdx b/website/docs/segments/shell.mdx index a6d3ab51..8becb494 100644 --- a/website/docs/segments/shell.mdx +++ b/website/docs/segments/shell.mdx @@ -27,7 +27,9 @@ import Config from '@site/src/components/Config.js'; ## Properties -|`mapped_shell_names`|`object`|custom glyph/text to use in place of specified shell names (case-insensitive)| +| Name | Type | Default | Description | +| -------------------- | :------: | :-----: | ----------------------------------------------------------------------------- | +| `mapped_shell_names` | `object` | | custom glyph/text to use in place of specified shell names (case-insensitive) | ## Template ([info][templates]) diff --git a/website/docs/segments/sitecore.mdx b/website/docs/segments/sitecore.mdx index 7d399ada..5e57edc2 100644 --- a/website/docs/segments/sitecore.mdx +++ b/website/docs/segments/sitecore.mdx @@ -22,9 +22,9 @@ Display current Sitecore environment. Will not be active when sitecore.json and ## Properties -| Name | Type | Description | -| ----------------- | --------- | -------------------------------------------------------------------------------------------------- | -| `display_default` | `boolean` | display the segment or not when the Sitecore environment name matches `default` - defaults to true | +| Name | Type | Default | Description | +| ----------------- | :-------: | :-----: | ------------------------------------------------------------------------------- | +| `display_default` | `boolean` | `true` | display the segment or not when the Sitecore environment name matches `default` | ## Template ([info][templates]) diff --git a/website/docs/segments/spotify.mdx b/website/docs/segments/spotify.mdx index d6dd288e..102e2aa0 100644 --- a/website/docs/segments/spotify.mdx +++ b/website/docs/segments/spotify.mdx @@ -36,11 +36,11 @@ import Config from '@site/src/components/Config.js'; ## Properties -| Name | Type | Description | -| -------------- | -------- | ------------------------------------------------------ | -| `playing_icon` | `string` | text/icon to show when playing - defaults to `\uE602 ` | -| `paused_icon` | `string` | text/icon to show when paused - defaults to `\uF8E3 ` | -| `stopped_icon` | `string` | text/icon to show when stopped - defaults to `\uF04D ` | +| Name | Type | Default | Description | +| -------------- | :------: | :-------: | ------------------------------ | +| `playing_icon` | `string` | `\uE602 ` | text/icon to show when playing | +| `paused_icon` | `string` | `\uF8E3 ` | text/icon to show when paused | +| `stopped_icon` | `string` | `\uF04D` | text/icon to show when stopped | ## Template ([info][templates]) diff --git a/website/docs/segments/status.mdx b/website/docs/segments/status.mdx index 63af2a08..6ec36e22 100644 --- a/website/docs/segments/status.mdx +++ b/website/docs/segments/status.mdx @@ -29,11 +29,11 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| ------------------ | --------- | ---------------------------------------------------------------------------------------------------- | -| `always_enabled` | `boolean` | always show the status - defaults to `false` | -| `status_template` | `string` | [template][status-template] used to render an individual status code - defaults to `{{ .Code }}` | -| `status_separator` | `string` | used to separate multiple statuses when `$PIPESTATUS` is available - defaults to | | +| Name | Type | Default | Description | +| ------------------ | :-------: | :-----------: | -------------------------------------------------------------------- | +| `always_enabled` | `boolean` | `false` | always show the status | +| `status_template` | `string` | `{{ .Code }}` | [template][status-template] used to render an individual status code | +| `status_separator` | `string` | `\|` | used to separate multiple statuses when `$PIPESTATUS` is available | [colors]: /docs/configuration/colors diff --git a/website/docs/segments/strava.mdx b/website/docs/segments/strava.mdx index 8d4097b5..b73d466d 100644 --- a/website/docs/segments/strava.mdx +++ b/website/docs/segments/strava.mdx @@ -58,18 +58,18 @@ import Config from '@site/src/components/Config.js'; ## Properties -| Name | Type | Description | -| ----------------------- | -------- | --------------------------------------------------------------------------------------------------------------- | -| `access_token` | `string` | token from Strava login, see login link in section above. | -| `refresh_token` | `string` | token from Strava login, see login link in section above. | -| `expires_in` | `int` | the default timeout of the token from the Strava login | -| `http_timeout` | `int` | how long do you want to wait before you want to see your prompt more than your strava data? - defaults to 500ms | -| `cache_timeout` | `int` | in minutes - How long do you want your Strava data cached? - defaults to 5 min | -| `ride_icon` | `string` | defaults to `\uf206` | -| `run_icon` | `string` | defaults to `\ue213` | -| `skiing_icon` | `string` | defaults to `\ue213` | -| `workout_icon` | `string` | defaults to `\ue213` | -| `unknown_activity_icon` | `string` | defaults to `\ue213` | +| Name | Type | Default | Description | +| ----------------------- | :------: | :------: | ------------------------------------------------------------------------------------------------------------- | +| `access_token` | `string` | | token from Strava login, see login link in section above. | +| `refresh_token` | `string` | | token from Strava login, see login link in section above. | +| `expires_in` | `int` | `0` | the default timeout of the token from the Strava login | +| `http_timeout` | `int` | `500` | in milliseconds - how long do you want to wait before you want to see your prompt more than your strava data? | +| `cache_timeout` | `int` | `5` | in minutes - How long do you want your Strava data cached? | +| `ride_icon` | `string` | `\uf206` | | +| `run_icon` | `string` | `\ue213` | | +| `skiing_icon` | `string` | `\ue213` | | +| `workout_icon` | `string` | `\ue213` | | +| `unknown_activity_icon` | `string` | `\ue213` | | ## Template ([info][templates]) diff --git a/website/docs/segments/svn.mdx b/website/docs/segments/svn.mdx index 2ea35899..3d80b88e 100644 --- a/website/docs/segments/svn.mdx +++ b/website/docs/segments/svn.mdx @@ -33,11 +33,11 @@ import Config from "@site/src/components/Config.js"; As doing multiple [subversion][svn] calls can slow down the prompt experience, we do not fetch information by default. You can set the following properties to `true` to enable fetching additional information (and populate the template). -| Name | Type | Description | -| ----------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `fetch_status` | `boolean` | fetch the local changes - defaults to `false` | -| `native_fallback` | `boolean` | when set to `true` and `svn.exe` is not available when inside a WSL2 shared Windows drive, we will fallback to the native svn executable to fetch data. Not all information can be displayed in this case. Defaults to `false`. | -| `status_formats` | `map[string]string` | a key, value map allowing to override how individual status items are displayed. For example, `"status_formats": { "Added": "Added: %d" }` will display the added count as `Added: 1` instead of `+1`. See the [Status](#status) section for available overrides. Defaults to an empty map. | +| Name | Type | Default | Description | +| ------------------- | :-----------------: | :-----: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `fetch_status` | `boolean` | `false` | fetch the local changes | +| `native_fallback` | `boolean` | `false` | when set to `true` and `svn.exe` is not available when inside a WSL2 shared Windows drive, we will fallback to the native svn executable to fetch data. Not all information can be displayed in this case | +| `status_formats` | `map[string]string` | | a key, value map allowing to override how individual status items are displayed. For example, `"status_formats": { "Added": "Added: %d" }` will display the added count as `Added: 1` instead of `+1`. See the [Status](#status) section for available overrides | ## Template ([info][templates]) diff --git a/website/docs/segments/swift.mdx b/website/docs/segments/swift.mdx index cc3a4607..370d0c5a 100644 --- a/website/docs/segments/swift.mdx +++ b/website/docs/segments/swift.mdx @@ -25,16 +25,16 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| ---------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | -| `fetch_version` | `boolean` | display the swift version - defaults to `true` | -| `missing_command_text` | `string` | text to display when the command is missing - defaults to empty | -| `display_mode` | `string` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when `*.swift` or `*.SWIFT` files are present (**default**)
| -| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | -| `extensions` | `[]string` | allows to override the default list of file extensions to validate | -| `folders` | `[]string` | allows to override the list of folder names to validate | -| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` | +| Name | Type | Default | Description | +| ---------------------- | :--------: | :----------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `home_enabled` | `boolean` | `false` | display the segment in the HOME folder or not | +| `fetch_version` | `boolean` | `true` | fetch the swift version | +| `missing_command_text` | `string` | | text to display when the command is missing | +| `display_mode` | `string` | `context` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when file `extensions` listed are present
  • `context`: displays the segment when the environment or files is active
| +| `version_url_template` | `string` | | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | +| `extensions` | `[]string` | `*.swift, *.SWIFT` | allows to override the default list of file extensions to validate | +| `folders` | `[]string` | | allows to override the list of folder names to validate | +| `cache_version` | `boolean` | `false` | cache the executable's version or not | ## Template ([info][templates]) diff --git a/website/docs/segments/sysinfo.mdx b/website/docs/segments/sysinfo.mdx index 29e8eeaf..f191af60 100644 --- a/website/docs/segments/sysinfo.mdx +++ b/website/docs/segments/sysinfo.mdx @@ -26,9 +26,9 @@ import Config from '@site/src/components/Config.js'; ## Properties -| Name | Type | Description | -| ----------- | ----- | ------------------------------------------------------- | -| `Precision` | `int` | The precision used for any float values - defaults to 2 | +| Name | Type | Default | Description | +| ----------- | :---: | :-----: | --------------------------------------- | +| `Precision` | `int` | `2` | The precision used for any float values | ## Template ([info][templates]) diff --git a/website/docs/segments/terraform.mdx b/website/docs/segments/terraform.mdx index 363097fd..d3cfeebc 100644 --- a/website/docs/segments/terraform.mdx +++ b/website/docs/segments/terraform.mdx @@ -27,9 +27,9 @@ import Config from '@site/src/components/Config.js'; ## Properties -| Name | Type | Description | -| --------------- | --------- | -------------------------------------------------------------------------------------------------------- | -| `fetch_version` | `boolean` | fetch the version information from `versions.tf`, `main.tf` or `terraform.tfstate` - defaults to `false` | +| Name | Type | Default | Description | +| --------------- | :-------: | :-----: | ---------------------------------------------------------------------------------- | +| `fetch_version` | `boolean` | `false` | fetch the version information from `versions.tf`, `main.tf` or `terraform.tfstate` | ## Template ([info][templates]) diff --git a/website/docs/segments/time.mdx b/website/docs/segments/time.mdx index 5d92c751..83c1cb31 100644 --- a/website/docs/segments/time.mdx +++ b/website/docs/segments/time.mdx @@ -23,9 +23,9 @@ import Config from '@site/src/components/Config.js'; ## Properties -| Name | Type | Description | -| ------------- | -------- | ----------------------------------------------------------------------------- | -| `time_format` | `string` | format to use, follows the [golang standard][format] - defaults to `15:04:05` | +| Name | Type | Default | Description | +| ------------- | :------: | :--------: | ---------------------------------------------------- | +| `time_format` | `string` | `15:04:05` | format to use, follows the [golang standard][format] | ## Template ([info][templates]) diff --git a/website/docs/segments/ui5tooling.mdx b/website/docs/segments/ui5tooling.mdx index 273a2076..cb74a2a0 100644 --- a/website/docs/segments/ui5tooling.mdx +++ b/website/docs/segments/ui5tooling.mdx @@ -26,16 +26,16 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| ---------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | -| `fetch_version` | `boolean` | display the UI5 tooling version - defaults to `true` | -| `missing_command_text` | `string` | text to display when the java command is missing - defaults to empty | -| `display_mode` | `string` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when `*ui5*.y(a)ml` file is present in the current folder
  • `context`: the segment is only displayed when `*ui5*.y(a)ml` file is present in the current folder or it has been found in the parent folders (check up to 4 levels) (**default**)
| -| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | -| `extensions` | `[]string` | allows to override the default list of file extensions to validate | -| `folders` | `[]string` | allows to override the list of folder names to validate | -| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` | +| Name | Type | Default | Description | +| ---------------------- | :--------: | :----------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `home_enabled` | `boolean` | `false` | display the segment in the HOME folder or not | +| `fetch_version` | `boolean` | `true` | fetch the ui5tooling version | +| `missing_command_text` | `string` | | text to display when the command is missing | +| `display_mode` | `string` | `context` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when file `extensions` listed are present
  • `context`: displays the segment when the environment or files is active
| +| `version_url_template` | `string` | | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | +| `extensions` | `[]string` | `*ui5*.y*ml` | allows to override the default list of file extensions to validate | +| `folders` | `[]string` | | allows to override the list of folder names to validate | +| `cache_version` | `boolean` | `false` | cache the executable's version or not | ## Template ([info][templates]) diff --git a/website/docs/segments/unity.mdx b/website/docs/segments/unity.mdx index f61568d7..742c8256 100644 --- a/website/docs/segments/unity.mdx +++ b/website/docs/segments/unity.mdx @@ -36,9 +36,9 @@ import Config from '@site/src/components/Config.js'; ## Properties -| Name | Type | Description | -| --------------- | -------- | ----------------------------------------------- | -| `http_timeout` | `int` | The default timeout for http request is 2000ms. | +| Name | Type | Default | Description | +| -------------- | :---: | :-----: | ---------------------------------------------- | +| `http_timeout` | `int` | `2000` | in milliseconds - the timeout for http request | ## Template ([info][templates]) diff --git a/website/docs/segments/upgrade.mdx b/website/docs/segments/upgrade.mdx index ef24b6fb..749a7eb9 100644 --- a/website/docs/segments/upgrade.mdx +++ b/website/docs/segments/upgrade.mdx @@ -23,9 +23,9 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| --------------- | ----- | --------------------------------------------------------------------------------------------- | -| `cache_timeout` | `int` | in minutes - How long to wait before checking for a new version. Default is 10080 (one week). | +| Name | Type | Default | Description | +| --------------- | :---: | :-----: | ------------------------------------------------------------------------------------- | +| `cache_timeout` | `int` | `10080` | in minutes - how long to wait before checking for a new version. Default is one week. | ## Template ([info][templates]) diff --git a/website/docs/segments/vala.mdx b/website/docs/segments/vala.mdx index 248cc10c..c8812c6b 100644 --- a/website/docs/segments/vala.mdx +++ b/website/docs/segments/vala.mdx @@ -25,16 +25,16 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| ---------------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | -| `fetch_version` | `boolean` | fetch the flutter version - defaults to `true` | -| `missing_command_text` | `string` | text to display when the command is missing - defaults to empty | -| `display_mode` | `string` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when `*.vala` files are present (**default**)
| -| `version_url_template` | `string` | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | -| `extensions` | `[]string` | allows to override the default list of file extensions to validate | -| `folders` | `[]string` | allows to override the list of folder names to validate | -| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` | +| Name | Type | Default | Description | +| ---------------------- | :--------: | :-------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `home_enabled` | `boolean` | `false` | display the segment in the HOME folder or not | +| `fetch_version` | `boolean` | `true` | fetch the vala version | +| `missing_command_text` | `string` | | text to display when the command is missing | +| `display_mode` | `string` | `context` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when file `extensions` listed are present
  • `context`: displays the segment when the environment or files is active
| +| `version_url_template` | `string` | | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | +| `extensions` | `[]string` | `*.vala` | allows to override the default list of file extensions to validate | +| `folders` | `[]string` | | allows to override the list of folder names to validate | +| `cache_version` | `boolean` | `false` | cache the executable's version or not | ## Template ([info][templates]) diff --git a/website/docs/segments/wakatime.mdx b/website/docs/segments/wakatime.mdx index d2b88314..e373991b 100644 --- a/website/docs/segments/wakatime.mdx +++ b/website/docs/segments/wakatime.mdx @@ -32,11 +32,11 @@ import Config from '@site/src/components/Config.js'; ## Properties -| Name | Type | Description | -| --------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `url` | `string` | The Wakatime [summaries][wk-summaries] URL, including the API key. Example above. Defaults to ``. | -| `http_timeout` | `int` | The time (_in milliseconds_, `ms`) it takes to consider an http request as **timed-out**. Defaults to `20`. If no segment is shown, try increasing this timeout. | -| `cache_timeout` | `int` | The time (_in minutes_, `m`) it takes to invalidate/renew the Wakatime segment output. Defaults to `10`. Setting this to `0` disables the cache and requests to the API everytime the user presses the Enter key. | +| Name | Type | Default | Description | +| --------------- | :-------: | :-----: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `url` | `string` | | The Wakatime [summaries][wk-summaries] URL, including the API key. Example above. | +| `http_timeout` | `int` | `20` | The time (_in milliseconds_, `ms`) it takes to consider an http request as **timed-out**. If no segment is shown, try increasing this timeout. | +| `cache_timeout` | `int` | `10` | The time (_in minutes_, `m`) it takes to invalidate/renew the Wakatime segment output. Setting this to `0` disables the cache and requests to the API everytime the user presses the Enter key. | ### Dynamic API Key diff --git a/website/docs/segments/winreg.mdx b/website/docs/segments/winreg.mdx index efdfe8bf..c3bec5f4 100644 --- a/website/docs/segments/winreg.mdx +++ b/website/docs/segments/winreg.mdx @@ -35,10 +35,10 @@ import Config from '@site/src/components/Config.js'; ## Properties -| Name | Type | Description | -| ---------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | -| `path` | `string` | registry path to the desired key using backslashes and with a valid root HKEY name. Ending path with \ will get the (Default) key from that path | -| `fallback` | `string` | the value to fall back to if no entry is found | +| Name | Type | Default | Description | +| ---------- | :------: | :-----: | ------------------------------------------------------------------------------------------------------------------------------------------------ | +| `path` | `string` | | registry path to the desired key using backslashes and with a valid root HKEY name. Ending path with \ will get the (Default) key from that path | +| `fallback` | `string` | | the value to fall back to if no entry is found | ## Template ([info][templates]) diff --git a/website/docs/segments/withings.mdx b/website/docs/segments/withings.mdx index 23e78ace..2186e371 100644 --- a/website/docs/segments/withings.mdx +++ b/website/docs/segments/withings.mdx @@ -44,13 +44,13 @@ import Config from '@site/src/components/Config.js'; ## Properties -| Name | Type | Description | -| ---------------- | -------- | ----------------------------------------------------------------------------------------------------------------- | -| `access_token` | `string` | token from Withings login, see login link in section above. | -| `refresh_token` | `string` | token from Withings login, see login link in section above. | -| `expires_in` | `int` | the default timeout of the token from the Withings login | -| `http_timeout` | `int` | how long do you want to wait before you want to see your prompt more than your Withings data? - defaults to 500ms | -| `cache_timeout` | `int` | in minutes - How long do you want your Withings data cached? - defaults to 5 min | +| Name | Type | Default | Description | +| ---------------- | :------: | :-----: | --------------------------------------------------------------------------------------------- | +| `access_token` | `string` | | token from Withings login, see login link in section above. | +| `refresh_token` | `string` | | token from Withings login, see login link in section above. | +| `expires_in` | `int` | `0` | the default timeout of the token from the Withings login | +| `http_timeout` | `int` | `500` | how long do you want to wait before you want to see your prompt more than your Withings data? | +| `cache_timeout` | `int` | `5` | in minutes - How long do you want your Withings data cached? | ## Template ([info][templates]) diff --git a/website/docs/segments/xmake.mdx b/website/docs/segments/xmake.mdx index d6c96280..deba166f 100644 --- a/website/docs/segments/xmake.mdx +++ b/website/docs/segments/xmake.mdx @@ -25,15 +25,16 @@ import Config from "@site/src/components/Config.js"; ## Properties -| Name | Type | Description | -| ---------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `home_enabled` | `boolean` | display the segment in the HOME folder or not - defaults to `false` | -| `fetch_version` | `boolean` | display the xmake version (`xmake --version`) - defaults to `true` | -| `missing_command_text` | `string` | text to display when the command is missing - defaults to empty | -| `display_mode` | `string` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when a `xmake.lua` file is present (**default**)
| -| `extensions` | `[]string` | allows to override the default list of file extensions to validate | -| `folders` | `[]string` | allows to override the list of folder names to validate | -| `cache_version` | `boolean` | cache the executable's version or not - defaults to `false` | +| Name | Type | Default | Description | +| ---------------------- | :--------: | :---------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `home_enabled` | `boolean` | `false` | display the segment in the HOME folder or not | +| `fetch_version` | `boolean` | `true` | fetch the xmake version | +| `missing_command_text` | `string` | | text to display when the command is missing | +| `display_mode` | `string` | `context` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when file `extensions` listed are present
  • `context`: displays the segment when the environment or files is active
| +| `version_url_template` | `string` | | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes | +| `extensions` | `[]string` | `xmake.lua` | allows to override the default list of file extensions to validate | +| `folders` | `[]string` | | allows to override the list of folder names to validate | +| `cache_version` | `boolean` | `false` | cache the executable's version or not | ## Template ([into][templates]) @@ -55,4 +56,5 @@ import Config from "@site/src/components/Config.js"; | `.Patch` | `string` | patch number | | `.Error` | `string` | error encountered when fetching the version string | -[templates]: /docs/configuration/templates +[go-text-template]: https://golang.org/pkg/text/template/ +[templates]: configuration/templates.mdx diff --git a/website/docs/segments/ytm.mdx b/website/docs/segments/ytm.mdx index 3a53e889..84b19a31 100644 --- a/website/docs/segments/ytm.mdx +++ b/website/docs/segments/ytm.mdx @@ -32,12 +32,12 @@ import Config from '@site/src/components/Config.js'; ## Properties -| Name | Type | Description | -| -------------- | -------- | --------------------------------------------------------------------- | -| `playing_icon` | `string` | text/icon to show when playing - defaults to `\uE602 ` | -| `paused_icon` | `string` | text/icon to show when paused - defaults to `\uF8E3 ` | -| `stopped_icon` | `string` | text/icon to show when paused - defaults to `\uF04D ` | -| `api_url` | `string` | the YTMDA Remote Control API URL- defaults to `http://127.0.0.1:9863` | +| Name | Type | Default | Description | +| -------------- | :------: | :----------------------: | -------------------------------- | +| `playing_icon` | `string` | `\uE602 ` | text/icon to show when playing | +| `paused_icon` | `string` | `\uF8E3 ` | text/icon to show when paused | +| `stopped_icon` | `string` | `\uF04D ` | text/icon to show when stopped | +| `api_url` | `string` | `http://127.0.0.1:13091` | the YTMDA Remote Control API URL | ## Template ([info][templates]) From c3b94d27117aa8a6a03f0ad88cd3a2f07f46a835 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 17 Apr 2024 11:24:34 +0000 Subject: [PATCH 074/157] docs: update website/docs/contributors.md [skip ci] --- website/docs/contributors.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/contributors.md b/website/docs/contributors.md index 097592e2..0452216a 100644 --- a/website/docs/contributors.md +++ b/website/docs/contributors.md @@ -332,7 +332,7 @@ Thanks goes to these wonderful people ([emoji key][acek]): Shravan Asati
Shravan Asati

🎨 Luca Zecca
Luca Zecca

💻 🎨 📖 Joshua Reilly
Joshua Reilly

💻 📖 - Ivan
Ivan

🎨 + Ivan
Ivan

🎨 📖 mountcount
mountcount

📖 From a9966f5ae99df15685d6943902ff96687d2aa1ae Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 17 Apr 2024 11:24:35 +0000 Subject: [PATCH 075/157] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index bbdd4647..ed80add4 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2336,7 +2336,8 @@ "avatar_url": "https://avatars.githubusercontent.com/u/56458442?v=4", "profile": "https://ivan-the-terrible.github.io/", "contributions": [ - "design" + "design", + "doc" ] }, { From 7fc2b70fb3641eaf9df0f41b70559eab28c17ddc Mon Sep 17 00:00:00 2001 From: ivan-the-terrible Date: Mon, 15 Apr 2024 20:57:05 +0000 Subject: [PATCH 076/157] feat(segment): firebase segment --- src/engine/segment.go | 3 + src/segments/firebase.go | 83 ++++++++++++++++++++++ src/segments/firebase_test.go | 107 +++++++++++++++++++++++++++++ themes/cloud-context.omp.json | 9 +++ themes/schema.json | 54 ++++++--------- website/docs/segments/firebase.mdx | 44 ++++++++++++ website/sidebars.js | 1 + 7 files changed, 269 insertions(+), 32 deletions(-) create mode 100644 src/segments/firebase.go create mode 100644 src/segments/firebase_test.go create mode 100644 website/docs/segments/firebase.mdx diff --git a/src/engine/segment.go b/src/engine/segment.go index dd263b72..7be2413e 100644 --- a/src/engine/segment.go +++ b/src/engine/segment.go @@ -146,6 +146,8 @@ const ( FOSSIL SegmentType = "fossil" // GCP writes the active GCP context GCP SegmentType = "gcp" + // FIREBASE writes the active firebase project + FIREBASE SegmentType = "firebase" // GIT represents the git status and information GIT SegmentType = "git" // GITVERSION represents the gitversion information @@ -296,6 +298,7 @@ var Segments = map[SegmentType]func() SegmentWriter{ FLUTTER: func() SegmentWriter { return &segments.Flutter{} }, FOSSIL: func() SegmentWriter { return &segments.Fossil{} }, GCP: func() SegmentWriter { return &segments.Gcp{} }, + FIREBASE: func() SegmentWriter { return &segments.Firebase{} }, GIT: func() SegmentWriter { return &segments.Git{} }, GITVERSION: func() SegmentWriter { return &segments.GitVersion{} }, GOLANG: func() SegmentWriter { return &segments.Golang{} }, diff --git a/src/segments/firebase.go b/src/segments/firebase.go new file mode 100644 index 00000000..9b989d40 --- /dev/null +++ b/src/segments/firebase.go @@ -0,0 +1,83 @@ +package segments + +import ( + "encoding/json" + "errors" + "path/filepath" + + "github.com/jandedobbeleer/oh-my-posh/src/platform" + "github.com/jandedobbeleer/oh-my-posh/src/properties" +) + +const ( + FIREBASENOACTIVECONFIG = "NO ACTIVE CONFIG FOUND" +) + +type Firebase struct { + props properties.Properties + env platform.Environment + + Project string +} + +type FirebaseData struct { + ActiveProject map[string]string `json:"activeProjects"` +} + +func (f *Firebase) Template() string { + return " {{ .Project}} " +} + +func (f *Firebase) Init(props properties.Properties, env platform.Environment) { + f.props = props + f.env = env +} + +func (f *Firebase) Enabled() bool { + cfgDir := filepath.Join(f.env.Home(), ".config", "configstore") + configFile, err := f.getActiveConfig(cfgDir) + if err != nil { + f.env.Error(err) + return false + } + + data, err := f.getFirebaseData(configFile) + if err != nil { + f.env.Error(err) + return false + } + + // Within the activeProjects is a key value pair + // of the path to the project and the project name + + // Test if the current directory is a project path + // and if it is, return the project name + for key, value := range data.ActiveProject { + if key == f.env.Pwd() { + f.Project = value + return true + } + } + + return false +} + +func (f *Firebase) getActiveConfig(cfgDir string) (string, error) { + activeConfigFile := filepath.Join(cfgDir, "firebase-tools.json") + activeConfigData := f.env.FileContent(activeConfigFile) + if len(activeConfigData) == 0 { + return "", errors.New(FIREBASENOACTIVECONFIG) + } + return activeConfigData, nil +} + +func (f *Firebase) getFirebaseData(configFile string) (*FirebaseData, error) { + var data FirebaseData + + err := json.Unmarshal([]byte(configFile), &data) + if err != nil { + return nil, err + } + + return &data, nil +} diff --git a/src/segments/firebase_test.go b/src/segments/firebase_test.go new file mode 100644 index 00000000..6b04097a --- /dev/null +++ b/src/segments/firebase_test.go @@ -0,0 +1,107 @@ +package segments + +import ( + "path/filepath" + "testing" + + "github.com/jandedobbeleer/oh-my-posh/src/mock" + "github.com/stretchr/testify/assert" + mock2 "github.com/stretchr/testify/mock" +) + +func TestFirebaseSegment(t *testing.T) { + cases := []struct { + Case string + CfgData string + ActiveConfig string + ExpectedEnabled bool + ExpectedString string + }{ + { + Case: "happy path", + ExpectedEnabled: true, + ActiveConfig: `{ + "activeProjects": { + "path": "project-name" + } + }`, + ExpectedString: "project-name", + }, + { + Case: "no active config", + ExpectedEnabled: false, + }, + { + Case: "empty config", + ActiveConfig: "{}", + ExpectedEnabled: false, + }, + { + Case: "bad config", + ActiveConfig: "{bad}", + ExpectedEnabled: false, + }, + } + + for _, tc := range cases { + env := new(mock.MockedEnvironment) + env.On("Home").Return("home") + env.On("Pwd").Return("path") + fcPath := filepath.Join("home", ".config", "configstore", "firebase-tools.json") + env.On("FileContent", fcPath).Return(tc.ActiveConfig) + env.On("Error", mock2.Anything).Return() + f := Firebase{ + env: env, + } + f.Enabled() + assert.Equal(t, tc.ExpectedEnabled, f.Enabled()) + if tc.ExpectedEnabled { + assert.Equal(t, tc.ExpectedString, renderTemplate(env, f.Template(), f), tc.Case) + } + } +} + +func TestGetFirebaseActiveConfig(t *testing.T) { + data := + `{ + "activeProjects": { + "path": "project-name" + } + }` + cases := []struct { + Case string + ActiveConfig string + ExpectedString string + ExpectedError string + }{ + { + Case: "happy path", + ActiveConfig: data, + ExpectedString: data, + }, + { + Case: "no active config", + ActiveConfig: "", + ExpectedError: FIREBASENOACTIVECONFIG, + }, + } + + for _, tc := range cases { + env := new(mock.MockedEnvironment) + env.On("Home").Return("home") + configPath := filepath.Join("home", ".config", "configstore") + contentPath := filepath.Join(configPath, "firebase-tools.json") + env.On("FileContent", contentPath).Return(tc.ActiveConfig) + env.On("Error", mock2.Anything).Return() + f := Firebase{ + env: env, + } + got, err := f.getActiveConfig(configPath) + assert.Equal(t, tc.ExpectedString, got, tc.Case) + if len(tc.ExpectedError) > 0 { + assert.EqualError(t, err, tc.ExpectedError, tc.Case) + } else { + assert.NoError(t, err, tc.Case) + } + } +} diff --git a/themes/cloud-context.omp.json b/themes/cloud-context.omp.json index 3b7d1a55..d2bf2627 100644 --- a/themes/cloud-context.omp.json +++ b/themes/cloud-context.omp.json @@ -7,6 +7,7 @@ "cloud-text-amazon": "#4285F4", "cloud-text-azure": "#4285F4", "cloud-text-gcp": "#4285F4", + "cloud-text-firebase": "#FFA000", "error-background": "#dd0033", "error-text": "#242424", "git-text": "#238636", @@ -76,6 +77,14 @@ "template": " \ue7b2 {{ .Project }}", "type": "gcp" }, + { + "background": "p:background-color", + "foreground": "p:cloud-text-firebase", + "style": "powerline", + "powerline_symbol": "\ue0b4", + "template": " \udb82\udd67 {{ .Project }}", + "type": "firebase" + }, { "background": "p:background-color", "foreground": "p:git-text", diff --git a/themes/schema.json b/themes/schema.json index 5ffcbe07..931c2673 100644 --- a/themes/schema.json +++ b/themes/schema.json @@ -314,6 +314,7 @@ "flutter", "fossil", "gcp", + "firebase", "git", "gitversion", "go", @@ -629,11 +630,7 @@ "title": "Source", "description": "https://ohmyposh.dev/docs/segments/az#properties", "default": "first_match", - "enum": [ - "first_match", - "cli", - "pwsh" - ] + "enum": ["first_match", "cli", "pwsh"] } } } @@ -727,7 +724,7 @@ "description": "The icon representing Bazel's logo", "default": "\ue63a" }, - "extensions":{ + "extensions": { "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if a folder is a Bazel workspace", @@ -747,11 +744,7 @@ "type": "array", "title": "Folders", "description": "The folders to look for when determining if a folder is a Bazel workspace", - "default": [ - "bazel-bin", - "bazel-out", - "bazel-testlogs" - ], + "default": ["bazel-bin", "bazel-out", "bazel-testlogs"], "items": { "type": "string" } @@ -890,12 +883,7 @@ "type": "string", "title": "Connection type", "description": "The connection type to display", - "enum": [ - "ethernet", - "wifi", - "cellular", - "bluetooth" - ], + "enum": ["ethernet", "wifi", "cellular", "bluetooth"], "default": "wifi|ethernet" }, "unit": { @@ -1131,9 +1119,7 @@ "type": "array", "title": "Folders", "description": "The folders to look for when determining if a folder is a Flutter workspace", - "default": [ - ".dart_tool" - ], + "default": [".dart_tool"], "items": { "type": "string" } @@ -1469,9 +1455,7 @@ "type": "array", "title": "Folders", "description": "The folders to look for when determining if a folder is a Dart workspace", - "default": [ - ".dart_tool" - ], + "default": [".dart_tool"], "items": { "type": "string" } @@ -2909,11 +2893,7 @@ "title": "units", "description": "Units of measurement. Available values are standard (kelvin), metric (celsius), and imperial (fahrenheit). Default is standard", "default": "standard", - "enum": [ - "standard", - "metric", - "imperial" - ] + "enum": ["standard", "metric", "imperial"] }, "http_timeout": { "$ref": "#/definitions/http_timeout" @@ -3185,10 +3165,7 @@ "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if the current directory is an Angular project", - "default": - [ - "angular.json" - ], + "default": ["angular.json"], "items": { "type": "string" } @@ -4296,6 +4273,19 @@ "description": "https://ohmyposh.dev/docs/segments/gcp" } }, + { + "if": { + "properties": { + "type": { + "const": "firebase" + } + } + }, + "then": { + "title": "Firebase Segment", + "description": "https://ohmyposh.dev/docs/segments/firebase" + } + }, { "if": { "properties": { diff --git a/website/docs/segments/firebase.mdx b/website/docs/segments/firebase.mdx new file mode 100644 index 00000000..10f80787 --- /dev/null +++ b/website/docs/segments/firebase.mdx @@ -0,0 +1,44 @@ +--- +id: firebase +title: Firebase +sidebar_label: Firebase +--- + +## What + +Display the current active Firebase project. + +This segment leverages the `firebase-tools.json` file generated by the [Firebase CLI][firebase-cli-docs]. +The active files listed there are used to determine the current project against the current directory. + +## Sample Configuration + +import Config from '@site/src/components/Config.js'; + + + +## Template ([info][templates]) + +:::note default template + +```template +{{ .Project }} +``` + +::: + +### Properties + +| Name | Type | Description | +| ---------- | -------- | ------------------------------------------------------------------------ | +| `.Project` | `string` | the currently active project | + +[templates]: /docs/configuration/templates +[firebase-cli-docs]: https://firebase.google.com/docs/cli diff --git a/website/sidebars.js b/website/sidebars.js index 0aba4195..51ea96e6 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -77,6 +77,7 @@ module.exports = { "segments/flutter", "segments/fossil", "segments/gcp", + "segments/firebase", "segments/git", "segments/gitversion", "segments/golang", From f4b867920cce2184a8543c750873526c4753adc3 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Thu, 18 Apr 2024 12:51:16 +0000 Subject: [PATCH 077/157] docs: update website/docs/contributors.md [skip ci] --- website/docs/contributors.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/contributors.md b/website/docs/contributors.md index 0452216a..39b528e9 100644 --- a/website/docs/contributors.md +++ b/website/docs/contributors.md @@ -332,7 +332,7 @@ Thanks goes to these wonderful people ([emoji key][acek]): Shravan Asati
Shravan Asati

🎨 Luca Zecca
Luca Zecca

💻 🎨 📖 Joshua Reilly
Joshua Reilly

💻 📖 - Ivan
Ivan

🎨 📖 + Ivan
Ivan

🎨 📖 💻 mountcount
mountcount

📖 From 91c9238e0f75c1438f147db151ae7f7aa5c8765f Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Thu, 18 Apr 2024 12:51:17 +0000 Subject: [PATCH 078/157] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index ed80add4..ab27ac87 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2337,7 +2337,8 @@ "profile": "https://ivan-the-terrible.github.io/", "contributions": [ "design", - "doc" + "doc", + "code" ] }, { From abe8c80451c19e64b7a786cc7e956f305c3e80f9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 19 Apr 2024 00:11:37 +0000 Subject: [PATCH 079/157] chore(deps): bump actions/upload-artifact from 4.3.1 to 4.3.2 Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.3.1 to 4.3.2. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/5d5d22a31266ced268874388b861e4b58bb5c2f3...1746f4ab65b179e0ea60a494b83293b640dd5bba) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/build_code.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_code.yml b/.github/workflows/build_code.yml index e4f496d6..3cce4fbf 100644 --- a/.github/workflows/build_code.yml +++ b/.github/workflows/build_code.yml @@ -28,7 +28,7 @@ jobs: args: build --clean --snapshot --skip=post-hooks --skip=before workdir: src - name: Archive production artifacts - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 + uses: actions/upload-artifact@1746f4ab65b179e0ea60a494b83293b640dd5bba with: name: builds retention-days: 1 From a47070b9d8d0f4479aa1193befabb66fb00ddd18 Mon Sep 17 00:00:00 2001 From: Ivan <56458442+ivan-the-terrible@users.noreply.github.com> Date: Fri, 19 Apr 2024 08:50:40 -0400 Subject: [PATCH 080/157] fix(firebase): sub path validation --- src/segments/firebase.go | 3 ++- src/segments/firebase_test.go | 25 +++++++++++++++++-------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/segments/firebase.go b/src/segments/firebase.go index 9b989d40..fc0e58e3 100644 --- a/src/segments/firebase.go +++ b/src/segments/firebase.go @@ -4,6 +4,7 @@ import ( "encoding/json" "errors" "path/filepath" + "strings" "github.com/jandedobbeleer/oh-my-posh/src/platform" "github.com/jandedobbeleer/oh-my-posh/src/properties" @@ -53,7 +54,7 @@ func (f *Firebase) Enabled() bool { // Test if the current directory is a project path // and if it is, return the project name for key, value := range data.ActiveProject { - if key == f.env.Pwd() { + if strings.HasPrefix(f.env.Pwd(), key) { f.Project = value return true } diff --git a/src/segments/firebase_test.go b/src/segments/firebase_test.go index 6b04097a..e24c428f 100644 --- a/src/segments/firebase_test.go +++ b/src/segments/firebase_test.go @@ -10,22 +10,31 @@ import ( ) func TestFirebaseSegment(t *testing.T) { + config := `{ + "activeProjects": { + "path": "project-name" + } + }` cases := []struct { Case string - CfgData string ActiveConfig string + ActivePath string ExpectedEnabled bool ExpectedString string }{ { Case: "happy path", ExpectedEnabled: true, - ActiveConfig: `{ - "activeProjects": { - "path": "project-name" - } - }`, - ExpectedString: "project-name", + ActiveConfig: config, + ActivePath: "path", + ExpectedString: "project-name", + }, + { + Case: "happy subpath", + ExpectedEnabled: true, + ActiveConfig: config, + ActivePath: "path/subpath", + ExpectedString: "project-name", }, { Case: "no active config", @@ -46,7 +55,7 @@ func TestFirebaseSegment(t *testing.T) { for _, tc := range cases { env := new(mock.MockedEnvironment) env.On("Home").Return("home") - env.On("Pwd").Return("path") + env.On("Pwd").Return(tc.ActivePath) fcPath := filepath.Join("home", ".config", "configstore", "firebase-tools.json") env.On("FileContent", fcPath).Return(tc.ActiveConfig) env.On("Error", mock2.Anything).Return() From 1055f69ec7bd96ce8460525fb4123812eea01c75 Mon Sep 17 00:00:00 2001 From: Bondrake Date: Sun, 14 Apr 2024 14:19:02 +1000 Subject: [PATCH 081/157] fix: prompt termination in devious-diamonds.omp.yaml The " \b" in this template was causing issues with non-deletable characters when you used tab to pop up suggestions in zsh. The approach of inserting an invisible character if not root preserves the trailing diamond without introducing spacing issues. --- themes/devious-diamonds.omp.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/devious-diamonds.omp.yaml b/themes/devious-diamonds.omp.yaml index ffda11a8..a99211b1 100644 --- a/themes/devious-diamonds.omp.yaml +++ b/themes/devious-diamonds.omp.yaml @@ -234,7 +234,7 @@ blocks: foreground: white properties: root_icon:  - template: "{{ if and .Root ( not .Segments.Path.Writable ) }} {{ end }}{{ if and .Root .Segments.Path.Writable }}  {{ end }} \b" + template: "{{ if not .Root }}\u2800{{ end }}{{ if and .Root ( not .Segments.Path.Writable ) }} {{ end }}{{ if and .Root .Segments.Path.Writable }}  {{ end }}" console_title_template: "{{ .Folder }}" palette: black: "#1B1A23" From 15350e3eba49e3a8b0e58448432e314eb431e646 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Fri, 19 Apr 2024 14:34:40 +0000 Subject: [PATCH 082/157] docs: update website/docs/contributors.md [skip ci] --- website/docs/contributors.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/website/docs/contributors.md b/website/docs/contributors.md index 39b528e9..f5e49057 100644 --- a/website/docs/contributors.md +++ b/website/docs/contributors.md @@ -335,6 +335,9 @@ Thanks goes to these wonderful people ([emoji key][acek]): Ivan
Ivan

🎨 📖 💻 mountcount
mountcount

📖 + + Bondrake
Bondrake

🎨 + From 7dce83100aa66c2cb7e3f5b959e53f88164fde09 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Fri, 19 Apr 2024 14:34:41 +0000 Subject: [PATCH 083/157] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index ab27ac87..31c54a08 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2349,6 +2349,15 @@ "contributions": [ "doc" ] + }, + { + "login": "Bondrake", + "name": "Bondrake", + "avatar_url": "https://avatars.githubusercontent.com/u/11696?v=4", + "profile": "https://github.com/Bondrake", + "contributions": [ + "design" + ] } ], "contributorsPerLine": 7, From 8ead4ce87ecfe3692c564ca7845fdc1fa8f1197f Mon Sep 17 00:00:00 2001 From: Christian Becker Date: Mon, 8 Apr 2024 21:39:47 +0200 Subject: [PATCH 084/157] feat(svn): add repository name --- src/segments/svn.go | 13 +++++++++++ src/segments/svn_test.go | 41 +++++++++++++++++++++++++++++++++++ website/docs/segments/svn.mdx | 18 +++++++++------ 3 files changed, 65 insertions(+), 7 deletions(-) diff --git a/src/segments/svn.go b/src/segments/svn.go index 739418f0..c8be0c06 100644 --- a/src/segments/svn.go +++ b/src/segments/svn.go @@ -1,6 +1,7 @@ package segments import ( + "path" "strconv" "strings" @@ -123,6 +124,18 @@ func (s *Svn) setSvnStatus() { } } +func (s *Svn) Repo() string { + // Get the repository name as the last path element of the repository root URL + repo := s.getSvnCommandOutput("info", "--show-item", "repos-root-url") + base := path.Base(repo) + + if base == "." { + return "" + } + + return base +} + func (s *Svn) getSvnCommandOutput(command string, args ...string) string { args = append([]string{command, s.realDir}, args...) val, err := s.env.RunCommand(s.command, args...) diff --git a/src/segments/svn_test.go b/src/segments/svn_test.go index c096b264..57031173 100644 --- a/src/segments/svn_test.go +++ b/src/segments/svn_test.go @@ -262,3 +262,44 @@ R Moved.File`, assert.Equal(t, tc.ExpectedConflicts, s.Working.HasConflicts(), tc.Case) } } + +func TestRepo(t *testing.T) { + cases := []struct { + Case string + Repo string + Expected string + }{ + { + Case: "No repo", + Repo: "", + Expected: "", + }, + { + Case: "Repo with trailing slash", + Repo: "http://example.com/", + Expected: "example.com", + }, + { + Case: "Repo without trailing slash", + Repo: "http://example.com", + Expected: "example.com", + }, + { + Case: "Repo with a path", + Repo: "http://example.com/test/repo", + Expected: "repo", + }, + } + for _, tc := range cases { + env := new(mock.MockedEnvironment) + env.On("RunCommand", "svn", []string{"info", "", "--show-item", "repos-root-url"}).Return(tc.Repo, nil) + s := &Svn{ + scm: scm{ + env: env, + command: SVNCOMMAND, + }, + } + + assert.Equal(t, tc.Expected, s.Repo(), tc.Case) + } +} diff --git a/website/docs/segments/svn.mdx b/website/docs/segments/svn.mdx index 3d80b88e..a3ea604e 100644 --- a/website/docs/segments/svn.mdx +++ b/website/docs/segments/svn.mdx @@ -39,6 +39,10 @@ You can set the following properties to `true` to enable fetching additional inf | `native_fallback` | `boolean` | `false` | when set to `true` and `svn.exe` is not available when inside a WSL2 shared Windows drive, we will fallback to the native svn executable to fetch data. Not all information can be displayed in this case | | `status_formats` | `map[string]string` | | a key, value map allowing to override how individual status items are displayed. For example, `"status_formats": { "Added": "Added: %d" }` will display the added count as `Added: 1` instead of `+1`. See the [Status](#status) section for available overrides | +:::info +The fields `Repo`, `Branch` and `BaseRev` will still work with `fetch_status` set to `false`. +::: + ## Template ([info][templates]) :::note default template @@ -51,11 +55,12 @@ You can set the following properties to `true` to enable fetching additional inf ### Properties -| Name | Type | Description | -| ---------- | -------- | ----------------------------------------------------- | -| `.Working` | `Status` | changes in the worktree (see below) | -| `.Branch` | `string` | current branch (releative URL reported by `svn info`) | -| `.BaseRev` | `int` | the currently checked out revision number | +| Name | Type | Description | +| ---------- | -------- | ---------------------------------------------------------- | +| `.Working` | `Status` | changes in the worktree (see below) | +| `.Branch` | `string` | current branch (relative URL reported by `svn info`) | +| `.BaseRev` | `int` | the currently checked out revision number | +| `.Repo` | `string` | current repository (repos root URL reported by `svn info`) | ### Status @@ -83,5 +88,4 @@ Local changes use the following syntax: | `!` | Conflicted | [svn]: https://subversion.apache.org -[templates]: /docs/config-templates -[hyperlinks]: /docs/config-templates#custom +[templates]: /configuration/templates.mdx From 9d7cde81cc1236fd49d019f088ac84b4276ab9d7 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Fri, 19 Apr 2024 18:59:01 +0000 Subject: [PATCH 085/157] docs: update website/docs/contributors.md [skip ci] --- website/docs/contributors.md | 1 + 1 file changed, 1 insertion(+) diff --git a/website/docs/contributors.md b/website/docs/contributors.md index f5e49057..d5b846d9 100644 --- a/website/docs/contributors.md +++ b/website/docs/contributors.md @@ -337,6 +337,7 @@ Thanks goes to these wonderful people ([emoji key][acek]): Bondrake
Bondrake

🎨 + R00dRallec
R00dRallec

💻 📖 From 8be7e573ae41f55de0fed8e80094c8485cc81cb5 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Fri, 19 Apr 2024 18:59:02 +0000 Subject: [PATCH 086/157] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 31c54a08..be008976 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2358,6 +2358,16 @@ "contributions": [ "design" ] + }, + { + "login": "R00dRallec", + "name": "R00dRallec", + "avatar_url": "https://avatars.githubusercontent.com/u/9081954?v=4", + "profile": "https://github.com/R00dRallec", + "contributions": [ + "code", + "doc" + ] } ], "contributorsPerLine": 7, From 659a57f01338f8681402096f30b1ac89c9b1f91b Mon Sep 17 00:00:00 2001 From: Ivan <56458442+ivan-the-terrible@users.noreply.github.com> Date: Fri, 19 Apr 2024 17:09:00 -0400 Subject: [PATCH 087/157] feat(nightscout): add headers property --- src/segments/nightscout.go | 13 +++++++++++-- src/segments/nightscout_test.go | 1 + themes/schema.json | 6 ++++++ website/docs/segments/nightscout.mdx | 11 ++++++----- 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/segments/nightscout.go b/src/segments/nightscout.go index b182be9b..fe1faba0 100644 --- a/src/segments/nightscout.go +++ b/src/segments/nightscout.go @@ -3,6 +3,7 @@ package segments import ( "encoding/json" "errors" + http2 "net/http" "time" "github.com/jandedobbeleer/oh-my-posh/src/platform" @@ -20,7 +21,8 @@ type Nightscout struct { const ( // Your complete Nightscout URL and APIKey like this - URL properties.Property = "url" + URL properties.Property = "url" + Headers properties.Property = "headers" DoubleUpIcon properties.Property = "doubleup_icon" SingleUpIcon properties.Property = "singleup_icon" @@ -116,7 +118,14 @@ func (ns *Nightscout) getResult() (*NightscoutData, error) { } } - body, err := ns.env.HTTPRequest(url, nil, httpTimeout) + headers := ns.props.GetKeyValueMap(Headers, map[string]string{}) + modifiers := func(request *http2.Request) { + for key, value := range headers { + request.Header.Add(key, value) + } + } + + body, err := ns.env.HTTPRequest(url, nil, httpTimeout, modifiers) if err != nil { return nil, err } diff --git a/src/segments/nightscout_test.go b/src/segments/nightscout_test.go index 29bb6686..1cf8a336 100644 --- a/src/segments/nightscout_test.go +++ b/src/segments/nightscout_test.go @@ -136,6 +136,7 @@ func TestNSSegment(t *testing.T) { props := properties.Map{ properties.CacheTimeout: tc.CacheTimeout, URL: "FAKE", + Headers: map[string]string{"Fake-Header": "xxxxx"}, } cache := &mock.MockedCache{} diff --git a/themes/schema.json b/themes/schema.json index 931c2673..fe2040e1 100644 --- a/themes/schema.json +++ b/themes/schema.json @@ -4370,6 +4370,12 @@ "title": "Http request timeout", "description": "Milliseconds to use for http request timeouts", "default": 500 + }, + "headers": { + "type": "object", + "title": "Headers", + "description": "A key, value map of Headers to send with the request", + "default": {} } } } diff --git a/website/docs/segments/nightscout.mdx b/website/docs/segments/nightscout.mdx index ad8e09f0..b357352a 100644 --- a/website/docs/segments/nightscout.mdx +++ b/website/docs/segments/nightscout.mdx @@ -57,11 +57,12 @@ Or display in mmol/l (instead of the default mg/dl) with the following template: ## Properties -| Name | Type | Default | Description | -| --------------- | :------: | :-----: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `url` | `string` | | Your Nightscout URL, including the full path to entries.json AND count=1 AND token. Example above. You'll know this works if you can curl it yourself and get a single value | -| `http_timeout` | `int` | `500` | in milliseconds - how long do you want to wait before you want to see your prompt more than your sugar? I figure a half second is a good default | -| `cache_timeout` | `int` | `5` | in minutes - how long do you want your numbers cached? | +| Name | Type | Default | Description | +| --------------- | :-----------------: | :-----: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `url` | `string` | | Your Nightscout URL, including the full path to entries.json AND count=1 AND token. Example above. You'll know this works if you can curl it yourself and get a single value | +| `headers` | `map[string]string` | | A key, value map of Headers to send with the request | +| `http_timeout` | `int` | `500` | in milliseconds - how long do you want to wait before you want to see your prompt more than your sugar? I figure a half second is a good default | +| `cache_timeout` | `int` | `5` | in minutes - how long do you want your numbers cached? | :::info You can change the icons for trend, put the trend elsewhere, add text, however you like! From a03c4f3f5e96462a9d9cb4a684a3c0313861acf7 Mon Sep 17 00:00:00 2001 From: Bondrake Date: Sat, 20 Apr 2024 11:11:47 +1000 Subject: [PATCH 088/157] fix: update all themes to Nerd Font 3.0+ unicode icon locations --- themes/devious-diamonds.omp.yaml | 24 ++++++++++++------------ themes/glowsticks.omp.yaml | 18 +++++++++--------- themes/mojada.omp.json | 2 +- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/themes/devious-diamonds.omp.yaml b/themes/devious-diamonds.omp.yaml index a99211b1..33d4db11 100644 --- a/themes/devious-diamonds.omp.yaml +++ b/themes/devious-diamonds.omp.yaml @@ -1,4 +1,4 @@ -# yaml-language-server: $schema=https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json +final_space: true blocks: - type: prompt alignment: left @@ -27,7 +27,7 @@ blocks: opensuse:  raspbian:  ubuntu:  - windows:  + windows: 󰍲 wsl:  wsl_separator:  template: " {{ if .WSL }}{{ end }}{{.Icon}}═" @@ -42,7 +42,7 @@ blocks: powerline_symbol:  background: magenta foreground: black - template: " {{ if .SSHSession }} {{ end }}{{ .UserName }}@{{ .HostName }} " + template: " {{ if .SSHSession }}󰌘 {{ end }}{{ .UserName }}@{{ .HostName }} " - type: angular style: powerline powerline_symbol:  @@ -50,7 +50,7 @@ blocks: foreground: black properties: fetch_version: true - template: " ﮰ {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} " + template: " 󰚲 {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} " - type: aws style: powerline powerline_symbol:  @@ -83,7 +83,7 @@ blocks: foreground: black properties: fetch_version: true - template: " ﳑ {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} " + template: " 󰟓 {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} " - type: java style: powerline powerline_symbol:  @@ -103,7 +103,7 @@ blocks: powerline_symbol:  background: lightYellow foreground: black - template: " ﴱ {{.Context}}{{if .Namespace}} :: {{.Namespace}}{{end}} " + template: " 󰠳 {{.Context}}{{if .Namespace}} :: {{.Namespace}}{{end}} " - type: node style: powerline powerline_symbol:  @@ -111,7 +111,7 @@ blocks: foreground: black properties: fetch_version: true - template: "  {{ if .PackageManagerIcon }}{{ .PackageManagerIcon }} {{ end }}{{ .Full }} " + template: " 󰎙 {{ if .PackageManagerIcon }}{{ .PackageManagerIcon }} {{ end }}{{ .Full }} " - type: php style: powerline powerline_symbol:  @@ -192,7 +192,7 @@ blocks: fetch_status: true fetch_upstream_icon: true fetch_worktree_count: true - template: "{{ .UpstreamIcon }}{{ .HEAD }}{{if .BranchStatus }} {{ .BranchStatus }}{{ end }}{{ if .Working.Changed }}  {{ .Working.String }}{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Staging.Changed }}  {{ .Staging.String }}{{ end }}{{ if gt .StashCount 0 }}  {{ .StashCount }}{{ end }}" + template: "{{ .UpstreamIcon }}{{ .HEAD }}{{if .BranchStatus }} {{ .BranchStatus }}{{ end }}{{ if .Working.Changed }}  {{ .Working.String }}{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Staging.Changed }}  {{ .Staging.String }}{{ end }}{{ if gt .StashCount 0 }} 󰆓 {{ .StashCount }}{{ end }}" - type: prompt alignment: left newline: true @@ -210,7 +210,7 @@ blocks: foreground: black properties: always_enabled: true - template: " {{ if gt .Code 0 }}{{ else }}{{ end }}{{ if eq ( gt .Code 0 ) .Segments.Path.Writable}} {{ end }}" + template: " {{ if gt .Code 0 }}󰋔 {{ else }} {{ end }}{{ if eq ( gt .Code 0 ) .Segments.Path.Writable}} {{ end }}" - type: path style: powerline powerline_symbol:  @@ -221,10 +221,10 @@ blocks: properties: style: agnoster_short folder_icon:  - folder_separator_icon: "  " - home_icon:  + folder_separator_icon: " 󰁕 " + home_icon: 󰋜 max_depth: 3 - template: "{{ if eq ( gt .Code 0 ) .Writable }} {{ end }} {{ .Path }}{{ if not .Writable }} {{ end }}{{ if and .Writable .Root }} {{end}}" + template: "{{ if eq ( gt .Code 0 ) .Writable }} {{ end }} {{ .Path }}{{ if not .Writable }} 󰍁 {{ end }}{{ if and .Writable .Root }} {{end}} " - type: text style: diamond trailing_diamond:  diff --git a/themes/glowsticks.omp.yaml b/themes/glowsticks.omp.yaml index 349aa85d..bc92cd78 100644 --- a/themes/glowsticks.omp.yaml +++ b/themes/glowsticks.omp.yaml @@ -52,7 +52,7 @@ blocks: always_enabled: true style: round style: powerline - template: " 羽{{ .FormattedMs }} " + template: " 󰔟{{ .FormattedMs }} " type: executiontime # Exit code @@ -84,14 +84,14 @@ blocks: foreground: p:white leading_diamond:  properties: - charged_icon:  - charging_icon:  - discharging_icon: " " + charged_icon: 󰂄 + charging_icon: 󰂄 + discharging_icon: "󰁹 " style: diamond - template: " {{.Templates }}{{ .Percentage}} " + template: " {{.Templates }}{{ .Percentage}}󰏰 " templates: - - '{{if eq "Discharging" .State.String}}{{if lt .Percentage 11}}{{else if lt .Percentage 21}}{{else if lt .Percentage 31}}{{else if lt .Percentage 41}}{{else if lt .Percentage 51}}{{else if lt .Percentage 61}}{{else if lt .Percentage 71}}{{else if lt .Percentage 81}}{{else if lt .Percentage 91}}{{else}}{{end}}{{end}}' - - '{{if eq "Charging" .State.String}}{{ if lt .Percentage 21}}{{else if lt .Percentage 31}}{{else if lt .Percentage 41}}{{else if lt .Percentage 61}}{{else if lt .Percentage 81}}{{else if lt .Percentage 91}}{{else}}{{end}}{{end}}' + - '{{if eq "Discharging" .State.String}}{{if lt .Percentage 11}}󰁺{{else if lt .Percentage 21}}󰁻{{else if lt .Percentage 31}}󰁼{{else if lt .Percentage 41}}󰁽{{else if lt .Percentage 51}}󰁾{{else if lt .Percentage 61}}󰁾{{else if lt .Percentage 71}}󰂀{{else if lt .Percentage 81}}󰂁{{else if lt .Percentage 91}}󰂂{{else}}󰁹{{end}}{{end}}' + - '{{if eq "Charging" .State.String}}{{ if lt .Percentage 21}}󰂆{{else if lt .Percentage 31}}󰂇{{else if lt .Percentage 41}}󰂈{{else if lt .Percentage 61}}󰂉{{else if lt .Percentage 81}}󰂊{{else if lt .Percentage 91}}󰂋{{else}}󰂄{{end}}{{end}}' templates_logic: first_match type: battery @@ -117,7 +117,7 @@ blocks: if ! res=$(curl -s wttr.in -Gsm2 --data-urlencode "format=j1"); then echo "$now" date +'%s' >/tmp/last_update.w - echo 睊 >/tmp/weather.w + echo 󰖪 >/tmp/weather.w rm /tmp/w_lock.w exit 0 fi @@ -125,7 +125,7 @@ blocks: temp=$(jq -r .temp_C <<<"$res") feels_like=$(jq -r .FeelsLikeC <<<"$res") [[ $(bc -l <<<"$feels_like!=$temp") -eq 1 ]] && feels_string=" feels $feels_like°C" - WWC_MAP='{"113":"Sunny","116":"PartlyCloudy","119":"Cloudy","122":"VeryCloudy","143":"Fog","176":"LightShowers","179":"LightSleetShowers","182":"LightSleet","185":"LightSleet","200":"ThunderyShowers","227":"LightSnow","230":"HeavySnow","248":"Fog","260":"Fog","263":"LightShowers","266":"LightRain","281":"LightSleet","284":"LightSleet","293":"LightRain","296":"LightRain","299":"HeavyShowers","302":"HeavyRain","305":"HeavyShowers","308":"HeavyRain","311":"LightSleet","314":"LightSleet","317":"LightSleet","320":"LightSnow","323":"LightSnowShowers","326":"LightSnowShowers","329":"HeavySnow","332":"HeavySnow","335":"HeavySnowShowers","338":"HeavySnow","350":"LightSleet","353":"LightShowers","356":"HeavyShowers","359":"HeavyRain","362":"LightSleetShowers","365":"LightSleetShowers","368":"LightSnowShowers","371":"HeavySnowShowers","374":"LightSleetShowers","377":"LightSleet","386":"ThunderyShowers","389":"ThunderyHeavyRain","392":"ThunderySnowShowers","395":"HeavySnowShowers"}';NF_DAY_MAP='{"Unknown":"ﮊ","Cloudy":"","Fog":"","HeavyRain":"","HeavyShowers":"","HeavySnow":"","HeavySnowShowers":"","LightRain":"","LightShowers":"","LightSleet":"","LightSleetShowers":"","LightSnow":"","LightSnowShowers":"","PartlyCloudy":"","Sunny":"","ThunderyHeavyRain":"","ThunderyShowers":"","ThunderySnowShowers":"","VeryCloudy":""}';NF_NIGHT_MAP='{"Unknown":"ﮊ","Cloudy":"","Fog":"","HeavyRain":"","HeavyShowers":"","HeavySnow":"","HeavySnowShowers":"","LightRain":"","LightShowers":"","LightSleet":"","LightSleetShowers":"","LightSnow":"","LightSnowShowers":"","PartlyCloudy":"","Sunny":"","ThunderyHeavyRain":"","ThunderyShowers":"","ThunderySnowShowers":"","VeryCloudy":""}' + WWC_MAP='{"113":"Sunny","116":"PartlyCloudy","119":"Cloudy","122":"VeryCloudy","143":"Fog","176":"LightShowers","179":"LightSleetShowers","182":"LightSleet","185":"LightSleet","200":"ThunderyShowers","227":"LightSnow","230":"HeavySnow","248":"Fog","260":"Fog","263":"LightShowers","266":"LightRain","281":"LightSleet","284":"LightSleet","293":"LightRain","296":"LightRain","299":"HeavyShowers","302":"HeavyRain","305":"HeavyShowers","308":"HeavyRain","311":"LightSleet","314":"LightSleet","317":"LightSleet","320":"LightSnow","323":"LightSnowShowers","326":"LightSnowShowers","329":"HeavySnow","332":"HeavySnow","335":"HeavySnowShowers","338":"HeavySnow","350":"LightSleet","353":"LightShowers","356":"HeavyShowers","359":"HeavyRain","362":"LightSleetShowers","365":"LightSleetShowers","368":"LightSnowShowers","371":"HeavySnowShowers","374":"LightSleetShowers","377":"LightSleet","386":"ThunderyShowers","389":"ThunderyHeavyRain","392":"ThunderySnowShowers","395":"HeavySnowShowers"}';NF_DAY_MAP='{"Unknown":"󰚌","Cloudy":"","Fog":"","HeavyRain":"","HeavyShowers":"","HeavySnow":"","HeavySnowShowers":"","LightRain":"","LightShowers":"","LightSleet":"","LightSleetShowers":"","LightSnow":"","LightSnowShowers":"","PartlyCloudy":"","Sunny":"","ThunderyHeavyRain":"","ThunderyShowers":"","ThunderySnowShowers":"","VeryCloudy":""}';NF_NIGHT_MAP='{"Unknown":"󰚌","Cloudy":"","Fog":"","HeavyRain":"","HeavyShowers":"","HeavySnow":"","HeavySnowShowers":"","LightRain":"","LightShowers":"","LightSleet":"","LightSleetShowers":"","LightSnow":"","LightSnowShowers":"","PartlyCloudy":"","Sunny":"","ThunderyHeavyRain":"","ThunderyShowers":"","ThunderySnowShowers":"","VeryCloudy":""}' cur_h="$(date +'%H')" ;wwc="$(jq '.weatherCode' <<<"$res")" if [[ $cur_h -gt 18 || $cur_h -lt 6 ]]; then icon=$(jq -r ".$(echo "$WWC_MAP" | jq -r ".$wwc")" <<<"$NF_DAY_MAP") else icon=$(jq -r ".$(echo "$WWC_MAP" | jq -r ".$wwc")" <<<"$NF_NIGHT_MAP"); fi diff --git a/themes/mojada.omp.json b/themes/mojada.omp.json index a97305a7..9142e2e8 100644 --- a/themes/mojada.omp.json +++ b/themes/mojada.omp.json @@ -93,7 +93,7 @@ "always_enabled": true }, "style": "plain", - "template": " {{ if gt .Code 0 }}\uf52f{{ else }}\uf4a7{{ end }} ", + "template": " {{ if gt .Code 0 }}\udb80\udc30{{ else }}\uf4a7{{ end }} ", "type": "status" }, { From ce6cdb4defb3a49d82bd5595d82b9e589e4d66fa Mon Sep 17 00:00:00 2001 From: Justin Wolfington Date: Fri, 19 Apr 2024 16:51:33 -0400 Subject: [PATCH 089/157] fix(pulumi): improve reliability of filepath hash calculation --- src/segments/pulumi.go | 2 +- src/segments/pulumi_test.go | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/segments/pulumi.go b/src/segments/pulumi.go index e514893d..eeab7c1f 100644 --- a/src/segments/pulumi.go +++ b/src/segments/pulumi.go @@ -154,7 +154,7 @@ func (p *Pulumi) getProjectName() error { return hex.EncodeToString(h.Sum(nil)) } - p.workspaceSHA1 = sha1HexString(p.env.Pwd() + "/" + fileName) + p.workspaceSHA1 = sha1HexString(p.env.Pwd() + p.env.PathSeparator() + fileName) return nil } diff --git a/src/segments/pulumi_test.go b/src/segments/pulumi_test.go index bd277283..77d764f3 100644 --- a/src/segments/pulumi_test.go +++ b/src/segments/pulumi_test.go @@ -203,6 +203,8 @@ description: A Console App env.On("HasFiles", pulumiJSON).Return(len(tc.JSONConfig) > 0) env.On("FileContent", pulumiJSON).Return(tc.JSONConfig, nil) + env.On("PathSeparator").Return("/") + env.On("HasFolder", filepath.Clean("/home/foobar/.pulumi/workspaces")).Return(tc.HasWorkspaceFolder) workspaceFile := "oh-my-posh-c62b7b6786c5c5a85896576e46a25d7c9f888e92-workspace.json" env.On("HasFilesInDir", filepath.Clean("/home/foobar/.pulumi/workspaces"), workspaceFile).Return(len(tc.WorkSpaceFile) > 0) From ca875a04e38cbb521a1b2ba1a4bfe792d666f9ad Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Sat, 20 Apr 2024 07:10:41 +0000 Subject: [PATCH 090/157] docs: update website/docs/contributors.md [skip ci] --- website/docs/contributors.md | 1 + 1 file changed, 1 insertion(+) diff --git a/website/docs/contributors.md b/website/docs/contributors.md index d5b846d9..3b1537ac 100644 --- a/website/docs/contributors.md +++ b/website/docs/contributors.md @@ -338,6 +338,7 @@ Thanks goes to these wonderful people ([emoji key][acek]): Bondrake
Bondrake

🎨 R00dRallec
R00dRallec

💻 📖 + Justin Wolfington
Justin Wolfington

💻 From 9d1b9e2b7c0dfc7b1acbb9e23dd021d2b27c701f Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Sat, 20 Apr 2024 07:10:42 +0000 Subject: [PATCH 091/157] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index be008976..0adae396 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2368,6 +2368,15 @@ "code", "doc" ] + }, + { + "login": "publicfacingusername", + "name": "Justin Wolfington", + "avatar_url": "https://avatars.githubusercontent.com/u/13956145?v=4", + "profile": "https://github.com/publicfacingusername", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, From 6c44459b6f1b3c5d72ae56e048a27acdf468a575 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Sat, 20 Apr 2024 09:35:11 +0200 Subject: [PATCH 092/157] feat(command): allow bypassing custom logic resolves #4835 --- src/segments/command.go | 14 ++++++++ src/segments/command_test.go | 17 ++++++++++ website/docs/segments/command.mdx | 54 +++++++++++++++++-------------- 3 files changed, 60 insertions(+), 25 deletions(-) diff --git a/src/segments/command.go b/src/segments/command.go index 9bd3c7e9..bb6f2782 100644 --- a/src/segments/command.go +++ b/src/segments/command.go @@ -21,6 +21,8 @@ const ( Command properties.Property = "command" // Command to execute Script properties.Property = "script" + // Interpret execution, or not + Interpret properties.Property = "interpret" ) func (c *Cmd) Template() string { @@ -32,18 +34,28 @@ func (c *Cmd) Enabled() bool { if !c.env.HasCommand(shell) { return false } + command := c.props.GetString(Command, "") if len(command) != 0 { return c.runCommand(shell, command) } + script := c.props.GetString(Script, "") if len(script) != 0 { return c.runScript(shell, script) } + return false } func (c *Cmd) runCommand(shell, command string) bool { + interpret := c.props.GetBool(Interpret, true) + + if !interpret { + c.Output = c.env.RunShellCommand(shell, command) + return len(c.Output) != 0 + } + if strings.Contains(command, "||") { commands := strings.Split(command, "||") for _, cmd := range commands { @@ -54,6 +66,7 @@ func (c *Cmd) runCommand(shell, command string) bool { } } } + if strings.Contains(command, "&&") { var output string commands := strings.Split(command, "&&") @@ -63,6 +76,7 @@ func (c *Cmd) runCommand(shell, command string) bool { c.Output = output return len(c.Output) != 0 } + c.Output = c.env.RunShellCommand(shell, strings.TrimSpace(command)) return len(c.Output) != 0 } diff --git a/src/segments/command_test.go b/src/segments/command_test.go index 66f75a0a..c2cb0d4a 100644 --- a/src/segments/command_test.go +++ b/src/segments/command_test.go @@ -136,6 +136,23 @@ func TestExecuteMultipleCommandsOrDisabled(t *testing.T) { assert.False(t, enabled) } +func TestExecuteNonInterpretedCommand(t *testing.T) { + env := new(mock.MockedEnvironment) + env.On("HasCommand", "bash").Return(true) + env.On("RunShellCommand", "bash", "echo hello && echo world").Return("hello world") + props := properties.Map{ + Command: "echo hello && echo world", + Interpret: false, + } + c := &Cmd{ + props: props, + env: env, + } + enabled := c.Enabled() + assert.True(t, enabled) + assert.Equal(t, "hello world", renderTemplate(env, c.Template(), c)) +} + func TestExecuteScript(t *testing.T) { cases := []struct { Case string diff --git a/website/docs/segments/command.mdx b/website/docs/segments/command.mdx index 2f149e8d..548156ad 100644 --- a/website/docs/segments/command.mdx +++ b/website/docs/segments/command.mdx @@ -18,35 +18,39 @@ When the command errors or returns an empty string, this segment isn't rendered. You have the ability to use `||` or `&&` to stitch commands together and achieve complex results. When using `||` the first command that returns a string will be used (or none when they all fail to produce output that's not an -error). The `&&` functionality will join the output of the commands when successful. +error). The `&&` functionality will join the output of the commands when successful. If you want to run the command +as is, you can set `interpret` to `false`. ## Sample Configuration -import Config from '@site/src/components/Config.js'; +import Config from "@site/src/components/Config.js"; - + ## Properties -| Name | Type | Default | Description | -| --------- | :------: | :-----: | --------------------------------------------------------------------------------- | -| `shell` | `string` | `bash` | the shell in which to run the command in. Uses `shell -c command` under the hood. | -| `command` | `string` | | the command(s) to run | -| `script` | `string` | | the path to a script to run | +| Name | Type | Default | Description | +| ----------- | :-------: | :-----: | -------------------------------------------------------------------------------- | +| `shell` | `string` | `bash` | the shell in which to run the command in. Uses `shell -c command` under the hood | +| `interpret` | `boolean` | `true` | interpret the command or run as is | +| `command` | `string` | | the command(s) to run | +| `script` | `string` | | the path to a script to run | ## Template ([info][templates]) @@ -60,9 +64,9 @@ import Config from '@site/src/components/Config.js'; ### Properties -| Name | Type | Description | -| ------- | ------ | ---------------------------------- | -|`.Output`|`string`|the output of the command or script.| +| Name | Type | Description | +| --------- | -------- | ------------------------------------ | +| `.Output` | `string` | the output of the command or script. | [env]: /docs/configuration/templates#environment-variables [templates]: /docs/configuration/templates From 64eeb400c50b7b71188666cce59454002731c284 Mon Sep 17 00:00:00 2001 From: Bondrake Date: Sun, 21 Apr 2024 01:32:00 +1000 Subject: [PATCH 093/157] fix(fonts): use new rasterizer, all icons work --- src/engine/image.go | 14 +++++++++----- src/go.mod | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/engine/image.go b/src/engine/image.go index 20aa247b..6453bfa4 100644 --- a/src/engine/image.go +++ b/src/engine/image.go @@ -42,8 +42,8 @@ import ( "github.com/esimov/stackblur-go" "github.com/fogleman/gg" - "github.com/golang/freetype/truetype" "golang.org/x/image/font" + "golang.org/x/image/font/opentype" ) type ConnectionError struct { @@ -217,7 +217,7 @@ func (ir *ImageRenderer) loadFonts() error { // Download font if not cached if data == nil { - url := "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.1.0/Hack.zip" + url := "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/Hack.zip" var err error data, err = fontCLI.Download(url) @@ -237,7 +237,7 @@ func (ir *ImageRenderer) loadFonts() error { return err } - fontFaceOptions := &truetype.Options{Size: 2.0 * 12, DPI: 144} + fontFaceOptions := &opentype.FaceOptions{Size: 2.0 * 12, DPI: 144} parseFont := func(file *zip.File) (font.Face, error) { rc, err := file.Open() @@ -252,12 +252,16 @@ func (ir *ImageRenderer) loadFonts() error { return nil, err } - font, err := truetype.Parse(data) + font, err := opentype.Parse(data) if err != nil { return nil, err } - return truetype.NewFace(font, fontFaceOptions), nil + fontFace, err := opentype.NewFace(font, fontFaceOptions) + if err != nil { + return nil, err + } + return fontFace, nil } for _, file := range zipReader.File { diff --git a/src/go.mod b/src/go.mod index 7c2b5f71..4b85beb9 100644 --- a/src/go.mod +++ b/src/go.mod @@ -10,7 +10,6 @@ require ( github.com/alecthomas/repr v0.4.0 // indirect github.com/esimov/stackblur-go v1.1.0 github.com/fogleman/gg v1.3.0 - github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 github.com/google/uuid v1.6.0 // indirect github.com/gookit/color v1.5.4 github.com/huandu/xstrings v1.4.0 // indirect @@ -70,6 +69,7 @@ require ( github.com/containerd/console v1.0.4 // indirect github.com/dsnet/compress v0.0.1 // indirect github.com/fatih/color v1.16.0 // indirect + github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 // indirect From 336c1dfa6580d1a5204bb0003c99d061ab3e311e Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Sat, 20 Apr 2024 18:13:08 +0000 Subject: [PATCH 094/157] docs: update website/docs/contributors.md [skip ci] --- website/docs/contributors.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/contributors.md b/website/docs/contributors.md index 3b1537ac..d7ef017a 100644 --- a/website/docs/contributors.md +++ b/website/docs/contributors.md @@ -336,7 +336,7 @@ Thanks goes to these wonderful people ([emoji key][acek]): mountcount
mountcount

📖 - Bondrake
Bondrake

🎨 + Bondrake
Bondrake

🎨 💻 R00dRallec
R00dRallec

💻 📖 Justin Wolfington
Justin Wolfington

💻 From bcb7b5ae052dad278d41e8a006476ae22dfd9f26 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Sat, 20 Apr 2024 18:13:09 +0000 Subject: [PATCH 095/157] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 0adae396..b8641423 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2356,7 +2356,8 @@ "avatar_url": "https://avatars.githubusercontent.com/u/11696?v=4", "profile": "https://github.com/Bondrake", "contributions": [ - "design" + "design", + "code" ] }, { From b922d613717fc3bc515220d8d932224e1b07b5bb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 Apr 2024 00:54:02 +0000 Subject: [PATCH 096/157] chore(deps): bump actions/checkout from 4.1.2 to 4.1.3 Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.2 to 4.1.3. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/9bb56186c3b09b4f86b1c65136769dd318469633...1d96c772d19495a3b5c517cd2bc0cb401ea0529f) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/android.yml | 2 +- .github/workflows/build_code.yml | 2 +- .github/workflows/close_themes_pr.yml | 2 +- .github/workflows/code.yml | 2 +- .github/workflows/codeql.yml | 2 +- .github/workflows/docs.yml | 2 +- .github/workflows/gomod.yml | 2 +- .github/workflows/inno.yml | 2 +- .github/workflows/markdown.yml | 2 +- .github/workflows/merge_contributions_pr.yml | 2 +- .github/workflows/release.yml | 4 ++-- .github/workflows/scoop.yml | 2 +- .github/workflows/winget.yml | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 81549f1d..c762ed2a 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -9,7 +9,7 @@ jobs: container: ghcr.io/jandedobbeleer/golang-android-container:latest steps: - name: Checkout code 👋 - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 + uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f - name: Build run: | VERSION=$(echo "${{ github.event.release.name }}" | cut -c2-) diff --git a/.github/workflows/build_code.yml b/.github/workflows/build_code.yml index 3cce4fbf..92a4584f 100644 --- a/.github/workflows/build_code.yml +++ b/.github/workflows/build_code.yml @@ -17,7 +17,7 @@ jobs: shell: pwsh steps: - name: Checkout code 👋 - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 + uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f - name: Install Go 🗳 uses: ./.github/workflows/composite/bootstrap-go - name: Run GoReleaser 🚀 diff --git a/.github/workflows/close_themes_pr.yml b/.github/workflows/close_themes_pr.yml index bf9f51aa..763d8640 100644 --- a/.github/workflows/close_themes_pr.yml +++ b/.github/workflows/close_themes_pr.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code 👋 - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 + uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f - name: Check and close 🔐 uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea with: diff --git a/.github/workflows/code.yml b/.github/workflows/code.yml index bb1ad04a..26d92fdc 100644 --- a/.github/workflows/code.yml +++ b/.github/workflows/code.yml @@ -25,7 +25,7 @@ jobs: go-version: 1.21 cache-dependency-path: src/go.sum - name: Checkout code - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 + uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f - name: Golang CI uses: golangci/golangci-lint-action@3cfe3a4abbb849e10058ce4af15d205b6da42804 with: diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index bb328264..7bce33f8 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -25,7 +25,7 @@ jobs: go-version: 1.21 cache-dependency-path: src/go.sum - name: Checkout code - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 + uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f - name: Initialize CodeQL uses: github/codeql-action/init@cdcdbb579706841c47f7063dda365e292e5cad7a with: diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index a03ed388..09deb96f 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest name: Build and Deploy steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f with: submodules: true persist-credentials: false diff --git a/.github/workflows/gomod.yml b/.github/workflows/gomod.yml index 4a2032dd..2bbd955c 100644 --- a/.github/workflows/gomod.yml +++ b/.github/workflows/gomod.yml @@ -15,7 +15,7 @@ jobs: go-version: 1.21 cache-dependency-path: src/go.sum - name: Checkout code - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 + uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f - name: Check for unused dependencies run: | go mod tidy diff --git a/.github/workflows/inno.yml b/.github/workflows/inno.yml index 435b33ca..24e43dd2 100644 --- a/.github/workflows/inno.yml +++ b/.github/workflows/inno.yml @@ -15,7 +15,7 @@ jobs: working-directory: ${{ github.workspace }}/packages/inno steps: - name: Checkout code 👋 - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 + uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f - name: Build installer 📦 id: build env: diff --git a/.github/workflows/markdown.yml b/.github/workflows/markdown.yml index 5c364603..f204e2a0 100644 --- a/.github/workflows/markdown.yml +++ b/.github/workflows/markdown.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 + uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f - name: Lint files uses: articulate/actions-markdownlint@17b8abe7407cd17590c006ecc837c35e1ac3ed83 with: diff --git a/.github/workflows/merge_contributions_pr.yml b/.github/workflows/merge_contributions_pr.yml index 64a592b7..0d6c93d7 100644 --- a/.github/workflows/merge_contributions_pr.yml +++ b/.github/workflows/merge_contributions_pr.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code 👋 - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 + uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f - name: Check and merge ⛙ uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 84556656..8b53f382 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,7 +19,7 @@ jobs: skipped: ${{ steps.changelog.outputs.skipped }} steps: - name: Checkout code 👋 - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 + uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f - name: Create changelog ✍️ id: changelog uses: TriPSs/conventional-changelog-action@f04dac1fd07687cec8ea302937ca588b33786e98 @@ -41,7 +41,7 @@ jobs: working-directory: ${{ github.workspace }}/src steps: - name: Checkout code 👋 - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 + uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f - name: Install Go 🗳 uses: ./.github/workflows/composite/bootstrap-go - name: Tag HEAD 😸 diff --git a/.github/workflows/scoop.yml b/.github/workflows/scoop.yml index b1a630e1..42f799a8 100644 --- a/.github/workflows/scoop.yml +++ b/.github/workflows/scoop.yml @@ -18,7 +18,7 @@ jobs: working-directory: ${{ github.workspace }}/packages/scoop steps: - name: Checkout code 👋 - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 + uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f - name: Update Template ✍️ run: | ./build.ps1 -Version ${{ github.event.inputs.version }} diff --git a/.github/workflows/winget.yml b/.github/workflows/winget.yml index 9540f46b..2bf0bd49 100644 --- a/.github/workflows/winget.yml +++ b/.github/workflows/winget.yml @@ -17,7 +17,7 @@ jobs: WINGETCREATE_TOKEN: ${{ secrets.WINGETCREATE_TOKEN }} steps: - name: Checkout code 👋 - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 + uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f - name: Create manifest and submit PR 📦 run: | ./build.ps1 -Version "${{ github.event.inputs.version }}" -Token $env:WINGETCREATE_TOKEN From 71c801d312f599faa4d61823d4d9d1c077d1899d Mon Sep 17 00:00:00 2001 From: Jack Tracey <41163455+jtracey93@users.noreply.github.com> Date: Mon, 22 Apr 2024 07:26:57 +0100 Subject: [PATCH 097/157] theme(jtracey93): adjust status and executiontime --- themes/jtracey93.omp.json | 46 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/themes/jtracey93.omp.json b/themes/jtracey93.omp.json index b7bbc21d..da6c9249 100644 --- a/themes/jtracey93.omp.json +++ b/themes/jtracey93.omp.json @@ -54,13 +54,55 @@ "properties": { "time_format": "15:04:05" }, - "style": "diamond", + "style": "plain", "template": " {{ .CurrentDate | date .Format }} ", - "trailing_diamond": "\ue0b0", "type": "time" + }, + { + "background": "#49404f", + "foreground": "#ffffff", + "properties": { + "style": "dallas", + "threshold": 0 + }, + "style": "plain", + "template": " {{ .FormattedMs }}s ", + "type": "executiontime" + }, + { + "type": "status", + "style": "diamond", + "foreground": "#ffffff", + "background": "#00897b", + "background_templates": [ + "{{ if .Error }}#e91e63{{ end }}" + ], + "trailing_diamond": "\ue0b0", + "properties": { + "always_enabled": true + } } ], "type": "prompt" + }, + { + "type": "prompt", + "newline": true, + "alignment": "left", + "segments": [ + { + "foreground": "#ffffff", + "foreground_templates": [ + "{{ if gt .Code 0 }}#ff0000{{ end }}" + ], + "properties": { + "always_enabled": true + }, + "style": "plain", + "template": "\u276f ", + "type": "status" + } + ] } ], "final_space": true, From 8f5672f3929be9ee2a32c6170595c725b94a2495 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 22 Apr 2024 06:27:14 +0000 Subject: [PATCH 098/157] docs: update website/docs/contributors.md [skip ci] --- website/docs/contributors.md | 1 + 1 file changed, 1 insertion(+) diff --git a/website/docs/contributors.md b/website/docs/contributors.md index d7ef017a..e4736a25 100644 --- a/website/docs/contributors.md +++ b/website/docs/contributors.md @@ -339,6 +339,7 @@ Thanks goes to these wonderful people ([emoji key][acek]): Bondrake
Bondrake

🎨 💻 R00dRallec
R00dRallec

💻 📖 Justin Wolfington
Justin Wolfington

💻 + Jack Tracey
Jack Tracey

🎨 From d10d568c156a33007d059efe8dadb600503db383 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 22 Apr 2024 06:27:15 +0000 Subject: [PATCH 099/157] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index b8641423..db80986f 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2378,6 +2378,15 @@ "contributions": [ "code" ] + }, + { + "login": "jtracey93", + "name": "Jack Tracey", + "avatar_url": "https://avatars.githubusercontent.com/u/41163455?v=4", + "profile": "https://bio.link/jacktracey", + "contributions": [ + "design" + ] } ], "contributorsPerLine": 7, From 92031bdf5180cc2b657dda5b4351d5aeebb0908d Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Mon, 22 Apr 2024 08:54:18 +0200 Subject: [PATCH 100/157] fix(path): construct currentpath correctly on Windows relates to #4727 --- src/segments/path.go | 15 ++++++++++++--- src/segments/path_test.go | 18 ++++++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/segments/path.go b/src/segments/path.go index c3d0a674..122c0ee6 100644 --- a/src/segments/path.go +++ b/src/segments/path.go @@ -710,11 +710,20 @@ func (pt *Path) splitPath() Folders { folderFormatMap := pt.makeFolderFormatMap() - currentPath := pt.root - if currentPath == "~" { - currentPath = pt.env.Home() + pt.env.PathSeparator() + getCurrentPath := func() string { + if pt.root == "~" { + return pt.env.Home() + pt.env.PathSeparator() + } + + if pt.env.GOOS() == platform.WINDOWS { + return pt.root + pt.env.PathSeparator() + } + + return pt.root } + currentPath := getCurrentPath() + var display bool for _, folder := range folders { diff --git a/src/segments/path_test.go b/src/segments/path_test.go index b4854293..414d61a9 100644 --- a/src/segments/path_test.go +++ b/src/segments/path_test.go @@ -1506,6 +1506,7 @@ func TestReplaceMappedLocations(t *testing.T) { func TestSplitPath(t *testing.T) { cases := []struct { Case string + GOOS string Relative string Root string GitDir *platform.FileInfo @@ -1517,6 +1518,7 @@ func TestSplitPath(t *testing.T) { Case: "Regular directory", Root: "/", Relative: "c/d", + GOOS: platform.DARWIN, Expected: Folders{ {Name: "c", Path: "/c"}, {Name: "d", Path: "/c/d"}, @@ -1526,6 +1528,7 @@ func TestSplitPath(t *testing.T) { Case: "Home directory - git folder", Root: "~", Relative: "c/d", + GOOS: platform.DARWIN, GitDir: &platform.FileInfo{IsDir: true, ParentFolder: "/a/b/c"}, GitDirFormat: "%s", Expected: Folders{ @@ -1533,6 +1536,20 @@ func TestSplitPath(t *testing.T) { {Name: "d", Path: "/a/b/c/d"}, }, }, + { + Case: "Home directory - git folder on Windows", + Root: "C:", + Relative: "a/b/c/d", + GOOS: platform.WINDOWS, + GitDir: &platform.FileInfo{IsDir: true, ParentFolder: "C:/a/b/c"}, + GitDirFormat: "%s", + Expected: Folders{ + {Name: "a", Path: "C:/a"}, + {Name: "b", Path: "C:/a/b"}, + {Name: "c", Path: "C:/a/b/c", Display: true}, + {Name: "d", Path: "C:/a/b/c/d"}, + }, + }, } for _, tc := range cases { @@ -1540,6 +1557,7 @@ func TestSplitPath(t *testing.T) { env.On("PathSeparator").Return("/") env.On("Home").Return("/a/b") env.On("HasParentFilePath", ".git").Return(tc.GitDir, nil) + env.On("GOOS").Return(tc.GOOS) path := &Path{ env: env, props: properties.Map{ From 7e279aafd5fe404303819ed575f7fc8eba781a1e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 23 Apr 2024 00:14:27 +0000 Subject: [PATCH 101/157] chore(deps): bump actions/upload-artifact from 4.3.2 to 4.3.3 Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.3.2 to 4.3.3. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/1746f4ab65b179e0ea60a494b83293b640dd5bba...65462800fd760344b1a7b4382951275a0abb4808) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/build_code.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_code.yml b/.github/workflows/build_code.yml index 92a4584f..83b1350e 100644 --- a/.github/workflows/build_code.yml +++ b/.github/workflows/build_code.yml @@ -28,7 +28,7 @@ jobs: args: build --clean --snapshot --skip=post-hooks --skip=before workdir: src - name: Archive production artifacts - uses: actions/upload-artifact@1746f4ab65b179e0ea60a494b83293b640dd5bba + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 with: name: builds retention-days: 1 From 688dbcb82cb5a1eb8d7478e625a045e14b7f7f3d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 24 Apr 2024 00:40:18 +0000 Subject: [PATCH 102/157] chore(deps): bump helm/kind-action from 1.9.0 to 1.10.0 Bumps [helm/kind-action](https://github.com/helm/kind-action) from 1.9.0 to 1.10.0. - [Release notes](https://github.com/helm/kind-action/releases) - [Commits](https://github.com/helm/kind-action/compare/99576bfa6ddf9a8e612d83b513da5a75875caced...0025e74a8c7512023d06dc019c617aa3cf561fde) --- updated-dependencies: - dependency-name: helm/kind-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 09deb96f..5870b2a0 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -34,7 +34,7 @@ jobs: # Images are defined on every Kind release # See https://github.com/kubernetes-sigs/kind/releases - name: Create k8s v1.23 Kind Cluster - uses: helm/kind-action@99576bfa6ddf9a8e612d83b513da5a75875caced + uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde with: node_image: kindest/node:v1.23.4@sha256:0e34f0d0fd448aa2f2819cfd74e99fe5793a6e4938b328f657c8e3f81ee0dfb9 cluster_name: posh From 3d3ce2189e68943d3ab303a34aec18018432ac69 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 25 Apr 2024 00:57:46 +0000 Subject: [PATCH 103/157] chore(deps): bump golangci/golangci-lint-action from 4.0.0 to 4.0.1 Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 4.0.0 to 4.0.1. - [Release notes](https://github.com/golangci/golangci-lint-action/releases) - [Commits](https://github.com/golangci/golangci-lint-action/compare/3cfe3a4abbb849e10058ce4af15d205b6da42804...d6238b002a20823d52840fda27e2d4891c5952dc) --- updated-dependencies: - dependency-name: golangci/golangci-lint-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/code.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/code.yml b/.github/workflows/code.yml index 26d92fdc..a4fc0e2b 100644 --- a/.github/workflows/code.yml +++ b/.github/workflows/code.yml @@ -27,7 +27,7 @@ jobs: - name: Checkout code uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f - name: Golang CI - uses: golangci/golangci-lint-action@3cfe3a4abbb849e10058ce4af15d205b6da42804 + uses: golangci/golangci-lint-action@d6238b002a20823d52840fda27e2d4891c5952dc with: working-directory: src - name: Unit Tests From 34e5dd9709ee032eceb91716e2cdd1018cba92d6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 25 Apr 2024 01:03:53 +0000 Subject: [PATCH 104/157] chore(deps): bump actions/checkout from 4.1.3 to 4.1.4 Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.3 to 4.1.4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/1d96c772d19495a3b5c517cd2bc0cb401ea0529f...0ad4b8fadaa221de15dcec353f45205ec38ea70b) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/android.yml | 2 +- .github/workflows/build_code.yml | 2 +- .github/workflows/close_themes_pr.yml | 2 +- .github/workflows/code.yml | 2 +- .github/workflows/codeql.yml | 2 +- .github/workflows/docs.yml | 2 +- .github/workflows/gomod.yml | 2 +- .github/workflows/inno.yml | 2 +- .github/workflows/markdown.yml | 2 +- .github/workflows/merge_contributions_pr.yml | 2 +- .github/workflows/release.yml | 4 ++-- .github/workflows/scoop.yml | 2 +- .github/workflows/winget.yml | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index c762ed2a..993bd4be 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -9,7 +9,7 @@ jobs: container: ghcr.io/jandedobbeleer/golang-android-container:latest steps: - name: Checkout code 👋 - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b - name: Build run: | VERSION=$(echo "${{ github.event.release.name }}" | cut -c2-) diff --git a/.github/workflows/build_code.yml b/.github/workflows/build_code.yml index 83b1350e..4c257ff4 100644 --- a/.github/workflows/build_code.yml +++ b/.github/workflows/build_code.yml @@ -17,7 +17,7 @@ jobs: shell: pwsh steps: - name: Checkout code 👋 - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b - name: Install Go 🗳 uses: ./.github/workflows/composite/bootstrap-go - name: Run GoReleaser 🚀 diff --git a/.github/workflows/close_themes_pr.yml b/.github/workflows/close_themes_pr.yml index 763d8640..a4aac7cb 100644 --- a/.github/workflows/close_themes_pr.yml +++ b/.github/workflows/close_themes_pr.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code 👋 - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b - name: Check and close 🔐 uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea with: diff --git a/.github/workflows/code.yml b/.github/workflows/code.yml index a4fc0e2b..0565cde1 100644 --- a/.github/workflows/code.yml +++ b/.github/workflows/code.yml @@ -25,7 +25,7 @@ jobs: go-version: 1.21 cache-dependency-path: src/go.sum - name: Checkout code - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b - name: Golang CI uses: golangci/golangci-lint-action@d6238b002a20823d52840fda27e2d4891c5952dc with: diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 7bce33f8..f0d73f31 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -25,7 +25,7 @@ jobs: go-version: 1.21 cache-dependency-path: src/go.sum - name: Checkout code - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b - name: Initialize CodeQL uses: github/codeql-action/init@cdcdbb579706841c47f7063dda365e292e5cad7a with: diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 5870b2a0..672bf36d 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest name: Build and Deploy steps: - - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f + - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b with: submodules: true persist-credentials: false diff --git a/.github/workflows/gomod.yml b/.github/workflows/gomod.yml index 2bbd955c..81d64183 100644 --- a/.github/workflows/gomod.yml +++ b/.github/workflows/gomod.yml @@ -15,7 +15,7 @@ jobs: go-version: 1.21 cache-dependency-path: src/go.sum - name: Checkout code - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b - name: Check for unused dependencies run: | go mod tidy diff --git a/.github/workflows/inno.yml b/.github/workflows/inno.yml index 24e43dd2..c9f846b8 100644 --- a/.github/workflows/inno.yml +++ b/.github/workflows/inno.yml @@ -15,7 +15,7 @@ jobs: working-directory: ${{ github.workspace }}/packages/inno steps: - name: Checkout code 👋 - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b - name: Build installer 📦 id: build env: diff --git a/.github/workflows/markdown.yml b/.github/workflows/markdown.yml index f204e2a0..0040e968 100644 --- a/.github/workflows/markdown.yml +++ b/.github/workflows/markdown.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b - name: Lint files uses: articulate/actions-markdownlint@17b8abe7407cd17590c006ecc837c35e1ac3ed83 with: diff --git a/.github/workflows/merge_contributions_pr.yml b/.github/workflows/merge_contributions_pr.yml index 0d6c93d7..d9f5baee 100644 --- a/.github/workflows/merge_contributions_pr.yml +++ b/.github/workflows/merge_contributions_pr.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code 👋 - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b - name: Check and merge ⛙ uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8b53f382..27faeae6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,7 +19,7 @@ jobs: skipped: ${{ steps.changelog.outputs.skipped }} steps: - name: Checkout code 👋 - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b - name: Create changelog ✍️ id: changelog uses: TriPSs/conventional-changelog-action@f04dac1fd07687cec8ea302937ca588b33786e98 @@ -41,7 +41,7 @@ jobs: working-directory: ${{ github.workspace }}/src steps: - name: Checkout code 👋 - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b - name: Install Go 🗳 uses: ./.github/workflows/composite/bootstrap-go - name: Tag HEAD 😸 diff --git a/.github/workflows/scoop.yml b/.github/workflows/scoop.yml index 42f799a8..cfe3732a 100644 --- a/.github/workflows/scoop.yml +++ b/.github/workflows/scoop.yml @@ -18,7 +18,7 @@ jobs: working-directory: ${{ github.workspace }}/packages/scoop steps: - name: Checkout code 👋 - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b - name: Update Template ✍️ run: | ./build.ps1 -Version ${{ github.event.inputs.version }} diff --git a/.github/workflows/winget.yml b/.github/workflows/winget.yml index 2bf0bd49..7a607361 100644 --- a/.github/workflows/winget.yml +++ b/.github/workflows/winget.yml @@ -17,7 +17,7 @@ jobs: WINGETCREATE_TOKEN: ${{ secrets.WINGETCREATE_TOKEN }} steps: - name: Checkout code 👋 - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b - name: Create manifest and submit PR 📦 run: | ./build.ps1 -Version "${{ github.event.inputs.version }}" -Token $env:WINGETCREATE_TOKEN From 5f095d61f278194e1d2190a7fc0c7505c934d1b7 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Thu, 25 Apr 2024 08:28:08 +0200 Subject: [PATCH 105/157] fix(path): correct logic for agnoster style relates to #4727 --- src/segments/path.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/segments/path.go b/src/segments/path.go index 122c0ee6..cca34cc6 100644 --- a/src/segments/path.go +++ b/src/segments/path.go @@ -257,13 +257,14 @@ func (pt *Path) getAgnosterPath() string { var elements []string n := len(pt.Folders) - for i := 1; i < n; i++ { + for i := 0; i < n-1; i++ { + name := folderIcon + if pt.Folders[i].Display { - elements = append(elements, pt.Folders[i].Name) - continue + name = pt.Folders[i].Name } - elements = append(elements, folderIcon) + elements = append(elements, name) } if len(pt.Folders) > 0 { From 14bee0b66e3feefd685cf08f85f7310165c1679b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 26 Apr 2024 00:53:25 +0000 Subject: [PATCH 106/157] chore(deps): bump golangci/golangci-lint-action from 4.0.1 to 5.0.0 Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 4.0.1 to 5.0.0. - [Release notes](https://github.com/golangci/golangci-lint-action/releases) - [Commits](https://github.com/golangci/golangci-lint-action/compare/d6238b002a20823d52840fda27e2d4891c5952dc...82d40c283aeb1f2b6595839195e95c2d6a49081b) --- updated-dependencies: - dependency-name: golangci/golangci-lint-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/code.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/code.yml b/.github/workflows/code.yml index 0565cde1..2d94df65 100644 --- a/.github/workflows/code.yml +++ b/.github/workflows/code.yml @@ -27,7 +27,7 @@ jobs: - name: Checkout code uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b - name: Golang CI - uses: golangci/golangci-lint-action@d6238b002a20823d52840fda27e2d4891c5952dc + uses: golangci/golangci-lint-action@82d40c283aeb1f2b6595839195e95c2d6a49081b with: working-directory: src - name: Unit Tests From 6698b71f109ebaf5f4e2ce45087f429ae65b3b95 Mon Sep 17 00:00:00 2001 From: MarkDaveny Date: Mon, 29 Apr 2024 21:04:14 +0800 Subject: [PATCH 107/157] chore: fix some typos in comments Signed-off-by: MarkDaveny --- src/platform/battery/battery_windows_nix.go | 2 +- src/segments/unity_test.go | 2 +- themes/schema.json | 2 +- website/docs/segments/git.mdx | 2 +- website/docs/segments/owm.mdx | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/platform/battery/battery_windows_nix.go b/src/platform/battery/battery_windows_nix.go index ae91ae33..fc2b0403 100644 --- a/src/platform/battery/battery_windows_nix.go +++ b/src/platform/battery/battery_windows_nix.go @@ -37,7 +37,7 @@ func mapMostLogicalState(currentState, newState State) State { return newState } -// GetAll returns information about all batteries in the system. +// Get returns information about all batteries in the system. // // If error != nil, it will be either ErrFatal or Errors. // If error is of type Errors, it is guaranteed that length of both returned slices is the same and that i-th error coresponds with i-th battery structure. diff --git a/src/segments/unity_test.go b/src/segments/unity_test.go index 436c634f..e0ef38ff 100644 --- a/src/segments/unity_test.go +++ b/src/segments/unity_test.go @@ -110,7 +110,7 @@ func TestUnitySegment(t *testing.T) { } // 2021.9.20f1 is used in the test cases below as a fake Unity version. -// As such, it doesn't exist in the predfined map in unity.go. This +// As such, it doesn't exist in the predefined map in unity.go. This // allows us to test the web request portion of the code, which is the // fallback for obtaining a C# version. func TestUnitySegmentCSharpWebRequest(t *testing.T) { diff --git a/themes/schema.json b/themes/schema.json index fe2040e1..89b11823 100644 --- a/themes/schema.json +++ b/themes/schema.json @@ -2873,7 +2873,7 @@ "location": { "type": "string", "title": "location", - "description": "Location to use for the API call interpretted only if valid coordinates aren't given. Formatted as ,,. City name, state code and country code divided by comma. Please, refer to ISO 3166 for the state codes or country codes.", + "description": "Location to use for the API call interpreted only if valid coordinates aren't given. Formatted as ,,. City name, state code and country code divided by comma. Please, refer to ISO 3166 for the state codes or country codes.", "default": "De Bilt,NL" }, "latitude" : { diff --git a/website/docs/segments/git.mdx b/website/docs/segments/git.mdx index 3569260e..6103c8d4 100644 --- a/website/docs/segments/git.mdx +++ b/website/docs/segments/git.mdx @@ -186,7 +186,7 @@ Local changes use the following syntax: | Name | Type | Description | | ------------ | ----------- | -------------------------------------- | | `.Author` | `User` | the author of the commit (see below) | -| `.Committer` | `User` | the comitter of the commit (see below) | +| `.Committer` | `User` | the committer of the commit (see below) | | `.Subject` | `string` | the commit subject | | `.Timestamp` | `time.Time` | the commit timestamp | | `.Sha` | `string` | the commit SHA1 | diff --git a/website/docs/segments/owm.mdx b/website/docs/segments/owm.mdx index 4f362ba8..f755405f 100644 --- a/website/docs/segments/owm.mdx +++ b/website/docs/segments/owm.mdx @@ -42,7 +42,7 @@ import Config from "@site/src/components/Config.js"; | `api_key` | `string` | `.` | Your API key from [Open Weather Map][owm]. Can also be set using the `POSH_OWM_API_KEY` environment variable. | | `latitude` | `float64` | `91` | The latitude of the requested location, valid between -90 and 90 | | `longitude` | `float64` | `181` | The longitude of the requested location, valid between -180 and 180 | -| `location` | `string` | `De Bilt,NL` | The requested location interpretted only if valid coordinates aren't given. Formatted as \. City name, state code and country code divided by comma. Please, refer to ISO 3166 for the state codes or country codes | +| `location` | `string` | `De Bilt,NL` | The requested location interpreted only if valid coordinates aren't given. Formatted as \. City name, state code and country code divided by comma. Please, refer to ISO 3166 for the state codes or country codes | | `units` | `string` | `standard` | Units of measurement. Available values are standard (kelvin), metric (celsius), and imperial (fahrenheit) | | `http_timeout` | `int` | `20` | in milliseconds, the timeout for http request | | `cache_timeout` | `int` | `10` | in minutes, the timeout for request caching. A value of 0 disables the cache. | From d152e4bd9ef73edef1bf9286ccf056c939ec7ea2 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 29 Apr 2024 19:54:47 +0000 Subject: [PATCH 108/157] docs: update website/docs/contributors.md [skip ci] --- website/docs/contributors.md | 1 + 1 file changed, 1 insertion(+) diff --git a/website/docs/contributors.md b/website/docs/contributors.md index e4736a25..ea334fda 100644 --- a/website/docs/contributors.md +++ b/website/docs/contributors.md @@ -340,6 +340,7 @@ Thanks goes to these wonderful people ([emoji key][acek]): R00dRallec
R00dRallec

💻 📖 Justin Wolfington
Justin Wolfington

💻 Jack Tracey
Jack Tracey

🎨 + MarkDaveny
MarkDaveny

💻 🎨 📖 From 892e264a45c95e9ee2197dfb4e615e708bd11635 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 29 Apr 2024 19:54:48 +0000 Subject: [PATCH 109/157] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index db80986f..beb5598d 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2387,6 +2387,17 @@ "contributions": [ "design" ] + }, + { + "login": "MarkDaveny", + "name": "MarkDaveny", + "avatar_url": "https://avatars.githubusercontent.com/u/168091250?v=4", + "profile": "https://github.com/MarkDaveny", + "contributions": [ + "code", + "design", + "doc" + ] } ], "contributorsPerLine": 7, From dd3a0e64daec084f840cf64f3828d48f819a456f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 30 Apr 2024 00:57:48 +0000 Subject: [PATCH 110/157] chore(deps): bump golangci/golangci-lint-action from 5.0.0 to 5.1.0 Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 5.0.0 to 5.1.0. - [Release notes](https://github.com/golangci/golangci-lint-action/releases) - [Commits](https://github.com/golangci/golangci-lint-action/compare/82d40c283aeb1f2b6595839195e95c2d6a49081b...9d1e0624a798bb64f6c3cea93db47765312263dc) --- updated-dependencies: - dependency-name: golangci/golangci-lint-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/code.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/code.yml b/.github/workflows/code.yml index 2d94df65..999f80a4 100644 --- a/.github/workflows/code.yml +++ b/.github/workflows/code.yml @@ -27,7 +27,7 @@ jobs: - name: Checkout code uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b - name: Golang CI - uses: golangci/golangci-lint-action@82d40c283aeb1f2b6595839195e95c2d6a49081b + uses: golangci/golangci-lint-action@9d1e0624a798bb64f6c3cea93db47765312263dc with: working-directory: src - name: Unit Tests From b3ead100d2ac331785564ee6aa05ec5336e04ba2 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer <2492783+JanDeDobbeleer@users.noreply.github.com> Date: Tue, 30 Apr 2024 08:31:02 +0200 Subject: [PATCH 111/157] feat(iterm): add extension support resolves #4834 --- src/segments/iterm.go | 58 +++++++++++++++----------- src/segments/iterm_test.go | 8 ++-- website/docs/configuration/general.mdx | 2 +- website/docs/segments/iterm.mdx | 38 +++++++++++------ 4 files changed, 63 insertions(+), 43 deletions(-) diff --git a/src/segments/iterm.go b/src/segments/iterm.go index 0e461948..c4bae7fa 100644 --- a/src/segments/iterm.go +++ b/src/segments/iterm.go @@ -1,7 +1,7 @@ package segments import ( - "errors" + "fmt" "github.com/jandedobbeleer/oh-my-posh/src/platform" "github.com/jandedobbeleer/oh-my-posh/src/properties" @@ -11,8 +11,6 @@ import ( type ITerm struct { props properties.Properties env platform.Environment - - PromptMark string } func (i *ITerm) Template() string { @@ -20,39 +18,49 @@ func (i *ITerm) Template() string { } func (i *ITerm) Enabled() bool { - promptMark, err := i.getResult() - if err != nil { - i.env.Error(err) - return false - } - i.PromptMark = promptMark - - return true + return i.env.Getenv("TERM_PROGRAM") == "iTerm.app" } -func (i *ITerm) getResult() (string, error) { - var response string - // First, check if we're using iTerm - if i.env.Getenv("TERM_PROGRAM") != "iTerm.app" { - return "", errors.New("Only works with iTerm") - } - +func (i *ITerm) PromptMark() string { // Check to ensure the user has squelched the default mark for BASH and ZSH if i.env.Getenv("ITERM2_SQUELCH_MARK") != "1" { - return "", errors.New("iTerm default mark enabled (export ITERM2_SQUELCH_MARK=1)") + i.env.Debug("iTerm default mark enabled, adjust using export ITERM2_SQUELCH_MARK=1") + return "" } - // Now, set the mark string based on shell (or error out) + sh := i.env.Shell() + if sh != shell.ZSH && sh != shell.BASH { + i.env.Debug("Shell is not ZSH or BASH, cannot set prompt mark") + return "" + } + + return i.format("$(iterm2_prompt_mark)") +} + +func (i *ITerm) CurrentDir() string { + dir := fmt.Sprintf("\x1b]1337;CurrentDir=%s\x07", i.env.Pwd()) + return i.format(dir) +} + +func (i *ITerm) RemoteHost() string { + host, err := i.env.Host() + if err != nil { + return "" + } + + remoteHost := fmt.Sprintf("\x1b]1337;RemoteHost=%s@%s\x07", i.env.User(), host) + return i.format(remoteHost) +} + +func (i *ITerm) format(input string) string { switch i.env.Shell() { case shell.ZSH: - response = `%{$(iterm2_prompt_mark)%}` + return fmt.Sprintf(`%%{%s%%}`, input) case shell.BASH: - response = `\[$(iterm2_prompt_mark)\]` + return fmt.Sprintf(`\[%s\]`, input) default: - return "", errors.New("Shell isn't compatible with iTerm Shell Integration") + return input } - - return response, nil } func (i *ITerm) Init(props properties.Properties, env platform.Environment) { diff --git a/src/segments/iterm_test.go b/src/segments/iterm_test.go index 8f874eeb..a1cb73e6 100644 --- a/src/segments/iterm_test.go +++ b/src/segments/iterm_test.go @@ -20,12 +20,12 @@ func TestITermSegment(t *testing.T) { ExpectedDisabled bool }{ {Case: "not iterm", TermProgram: "", SquelchMark: "1", Shell: "zsh", ExpectedDisabled: true}, - {Case: "default mark", TermProgram: "iTerm.app", Shell: "zsh", Template: "{{ .PromptMark }}", ExpectedDisabled: true}, + {Case: "default mark", TermProgram: "iTerm.app", Shell: "zsh", Template: "{{ .PromptMark }}", ExpectedDisabled: false}, {Case: "zsh", TermProgram: "iTerm.app", SquelchMark: "1", Shell: "zsh", Template: "{{ .PromptMark }}", ExpectedString: `%{$(iterm2_prompt_mark)%}`}, {Case: "bash", TermProgram: "iTerm.app", SquelchMark: "1", Shell: "bash", Template: "{{ .PromptMark }}", ExpectedString: `\[$(iterm2_prompt_mark)\]`}, - {Case: "fish", TermProgram: "iTerm.app", SquelchMark: "1", Shell: "fish", Template: "{{ .PromptMark }}", ExpectedDisabled: true}, - {Case: "pwsh", TermProgram: "iTerm.app", SquelchMark: "1", Shell: "pwsh", Template: "{{ .PromptMark }}", ExpectedDisabled: true}, - {Case: "gibberishshell", TermProgram: "iTerm.app", SquelchMark: "1", Shell: "jaserhuashf", Template: "{{ .PromptMark }}", ExpectedDisabled: true}, + {Case: "fish", TermProgram: "iTerm.app", SquelchMark: "1", Shell: "fish", Template: "{{ .PromptMark }}", ExpectedDisabled: false}, + {Case: "pwsh", TermProgram: "iTerm.app", SquelchMark: "1", Shell: "pwsh", Template: "{{ .PromptMark }}", ExpectedDisabled: false}, + {Case: "gibberishshell", TermProgram: "iTerm.app", SquelchMark: "1", Shell: "jaserhuashf", Template: "{{ .PromptMark }}", ExpectedDisabled: false}, } for _, tc := range cases { diff --git a/website/docs/configuration/general.mdx b/website/docs/configuration/general.mdx index 4357f3c2..e6c2cc6c 100644 --- a/website/docs/configuration/general.mdx +++ b/website/docs/configuration/general.mdx @@ -129,7 +129,7 @@ For example, the following is a valid `--config` flag: | Name | Type | Description | | ---------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `final_space` | `boolean` | when true adds a space at the end of the prompt | -| `pwd` | `string` | notify terminal of current working directory, values can be `osc99`, `osc7`, or `osc51` depending on your terminal. Supports [templates][templates] | +| `pwd` | `string` | notify terminal of current working directory, values can be `osc99`, `osc7` or `osc51` depending on your terminal. Supports [templates][templates] | | `terminal_background` | `string` | [color][colors] - terminal background color, set to your terminal's background color when you notice black elements in Windows Terminal or the Visual Studio Code integrated terminal | | `accent_color` | `string` | [color][colors] - accent color, used as a fallback when the `accent` [color][accent] is not supported | | `var` | `map[string]any` | config variables to use in [templates][templates]. Can be any value | diff --git a/website/docs/segments/iterm.mdx b/website/docs/segments/iterm.mdx index 904fb34d..4ca42fb5 100644 --- a/website/docs/segments/iterm.mdx +++ b/website/docs/segments/iterm.mdx @@ -6,15 +6,16 @@ sidebar_label: iTerm ## What -Inserts the iTerm2 shell integration prompt mark for zsh, and bash. -For more information, read the [shell integration page][int-page] on +Inserts iTerm2 shell integration prompt marks and extensions. This segment has no visible output +but is used to enable iTerm2 terminal features. +For more information, read the [shell integration][int-page] and [extension page][ext-page] on the developer's website. -:::info +:::info PromptMark in Bash and ZSH You will need to add `export ITERM2_SQUELCH_MARK=1` before the shell integration script is sourced. ::: -:::info Fish shell +:::info PromptMark in Fish shell For fish, you can make use of Oh My Posh's `set_poshcontext` function to set the prompt mark. Add the following line after initialising Oh My Posh: @@ -24,20 +25,22 @@ function set_poshcontext end ``` -You do not need to add this segment. +You do not need to add this segment to use the prompt mark. ::: ## Sample Configuration -import Config from '@site/src/components/Config.js'; +import Config from "@site/src/components/Config.js"; - + ## Template ([info][templates]) @@ -49,5 +52,14 @@ import Config from '@site/src/components/Config.js'; ::: +### Properties + +| Name | Type | Description | +| ------------- | -------- | --------------------------------------------------- | +| `.PromptMark` | `string` | inserts the prompt mark to enable shell integration | +| `.CurrentDir` | `string` | inserts the current directory | +| `.RemoteHost` | `string` | inserts the current user and host name | + [templates]: /docs/configuration/templates [int-page]: https://iterm2.com/documentation-shell-integration.html +[ext-page]: https://iterm2.com/documentation-escape-codes.html From b460faeda7581838d5f95662d268e0d5ef9bfe64 Mon Sep 17 00:00:00 2001 From: ivan-the-terrible Date: Wed, 1 May 2024 12:06:51 -0400 Subject: [PATCH 112/157] fix(schema): update max and min cols to width --- themes/schema.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/themes/schema.json b/themes/schema.json index 89b11823..a7583fad 100644 --- a/themes/schema.json +++ b/themes/schema.json @@ -425,16 +425,16 @@ "join" ] }, - "max_cols": { + "max_width": { "type": "integer", "title": "if the terminal width exceeds this value, the segment will be hidden", - "description": "https://ohmyposh.dev/docs/configuration/segment#max_cols", + "description": "https://ohmyposh.dev/docs/configuration/segment", "default": 0 }, - "min_cols": { + "min_width": { "type": "integer", "title": "if the terminal width is inferior than this value, the segment will be hidden", - "description": "https://ohmyposh.dev/docs/configuration/segment#min_cols", + "description": "https://ohmyposh.dev/docs/configuration/segment", "default": 0 }, "properties": { From baf3adbed2bc552a507f6286f6f777b4d821779f Mon Sep 17 00:00:00 2001 From: ivan-the-terrible Date: Wed, 1 May 2024 12:15:23 -0400 Subject: [PATCH 113/157] fix(schema): remove nonexistent targets from URLs --- themes/schema.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/themes/schema.json b/themes/schema.json index a7583fad..0d0853f6 100644 --- a/themes/schema.json +++ b/themes/schema.json @@ -286,7 +286,7 @@ "type": { "type": "string", "title": "Segment Type", - "description": "https://ohmyposh.dev/docs/configuration/segment#type", + "description": "https://ohmyposh.dev/docs/configuration/segment", "enum": [ "az", "aws", @@ -414,12 +414,12 @@ }, "templates": { "$ref": "#/definitions/templates", - "description": "https://ohmyposh.dev/docs/configuration/segment#templates" + "description": "https://ohmyposh.dev/docs/configuration/segment" }, "templates_logic": { "type": "string", "title": "Templates Logic", - "description": "https://ohmyposh.dev/docs/configuration/segment#templates", + "description": "https://ohmyposh.dev/docs/configuration/segment", "enum": [ "first_match", "join" @@ -476,13 +476,13 @@ "interactive": { "type": "boolean", "title": "Allow the use of interactive prompt escape sequences", - "description": "https://ohmyposh.dev/docs/configuration/segment#interactive", + "description": "https://ohmyposh.dev/docs/configuration/segment", "default": false }, "alias": { "type": "string", "title": "Give the segment an alias for use in templates", - "description": "https://ohmyposh.dev/docs/configuration/segment#alias", + "description": "https://ohmyposh.dev/docs/configuration/segment", "default": "" } }, From 619387aa9e417328a39251eb41d0345f27cbb7ca Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 2 May 2024 00:32:26 +0000 Subject: [PATCH 114/157] chore(deps): bump github.com/charmbracelet/bubbletea in /src Bumps [github.com/charmbracelet/bubbletea](https://github.com/charmbracelet/bubbletea) from 0.25.0 to 0.26.0. - [Release notes](https://github.com/charmbracelet/bubbletea/releases) - [Commits](https://github.com/charmbracelet/bubbletea/compare/v0.25.0...v0.26.0) --- updated-dependencies: - dependency-name: github.com/charmbracelet/bubbletea dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- src/go.mod | 8 ++++---- src/go.sum | 17 +++++++++-------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/go.mod b/src/go.mod index 4b85beb9..ef018597 100644 --- a/src/go.mod +++ b/src/go.mod @@ -29,7 +29,7 @@ require ( require ( github.com/ConradIrwin/font v0.0.0-20210318200717-ce8d41cc0732 github.com/charmbracelet/bubbles v0.18.0 - github.com/charmbracelet/bubbletea v0.25.0 + github.com/charmbracelet/bubbletea v0.26.0 github.com/charmbracelet/lipgloss v0.10.0 github.com/goccy/go-json v0.10.2 github.com/goccy/go-yaml v1.11.3 @@ -66,8 +66,8 @@ require ( github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect github.com/atotto/clipboard v0.1.4 // indirect github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect - github.com/containerd/console v1.0.4 // indirect github.com/dsnet/compress v0.0.1 // indirect + github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect github.com/fatih/color v1.16.0 // indirect github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect github.com/google/go-cmp v0.6.0 // indirect @@ -87,8 +87,8 @@ require ( github.com/shopspring/decimal v1.3.1 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect github.com/zclconf/go-cty v1.14.3 // indirect - golang.org/x/sync v0.6.0 // indirect - golang.org/x/term v0.18.0 // indirect + golang.org/x/sync v0.7.0 // indirect + golang.org/x/term v0.19.0 // indirect golang.org/x/tools v0.19.0 // indirect golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect ) diff --git a/src/go.sum b/src/go.sum index 8dfa993d..87e09a8f 100644 --- a/src/go.sum +++ b/src/go.sum @@ -25,12 +25,10 @@ github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiE github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= github.com/charmbracelet/bubbles v0.18.0 h1:PYv1A036luoBGroX6VWjQIE9Syf2Wby2oOl/39KLfy0= github.com/charmbracelet/bubbles v0.18.0/go.mod h1:08qhZhtIwzgrtBjAcJnij1t1H0ZRjwHyGsy6AL11PSw= -github.com/charmbracelet/bubbletea v0.25.0 h1:bAfwk7jRz7FKFl9RzlIULPkStffg5k6pNt5dywy4TcM= -github.com/charmbracelet/bubbletea v0.25.0/go.mod h1:EN3QDR1T5ZdWmdfDzYcqOCAps45+QIJbLOBxmVNWNNg= +github.com/charmbracelet/bubbletea v0.26.0 h1:LRS2uBclVfqh3gWBmU8uso2fXBsroW2Nb6HtAHfzbJI= +github.com/charmbracelet/bubbletea v0.26.0/go.mod h1:FzKr7sKoO8iFVcdIBM9J0sJOcQv5nDQaYwsee3kpbgo= github.com/charmbracelet/lipgloss v0.10.0 h1:KWeXFSexGcfahHX+54URiZGkBFazf70JNMtwg/AFW3s= github.com/charmbracelet/lipgloss v0.10.0/go.mod h1:Wig9DSfvANsxqkRsqj6x87irdy123SR4dOXlKa91ciE= -github.com/containerd/console v1.0.4 h1:F2g4+oChYvBTsASRTz8NP6iIAi97J3TtSAsLbIFn4ro= -github.com/containerd/console v1.0.4/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk= github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -38,6 +36,8 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/dsnet/compress v0.0.1 h1:PlZu0n3Tuv04TzpfPbrnI0HW/YwodEXDS+oPKahKF0Q= github.com/dsnet/compress v0.0.1/go.mod h1:Aw8dCMJ7RioblQeTqt88akK31OvO8Dhf5JflhBbQEHo= github.com/dsnet/golib v0.0.0-20171103203638-1ea166775780/go.mod h1:Lj+Z9rebOhdfkVLjJ8T6VcRQv3SXugXy999NBtR9aFY= +github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f h1:Y/CXytFA4m6baUTXGLOoWe4PQhGxaX0KpnayAqC48p4= +github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f/go.mod h1:vw97MGsxSvLiUE2X8qFplwetxpGLQrlU1Q9AUEIzCaM= github.com/esimov/stackblur-go v1.1.0 h1:fwnZJC/7sHFzu4CDMgdJ1QxMN/q3k5MGILuoU4hH6oQ= github.com/esimov/stackblur-go v1.1.0/go.mod h1:7PcTPCHHKStxbZvBkUlQJjRclqjnXtQ0NoORZt1AlHE= github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= @@ -215,14 +215,15 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= -golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -237,8 +238,8 @@ golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= -golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8= -golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= +golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q= +golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= From bd428a13729b7f160ecb245bb6347f487c6abe3e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 2 May 2024 00:32:39 +0000 Subject: [PATCH 115/157] chore(deps): bump github.com/shirou/gopsutil/v3 in /src Bumps [github.com/shirou/gopsutil/v3](https://github.com/shirou/gopsutil) from 3.24.3 to 3.24.4. - [Release notes](https://github.com/shirou/gopsutil/releases) - [Commits](https://github.com/shirou/gopsutil/compare/v3.24.3...v3.24.4) --- updated-dependencies: - dependency-name: github.com/shirou/gopsutil/v3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/go.mod | 2 +- src/go.sum | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/go.mod b/src/go.mod index ef018597..0a6294d4 100644 --- a/src/go.mod +++ b/src/go.mod @@ -15,7 +15,7 @@ require ( github.com/huandu/xstrings v1.4.0 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect github.com/sergi/go-diff v1.3.1 // indirect - github.com/shirou/gopsutil/v3 v3.24.3 + github.com/shirou/gopsutil/v3 v3.24.4 github.com/stretchr/objx v0.5.2 // indirect github.com/stretchr/testify v1.9.0 github.com/wayneashleyberry/terminal-dimensions v1.1.0 diff --git a/src/go.sum b/src/go.sum index 87e09a8f..66811356 100644 --- a/src/go.sum +++ b/src/go.sum @@ -148,8 +148,8 @@ github.com/sahilm/fuzzy v0.1.1 h1:ceu5RHF8DGgoi+/dR5PsECjCDH1BE3Fnmpo7aVXOdRA= github.com/sahilm/fuzzy v0.1.1/go.mod h1:VFvziUEIMCrT6A6tw2RFIXPXXmzXbOsSHF0DOI8ZK9Y= github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= -github.com/shirou/gopsutil/v3 v3.24.3 h1:eoUGJSmdfLzJ3mxIhmOAhgKEKgQkeOwKpz1NbhVnuPE= -github.com/shirou/gopsutil/v3 v3.24.3/go.mod h1:JpND7O217xa72ewWz9zN2eIIkPWsDN/3pl0H8Qt0uwg= +github.com/shirou/gopsutil/v3 v3.24.4 h1:dEHgzZXt4LMNm+oYELpzl9YCqV65Yr/6SfrvgRBtXeU= +github.com/shirou/gopsutil/v3 v3.24.4/go.mod h1:lTd2mdiOspcqLgAnr9/nGi71NkeMpWKdmhuxm9GusH8= github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM= github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ= github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU= @@ -232,7 +232,6 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= From 8388bae83b76a627f1b82bef159f76b42b712b83 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 2 May 2024 00:32:31 +0000 Subject: [PATCH 116/157] chore(deps): bump github.com/pelletier/go-toml/v2 in /src Bumps [github.com/pelletier/go-toml/v2](https://github.com/pelletier/go-toml) from 2.2.1 to 2.2.2. - [Release notes](https://github.com/pelletier/go-toml/releases) - [Changelog](https://github.com/pelletier/go-toml/blob/v2/.goreleaser.yaml) - [Commits](https://github.com/pelletier/go-toml/compare/v2.2.1...v2.2.2) --- updated-dependencies: - dependency-name: github.com/pelletier/go-toml/v2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/go.mod | 2 +- src/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/go.mod b/src/go.mod index 0a6294d4..03bb5453 100644 --- a/src/go.mod +++ b/src/go.mod @@ -36,7 +36,7 @@ require ( github.com/gookit/goutil v0.6.15 github.com/hashicorp/hcl/v2 v2.20.1 github.com/mattn/go-runewidth v0.0.15 - github.com/pelletier/go-toml/v2 v2.2.1 + github.com/pelletier/go-toml/v2 v2.2.2 github.com/spf13/cobra v1.8.0 github.com/spf13/pflag v1.0.5 golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 diff --git a/src/go.sum b/src/go.sum index 66811356..2f74cbfe 100644 --- a/src/go.sum +++ b/src/go.sum @@ -130,8 +130,8 @@ github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s= github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8= github.com/muesli/termenv v0.15.2 h1:GohcuySI0QmI3wN8Ok9PtKGkgkFIk7y6Vpb5PvrY+Wo= github.com/muesli/termenv v0.15.2/go.mod h1:Epx+iuz8sNs7mNKhxzH4fWXGNpZwUaJKRS1noLXviQ8= -github.com/pelletier/go-toml/v2 v2.2.1 h1:9TA9+T8+8CUCO2+WYnDLCgrYi9+omqKXyjDtosvtEhg= -github.com/pelletier/go-toml/v2 v2.2.1/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= +github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= From 38f6092b40c2543258e8007ed01a3a731c187ed1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 3 May 2024 00:24:03 +0000 Subject: [PATCH 117/157] chore(deps): bump actions/setup-go from 5.0.0 to 5.0.1 Bumps [actions/setup-go](https://github.com/actions/setup-go) from 5.0.0 to 5.0.1. - [Release notes](https://github.com/actions/setup-go/releases) - [Commits](https://github.com/actions/setup-go/compare/0c52d547c9bc32b1aa3301fd7a9cb496313a4491...cdcb36043654635271a94b9a6d1392de5bb323a7) --- updated-dependencies: - dependency-name: actions/setup-go dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/code.yml | 2 +- .github/workflows/codeql.yml | 2 +- .github/workflows/docs.yml | 2 +- .github/workflows/gomod.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/code.yml b/.github/workflows/code.yml index 999f80a4..3c8ab012 100644 --- a/.github/workflows/code.yml +++ b/.github/workflows/code.yml @@ -20,7 +20,7 @@ jobs: working-directory: ${{ github.workspace }}/src steps: - name: Install Go - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 + uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 with: go-version: 1.21 cache-dependency-path: src/go.sum diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index f0d73f31..baa42c78 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -20,7 +20,7 @@ jobs: working-directory: ${{ github.workspace }}/src steps: - name: Install Go - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 + uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 with: go-version: 1.21 cache-dependency-path: src/go.sum diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 672bf36d..6799f301 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -23,7 +23,7 @@ jobs: submodules: true persist-credentials: false - name: Install Go - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 + uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 with: go-version: 1.21 cache-dependency-path: src/go.sum diff --git a/.github/workflows/gomod.yml b/.github/workflows/gomod.yml index 81d64183..945bf5ee 100644 --- a/.github/workflows/gomod.yml +++ b/.github/workflows/gomod.yml @@ -10,7 +10,7 @@ jobs: working-directory: ${{ github.workspace }}/src steps: - name: Install Go - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 + uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 with: go-version: 1.21 cache-dependency-path: src/go.sum From 4179476fe464d265442676bfe74328ae5b209f9a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 3 May 2024 01:00:00 +0000 Subject: [PATCH 118/157] chore(deps): bump github.com/charmbracelet/bubbletea in /src Bumps [github.com/charmbracelet/bubbletea](https://github.com/charmbracelet/bubbletea) from 0.26.0 to 0.26.1. - [Release notes](https://github.com/charmbracelet/bubbletea/releases) - [Commits](https://github.com/charmbracelet/bubbletea/compare/v0.26.0...v0.26.1) --- updated-dependencies: - dependency-name: github.com/charmbracelet/bubbletea dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/go.mod | 2 +- src/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/go.mod b/src/go.mod index 03bb5453..404ed6e5 100644 --- a/src/go.mod +++ b/src/go.mod @@ -29,7 +29,7 @@ require ( require ( github.com/ConradIrwin/font v0.0.0-20210318200717-ce8d41cc0732 github.com/charmbracelet/bubbles v0.18.0 - github.com/charmbracelet/bubbletea v0.26.0 + github.com/charmbracelet/bubbletea v0.26.1 github.com/charmbracelet/lipgloss v0.10.0 github.com/goccy/go-json v0.10.2 github.com/goccy/go-yaml v1.11.3 diff --git a/src/go.sum b/src/go.sum index 2f74cbfe..28496ed7 100644 --- a/src/go.sum +++ b/src/go.sum @@ -25,8 +25,8 @@ github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiE github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= github.com/charmbracelet/bubbles v0.18.0 h1:PYv1A036luoBGroX6VWjQIE9Syf2Wby2oOl/39KLfy0= github.com/charmbracelet/bubbles v0.18.0/go.mod h1:08qhZhtIwzgrtBjAcJnij1t1H0ZRjwHyGsy6AL11PSw= -github.com/charmbracelet/bubbletea v0.26.0 h1:LRS2uBclVfqh3gWBmU8uso2fXBsroW2Nb6HtAHfzbJI= -github.com/charmbracelet/bubbletea v0.26.0/go.mod h1:FzKr7sKoO8iFVcdIBM9J0sJOcQv5nDQaYwsee3kpbgo= +github.com/charmbracelet/bubbletea v0.26.1 h1:xujcQeF73rh4jwu3+zhfQsvV18x+7zIjlw7/CYbzGJ0= +github.com/charmbracelet/bubbletea v0.26.1/go.mod h1:FzKr7sKoO8iFVcdIBM9J0sJOcQv5nDQaYwsee3kpbgo= github.com/charmbracelet/lipgloss v0.10.0 h1:KWeXFSexGcfahHX+54URiZGkBFazf70JNMtwg/AFW3s= github.com/charmbracelet/lipgloss v0.10.0/go.mod h1:Wig9DSfvANsxqkRsqj6x87irdy123SR4dOXlKa91ciE= github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= From f03c6cb00c32ab0e298eb67a5569ac549b2413c9 Mon Sep 17 00:00:00 2001 From: Ivan <56458442+ivan-the-terrible@users.noreply.github.com> Date: Sat, 4 May 2024 01:56:15 -0400 Subject: [PATCH 119/157] feat(segment): add talosctl --- src/engine/segment.go | 3 + src/segments/talosctl.go | 56 ++++++++++++++++++ src/segments/talosctl_test.go | 95 ++++++++++++++++++++++++++++++ themes/cloud-context.omp.json | 9 +++ themes/schema.json | 14 +++++ website/docs/segments/talosctl.mdx | 47 +++++++++++++++ website/sidebars.js | 1 + 7 files changed, 225 insertions(+) create mode 100644 src/segments/talosctl.go create mode 100644 src/segments/talosctl_test.go create mode 100644 website/docs/segments/talosctl.mdx diff --git a/src/engine/segment.go b/src/engine/segment.go index 7be2413e..8c55a265 100644 --- a/src/engine/segment.go +++ b/src/engine/segment.go @@ -240,6 +240,8 @@ const ( SWIFT SegmentType = "swift" // SYSTEMINFO writes system information (memory, cpu, load) SYSTEMINFO SegmentType = "sysinfo" + // TALOSCTL writes the talosctl context + TALOSCTL SegmentType = "talosctl" // TERRAFORM writes the terraform workspace we're currently in TERRAFORM SegmentType = "terraform" // TEXT writes a text @@ -345,6 +347,7 @@ var Segments = map[SegmentType]func() SegmentWriter{ SVN: func() SegmentWriter { return &segments.Svn{} }, SWIFT: func() SegmentWriter { return &segments.Swift{} }, SYSTEMINFO: func() SegmentWriter { return &segments.SystemInfo{} }, + TALOSCTL: func() SegmentWriter { return &segments.TalosCTL{} }, TERRAFORM: func() SegmentWriter { return &segments.Terraform{} }, TEXT: func() SegmentWriter { return &segments.Text{} }, TIME: func() SegmentWriter { return &segments.Time{} }, diff --git a/src/segments/talosctl.go b/src/segments/talosctl.go new file mode 100644 index 00000000..fe6d9fc5 --- /dev/null +++ b/src/segments/talosctl.go @@ -0,0 +1,56 @@ +package segments + +import ( + "errors" + "path/filepath" + + "github.com/jandedobbeleer/oh-my-posh/src/platform" + "github.com/jandedobbeleer/oh-my-posh/src/properties" + "gopkg.in/yaml.v3" +) + +type TalosCTL struct { + props properties.Properties + env platform.Environment + + Context string `yaml:"context"` +} + +func (t *TalosCTL) Template() string { + return " {{ .Context}} " +} + +func (t *TalosCTL) Init(props properties.Properties, env platform.Environment) { + t.props = props + t.env = env +} + +func (t *TalosCTL) Enabled() bool { + cfgDir := filepath.Join(t.env.Home(), ".talos") + configFile, err := t.getActiveConfig(cfgDir) + if err != nil { + t.env.Error(err) + return false + } + + err = yaml.Unmarshal([]byte(configFile), t) + if err != nil { + t.env.Error(err) + return false + } + + if len(t.Context) == 0 { + return false + } + + return true +} + +func (t *TalosCTL) getActiveConfig(cfgDir string) (string, error) { + activeConfigFile := filepath.Join(cfgDir, "config") + activeConfigData := t.env.FileContent(activeConfigFile) + if len(activeConfigData) == 0 { + return "", errors.New("NO ACTIVE CONFIG FOUND") + } + return activeConfigData, nil +} diff --git a/src/segments/talosctl_test.go b/src/segments/talosctl_test.go new file mode 100644 index 00000000..5c565835 --- /dev/null +++ b/src/segments/talosctl_test.go @@ -0,0 +1,95 @@ +package segments + +import ( + "path/filepath" + "testing" + + "github.com/jandedobbeleer/oh-my-posh/src/mock" + "github.com/stretchr/testify/assert" + mock2 "github.com/stretchr/testify/mock" +) + +func TestTalosctlSegment(t *testing.T) { + cases := []struct { + Case string + ActiveConfig string + ExpectedEnabled bool + ExpectedString string + }{ + { + Case: "happy path", + ExpectedEnabled: true, + ActiveConfig: "context: context-name", + ExpectedString: "context-name", + }, + { + Case: "no active config", + ExpectedEnabled: false, + }, + { + Case: "empty config", + ActiveConfig: "", + ExpectedEnabled: false, + }, + { + Case: "bad config", + ActiveConfig: "other-yaml: not-expected", + ExpectedEnabled: false, + }, + } + + for _, tc := range cases { + env := new(mock.MockedEnvironment) + env.On("Home").Return("home") + fcPath := filepath.Join("home", ".talos", "config") + env.On("FileContent", fcPath).Return(tc.ActiveConfig) + env.On("Error", mock2.Anything).Return() + talos := TalosCTL{ + env: env, + } + talos.Enabled() + assert.Equal(t, tc.ExpectedEnabled, talos.Enabled()) + if tc.ExpectedEnabled { + assert.Equal(t, tc.ExpectedString, renderTemplate(env, talos.Template(), talos), tc.Case) + } + } +} + +func TestGetTalosctlActiveConfig(t *testing.T) { + cases := []struct { + Case string + ActiveConfig string + ExpectedString string + ExpectedError string + }{ + { + Case: "happy path", + ActiveConfig: "context: context-name", + ExpectedString: "context: context-name", + }, + { + Case: "no active config", + ActiveConfig: "", + ExpectedError: "NO ACTIVE CONFIG FOUND", + }, + } + + for _, tc := range cases { + env := new(mock.MockedEnvironment) + env.On("Home").Return("home") + configPath := filepath.Join("home", ".talos") + contentPath := filepath.Join(configPath, "config") + env.On("FileContent", contentPath).Return(tc.ActiveConfig) + env.On("Error", mock2.Anything).Return() + talos := TalosCTL{ + env: env, + } + got, err := talos.getActiveConfig(configPath) + assert.Equal(t, tc.ExpectedString, got, tc.Case) + if len(tc.ExpectedError) > 0 { + assert.EqualError(t, err, tc.ExpectedError, tc.Case) + } else { + assert.NoError(t, err, tc.Case) + } + } +} diff --git a/themes/cloud-context.omp.json b/themes/cloud-context.omp.json index d2bf2627..61acfd4f 100644 --- a/themes/cloud-context.omp.json +++ b/themes/cloud-context.omp.json @@ -12,6 +12,7 @@ "error-text": "#242424", "git-text": "#238636", "kubernetes-text": "#FFBB00", + "talosctl-text": "#FF6C00", "symbol-color": "#ffffff", "timer-text": "#dd0033" }, @@ -39,6 +40,14 @@ "template": "\uf308 {{.Context}}{{if .Namespace}} \uf061 {{.Namespace}}{{end}}", "type": "kubectl" }, + { + "background": "p:background-color", + "foreground": "p:talosctl-text", + "style": "powerline", + "powerline_symbol": "\ue0b4", + "template": "\udb84\udcfe {{.Context}}", + "type": "talosctl" + }, { "background": "p:background-color", "foreground": "p:cloud-text-amazon", diff --git a/themes/schema.json b/themes/schema.json index 0d0853f6..f9e249b3 100644 --- a/themes/schema.json +++ b/themes/schema.json @@ -360,6 +360,7 @@ "strava", "svn", "swift", + "talosctl", "time", "text", "terraform", @@ -2779,6 +2780,19 @@ } } }, + { + "if": { + "properties": { + "type": { + "const": "talosctl" + } + } + }, + "then": { + "title": "Talosctl Segment", + "description": "https://ohmyposh.dev/docs/segments/talosctl" + } + }, { "if": { "properties": { diff --git a/website/docs/segments/talosctl.mdx b/website/docs/segments/talosctl.mdx new file mode 100644 index 00000000..0c2f4bcc --- /dev/null +++ b/website/docs/segments/talosctl.mdx @@ -0,0 +1,47 @@ +--- +id: talosctl +title: Talosctl Context +sidebar_label: Talosctl +--- + +## What + +Displays the currently active Talosctl context name. + +This segment leverages the `.talos/config` file generated by the [Talosctl CLI][talosctl]. +The CLI docs can be found by going to Documentation > Reference > CLI. +For example, [v1.7 CLI][CLI]. + +## Sample Configuration + +import Config from '@site/src/components/Config.js'; + + + +## Template ([info][templates]) + +:::note default template + +```template +{{ .Context }} +``` + +::: + +### Properties + +| Name | Type | Description | +| ------------ | -------- | ------------------------------------- | +| `.Context` | `string` | the current talosctl context | + + +[templates]: /docs/configuration/templates +[talosctl]: https://www.talos.dev/ +[CLI]: https://www.talos.dev/v1.7/reference/cli/ diff --git a/website/sidebars.js b/website/sidebars.js index 51ea96e6..870214be 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -123,6 +123,7 @@ module.exports = { "segments/svn", "segments/swift", "segments/sysinfo", + "segments/talosctl", "segments/terraform", "segments/text", "segments/time", From 1c8347287a397dad7a901d12d7cfbc3e890bb245 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Sat, 4 May 2024 07:48:27 +0200 Subject: [PATCH 120/157] fix(nu): support starting with --no-history resolves #4887 --- src/shell/scripts/omp.nu | 7 +++++-- website/docs/installation/customize.mdx | 2 +- website/docs/installation/prompt.mdx | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/shell/scripts/omp.nu b/src/shell/scripts/omp.nu index 15f17bc4..0bfba39b 100644 --- a/src/shell/scripts/omp.nu +++ b/src/shell/scripts/omp.nu @@ -23,12 +23,15 @@ $env.PROMPT_MULTILINE_INDICATOR = (^::OMP:: print secondary $"--config=($env.POS $env.PROMPT_COMMAND = { || # hack to set the cursor line to 1 when the user clears the screen # this obviously isn't bulletproof, but it's a start - let clear = (history | is-empty) or ((history | last 1 | get 0.command) == "clear") + mut clear = false + if $nu.history-enabled { + $clear = (history | is-empty) or ((history | last 1 | get 0.command) == "clear") + } ^::OMP:: print primary $"--config=($env.POSH_THEME)" --shell=nu $"--shell-version=($env.POSH_SHELL_VERSION)" $"--execution-time=(posh_cmd_duration)" $"--status=($env.LAST_EXIT_CODE)" $"--terminal-width=(posh_width)" $"--cleared=($clear)" } -$env.PROMPT_COMMAND_RIGHT = { || +$env.PROMPT_COMMAND_RIGHT = { || ^::OMP:: print right $"--config=($env.POSH_THEME)" --shell=nu $"--shell-version=($env.POSH_SHELL_VERSION)" $"--execution-time=(posh_cmd_duration)" $"--status=($env.LAST_EXIT_CODE)" $"--terminal-width=(posh_width)" } diff --git a/website/docs/installation/customize.mdx b/website/docs/installation/customize.mdx index bc6317f1..c489c8a0 100644 --- a/website/docs/installation/customize.mdx +++ b/website/docs/installation/customize.mdx @@ -158,7 +158,7 @@ Once altered, reload your config for the changes to take effect. :::caution -Oh My Posh requires Nushell v0.86.0 or higher. +Oh My Posh requires Nushell v0.93.0 or higher. ::: Adjust the Oh My Posh init line in the Nushell env file (`$nu.env-path`) by adding the `--config` flag diff --git a/website/docs/installation/prompt.mdx b/website/docs/installation/prompt.mdx index 777e00ab..986bf3a3 100644 --- a/website/docs/installation/prompt.mdx +++ b/website/docs/installation/prompt.mdx @@ -104,7 +104,7 @@ exec fish :::caution -Oh My Posh requires Nushell v0.86.0 or higher. +Oh My Posh requires Nushell v0.93.0 or higher. ::: Add the following line to the Nushell env file (`$nu.env-path`): From e5156a8d4484284447509206e923b2f577272627 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Sat, 4 May 2024 08:02:16 +0200 Subject: [PATCH 121/157] chore(lint): remove init check --- src/.golangci.yml | 1 - src/ansi/ansi_writer.go | 2 +- src/cli/cache.go | 2 +- src/cli/config.go | 2 +- src/cli/config_export.go | 2 +- src/cli/config_export_image.go | 2 +- src/cli/config_migrate.go | 2 +- src/cli/config_migrate_glyphs.go | 2 +- src/cli/debug.go | 2 +- src/cli/disable.go | 2 +- src/cli/enable.go | 2 +- src/cli/font.go | 2 +- src/cli/get.go | 2 +- src/cli/init.go | 2 +- src/cli/notice.go | 2 +- src/cli/print.go | 2 +- src/cli/prompt.go | 2 +- src/cli/root.go | 2 +- src/cli/toggle.go | 2 +- src/cli/version.go | 2 +- 20 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/.golangci.yml b/src/.golangci.yml index a6c3afe7..31fadd69 100644 --- a/src/.golangci.yml +++ b/src/.golangci.yml @@ -8,7 +8,6 @@ linters: - dupl - errcheck - exhaustive - - gochecknoinits - goconst - gocritic - gocyclo diff --git a/src/ansi/ansi_writer.go b/src/ansi/ansi_writer.go index 487253b7..1180400f 100644 --- a/src/ansi/ansi_writer.go +++ b/src/ansi/ansi_writer.go @@ -9,7 +9,7 @@ import ( "github.com/mattn/go-runewidth" ) -func init() { //nolint:gochecknoinits +func init() { runewidth.DefaultCondition.EastAsianWidth = false } diff --git a/src/cli/cache.go b/src/cli/cache.go index 820b2c04..e29850f4 100644 --- a/src/cli/cache.go +++ b/src/cli/cache.go @@ -57,7 +57,7 @@ You can do the following: }, } -func init() { //nolint:gochecknoinits +func init() { RootCmd.AddCommand(getCache) } diff --git a/src/cli/config.go b/src/cli/config.go index 560976ee..7b330c4e 100644 --- a/src/cli/config.go +++ b/src/cli/config.go @@ -39,6 +39,6 @@ You can export, migrate or edit the config.`, }, } -func init() { //nolint:gochecknoinits +func init() { RootCmd.AddCommand(configCmd) } diff --git a/src/cli/config_export.go b/src/cli/config_export.go index 4cd756af..ab769f96 100644 --- a/src/cli/config_export.go +++ b/src/cli/config_export.go @@ -96,7 +96,7 @@ func cleanOutputPath(path string, env platform.Environment) string { return filepath.Clean(path) } -func init() { //nolint:gochecknoinits +func init() { exportCmd.Flags().StringVarP(&format, "format", "f", "json", "config format to migrate to") exportCmd.Flags().StringVarP(&output, "output", "o", "", "config file to export to") configCmd.AddCommand(exportCmd) diff --git a/src/cli/config_export_image.go b/src/cli/config_export_image.go index 56c3f56c..9e5becbd 100644 --- a/src/cli/config_export_image.go +++ b/src/cli/config_export_image.go @@ -106,7 +106,7 @@ Exports the config to an image file using customized output options.`, }, } -func init() { //nolint:gochecknoinits +func init() { imageCmd.Flags().StringVar(&author, "author", "", "config author") imageCmd.Flags().StringVar(&bgColor, "background-color", "", "image background color") imageCmd.Flags().StringVarP(&outputImage, "output", "o", "", "image file (.png) to export to") diff --git a/src/cli/config_migrate.go b/src/cli/config_migrate.go index 2546deff..a01db01b 100644 --- a/src/cli/config_migrate.go +++ b/src/cli/config_migrate.go @@ -57,7 +57,7 @@ A backup of the current config can be found at ~/myconfig.omp.json.bak.`, }, } -func init() { //nolint:gochecknoinits +func init() { migrateCmd.Flags().BoolVarP(&write, "write", "w", false, "write the migrated config back to the config file") migrateCmd.Flags().StringVarP(&format, "format", "f", "json", "the config format to migrate to") configCmd.AddCommand(migrateCmd) diff --git a/src/cli/config_migrate_glyphs.go b/src/cli/config_migrate_glyphs.go index d6530616..c43cbf70 100644 --- a/src/cli/config_migrate_glyphs.go +++ b/src/cli/config_migrate_glyphs.go @@ -59,7 +59,7 @@ A backup of the current config can be found at ~/myconfig.omp.json.bak.`, }, } -func init() { //nolint:gochecknoinits +func init() { migrateGlyphsCmd.Flags().BoolVarP(&write, "write", "w", false, "write the migrated config back to the config file") migrateGlyphsCmd.Flags().StringVarP(&format, "format", "f", "", "the config format to migrate to") migrateCmd.AddCommand(migrateGlyphsCmd) diff --git a/src/cli/debug.go b/src/cli/debug.go index 30447b2f..475e2f4a 100644 --- a/src/cli/debug.go +++ b/src/cli/debug.go @@ -60,7 +60,7 @@ var debugCmd = &cobra.Command{ }, } -func init() { //nolint:gochecknoinits +func init() { debugCmd.Flags().StringVar(&pwd, "pwd", "", "current working directory") debugCmd.Flags().StringVar(&shellName, "shell", "", "the shell to print for") debugCmd.Flags().BoolVarP(&plain, "plain", "p", false, "plain text output (no ANSI)") diff --git a/src/cli/disable.go b/src/cli/disable.go index 47e3e3c2..a9ce42e7 100644 --- a/src/cli/disable.go +++ b/src/cli/disable.go @@ -22,6 +22,6 @@ var disableCmd = &cobra.Command{ }, } -func init() { //nolint:gochecknoinits +func init() { RootCmd.AddCommand(disableCmd) } diff --git a/src/cli/enable.go b/src/cli/enable.go index 02d66f75..684c5d19 100644 --- a/src/cli/enable.go +++ b/src/cli/enable.go @@ -37,7 +37,7 @@ var enableCmd = &cobra.Command{ }, } -func init() { //nolint:gochecknoinits +func init() { RootCmd.AddCommand(enableCmd) } diff --git a/src/cli/font.go b/src/cli/font.go index 62cd247b..39b387b9 100644 --- a/src/cli/font.go +++ b/src/cli/font.go @@ -65,7 +65,7 @@ This command is used to install fonts and configure the font in your terminal. } ) -func init() { //nolint:gochecknoinits +func init() { RootCmd.AddCommand(fontCmd) fontCmd.Flags().BoolVar(&user, "user", false, "install font as user") } diff --git a/src/cli/get.go b/src/cli/get.go index c244a22a..04ab9893 100644 --- a/src/cli/get.go +++ b/src/cli/get.go @@ -91,7 +91,7 @@ This command is used to get the value of the following variables: }, } -func init() { //nolint:gochecknoinits +func init() { RootCmd.AddCommand(getCmd) getCmd.Flags().StringVar(&shellName, "shell", "", "the shell to print for") } diff --git a/src/cli/init.go b/src/cli/init.go index a3cfcfbc..c9039189 100644 --- a/src/cli/init.go +++ b/src/cli/init.go @@ -44,7 +44,7 @@ See the documentation to initialize your shell: https://ohmyposh.dev/docs/instal } ) -func init() { //nolint:gochecknoinits +func init() { initCmd.Flags().BoolVarP(&printOutput, "print", "p", false, "print the init script") initCmd.Flags().BoolVarP(&strict, "strict", "s", false, "run in strict mode") initCmd.Flags().BoolVarP(&manual, "manual", "m", false, "enable/disable manual mode") diff --git a/src/cli/notice.go b/src/cli/notice.go index dd6dac29..6b03828c 100644 --- a/src/cli/notice.go +++ b/src/cli/notice.go @@ -27,6 +27,6 @@ var noticeCmd = &cobra.Command{ }, } -func init() { //nolint:gochecknoinits +func init() { RootCmd.AddCommand(noticeCmd) } diff --git a/src/cli/print.go b/src/cli/print.go index ca2521e4..92df12a8 100644 --- a/src/cli/print.go +++ b/src/cli/print.go @@ -94,7 +94,7 @@ var printCmd = &cobra.Command{ }, } -func init() { //nolint:gochecknoinits +func init() { printCmd.Flags().StringVar(&pwd, "pwd", "", "current working directory") printCmd.Flags().StringVar(&pswd, "pswd", "", "current working directory (according to pwsh)") printCmd.Flags().StringVar(&shellName, "shell", "", "the shell to print for") diff --git a/src/cli/prompt.go b/src/cli/prompt.go index 6bf80e63..e4c8c34e 100644 --- a/src/cli/prompt.go +++ b/src/cli/prompt.go @@ -15,7 +15,7 @@ var promptCmd = &cobra.Command{ }, } -func init() { //nolint:gochecknoinits +func init() { // legacy support promptCmd.AddCommand(initCmd) promptCmd.AddCommand(debugCmd) diff --git a/src/cli/root.go b/src/cli/root.go index 5660c3e6..54bb93ae 100644 --- a/src/cli/root.go +++ b/src/cli/root.go @@ -47,7 +47,7 @@ var ( initialize bool ) -func init() { //nolint:gochecknoinits +func init() { RootCmd.PersistentFlags().StringVarP(&config, "config", "c", "", "config file path") RootCmd.Flags().BoolVarP(&initialize, "init", "i", false, "init (deprecated)") RootCmd.Flags().BoolVar(&displayVersion, "version", false, "version") diff --git a/src/cli/toggle.go b/src/cli/toggle.go index 2de71091..ba39b59b 100644 --- a/src/cli/toggle.go +++ b/src/cli/toggle.go @@ -49,6 +49,6 @@ var toggleCmd = &cobra.Command{ }, } -func init() { //nolint:gochecknoinits +func init() { RootCmd.AddCommand(toggleCmd) } diff --git a/src/cli/version.go b/src/cli/version.go index ec230147..2b562df4 100644 --- a/src/cli/version.go +++ b/src/cli/version.go @@ -27,7 +27,7 @@ var versionCmd = &cobra.Command{ }, } -func init() { //nolint:gochecknoinits +func init() { versionCmd.Flags().BoolVarP(&verbose, "verbose", "v", false, "write verbose output") RootCmd.AddCommand(versionCmd) } From 0f7e7464cb6274536c1210963694872160151abf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 May 2024 01:06:54 +0000 Subject: [PATCH 122/157] chore(deps): bump golang.org/x/image from 0.15.0 to 0.16.0 in /src Bumps [golang.org/x/image](https://github.com/golang/image) from 0.15.0 to 0.16.0. - [Commits](https://github.com/golang/image/compare/v0.15.0...v0.16.0) --- updated-dependencies: - dependency-name: golang.org/x/image dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- src/go.mod | 4 ++-- src/go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/go.mod b/src/go.mod index 404ed6e5..604a8bb0 100644 --- a/src/go.mod +++ b/src/go.mod @@ -20,9 +20,9 @@ require ( github.com/stretchr/testify v1.9.0 github.com/wayneashleyberry/terminal-dimensions v1.1.0 golang.org/x/crypto v0.21.0 // indirect - golang.org/x/image v0.15.0 + golang.org/x/image v0.16.0 golang.org/x/sys v0.19.0 - golang.org/x/text v0.14.0 + golang.org/x/text v0.15.0 gopkg.in/ini.v1 v1.67.0 ) diff --git a/src/go.sum b/src/go.sum index 28496ed7..cf8b6b29 100644 --- a/src/go.sum +++ b/src/go.sum @@ -204,8 +204,8 @@ golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 h1:LfspQV/FYTatPTr/3HzIcmiUFH7PGP+OQ6mgDYo3yuQ= golang.org/x/exp v0.0.0-20240222234643-814bf88cf225/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc= -golang.org/x/image v0.15.0 h1:kOELfmgrmJlw4Cdb7g/QGuB3CvDrXbqEIww/pNtNBm8= -golang.org/x/image v0.15.0/go.mod h1:HUYqC05R2ZcZ3ejNQsIHQDQiwWM4JBqmm6MKANTp4LE= +golang.org/x/image v0.16.0 h1:9kloLAKhUufZhA12l5fwnx2NZW39/we1UhBesW433jw= +golang.org/x/image v0.16.0/go.mod h1:ugSZItdV4nOxyqp56HmXwH0Ry0nBCpjnZdpDaIHdoPs= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= @@ -244,8 +244,8 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= From bdee90f947730cae8e58ef301f9674c952c6684c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 May 2024 01:17:31 +0000 Subject: [PATCH 123/157] chore(deps): bump golangci/golangci-lint-action from 5.1.0 to 5.3.0 Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 5.1.0 to 5.3.0. - [Release notes](https://github.com/golangci/golangci-lint-action/releases) - [Commits](https://github.com/golangci/golangci-lint-action/compare/9d1e0624a798bb64f6c3cea93db47765312263dc...38e1018663fa5173f3968ea0777460d3de38f256) --- updated-dependencies: - dependency-name: golangci/golangci-lint-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/code.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/code.yml b/.github/workflows/code.yml index 3c8ab012..1fad175f 100644 --- a/.github/workflows/code.yml +++ b/.github/workflows/code.yml @@ -27,7 +27,7 @@ jobs: - name: Checkout code uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b - name: Golang CI - uses: golangci/golangci-lint-action@9d1e0624a798bb64f6c3cea93db47765312263dc + uses: golangci/golangci-lint-action@38e1018663fa5173f3968ea0777460d3de38f256 with: working-directory: src - name: Unit Tests From 39df43a3b14e1fdcc38ddd65e0360fc8a348c099 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 May 2024 01:25:49 +0000 Subject: [PATCH 124/157] chore(deps): bump golang.org/x/sys from 0.19.0 to 0.20.0 in /src Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.19.0 to 0.20.0. - [Commits](https://github.com/golang/sys/compare/v0.19.0...v0.20.0) --- updated-dependencies: - dependency-name: golang.org/x/sys dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- src/go.mod | 2 +- src/go.sum | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/go.mod b/src/go.mod index 604a8bb0..24ed540a 100644 --- a/src/go.mod +++ b/src/go.mod @@ -21,7 +21,7 @@ require ( github.com/wayneashleyberry/terminal-dimensions v1.1.0 golang.org/x/crypto v0.21.0 // indirect golang.org/x/image v0.16.0 - golang.org/x/sys v0.19.0 + golang.org/x/sys v0.20.0 golang.org/x/text v0.15.0 gopkg.in/ini.v1 v1.67.0 ) diff --git a/src/go.sum b/src/go.sum index cf8b6b29..7a737785 100644 --- a/src/go.sum +++ b/src/go.sum @@ -232,8 +232,9 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= From 5ab6a147cc2d6c84d8286c9492da809f573f1c1a Mon Sep 17 00:00:00 2001 From: Timothy Huber Date: Sun, 5 May 2024 15:50:27 -0400 Subject: [PATCH 125/157] theme(tiwahu): better contrast for git segment in vs code terminal --- themes/tiwahu.omp.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/tiwahu.omp.json b/themes/tiwahu.omp.json index 42913a49..c9d2d28b 100644 --- a/themes/tiwahu.omp.json +++ b/themes/tiwahu.omp.json @@ -55,8 +55,8 @@ "type": "path" }, { - "background": "#f14e32", - "foreground": "#f0efe7", + "background": "#cf432B", + "foreground": "#f1f0e9", "properties": { "branch_icon": "\ue725 ", "cherry_pick_icon": "\ue29b ", From 8c038582c5cd527dc0f419154f25d1ca26a5e72f Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 6 May 2024 07:58:48 +0000 Subject: [PATCH 126/157] docs: update website/docs/contributors.md [skip ci] --- website/docs/contributors.md | 1 + 1 file changed, 1 insertion(+) diff --git a/website/docs/contributors.md b/website/docs/contributors.md index ea334fda..bc99b5e9 100644 --- a/website/docs/contributors.md +++ b/website/docs/contributors.md @@ -341,6 +341,7 @@ Thanks goes to these wonderful people ([emoji key][acek]): Justin Wolfington
Justin Wolfington

💻 Jack Tracey
Jack Tracey

🎨 MarkDaveny
MarkDaveny

💻 🎨 📖 + Timothy Huber
Timothy Huber

🎨 From 4c6cb5ad3dcbb71804d2ef158e4e2598c4b78ae5 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 6 May 2024 07:58:49 +0000 Subject: [PATCH 127/157] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index beb5598d..c136feee 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2398,6 +2398,15 @@ "design", "doc" ] + }, + { + "login": "tiwahu", + "name": "Timothy Huber", + "avatar_url": "https://avatars.githubusercontent.com/u/590564?v=4", + "profile": "http://www.tiwahu.com/", + "contributions": [ + "design" + ] } ], "contributorsPerLine": 7, From adf97352d0887d4888958b42566fa14d390cd154 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Mon, 6 May 2024 20:35:44 +0200 Subject: [PATCH 128/157] feat(notice): disable from configuration resolves #4902 --- src/cli/enable.go | 1 + src/cli/init.go | 11 +++++++++++ src/engine/config.go | 1 + src/upgrade/notice.go | 9 +++++---- themes/schema.json | 12 ++++++++++++ website/docs/configuration/general.mdx | 1 + 6 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/cli/enable.go b/src/cli/enable.go index 684c5d19..aa83be59 100644 --- a/src/cli/enable.go +++ b/src/cli/enable.go @@ -55,6 +55,7 @@ func toggleFeature(cmd *cobra.Command, feature string, enable bool) { env.Cache().Delete(upgrade.CACHEKEY) return } + env.Cache().Set(upgrade.CACHEKEY, "disabled", -1) default: _ = cmd.Help() diff --git a/src/cli/init.go b/src/cli/init.go index c9039189..9ff287b1 100644 --- a/src/cli/init.go +++ b/src/cli/init.go @@ -6,6 +6,7 @@ import ( "github.com/jandedobbeleer/oh-my-posh/src/engine" "github.com/jandedobbeleer/oh-my-posh/src/platform" "github.com/jandedobbeleer/oh-my-posh/src/shell" + "github.com/jandedobbeleer/oh-my-posh/src/upgrade" "github.com/spf13/cobra" ) @@ -63,11 +64,14 @@ func runInit(shellName string) { } env.Init() defer env.Close() + cfg := engine.LoadConfig(env) + shell.Transient = cfg.TransientPrompt != nil shell.ErrorLine = cfg.ErrorLine != nil || cfg.ValidLine != nil shell.Tooltips = len(cfg.Tooltips) > 0 shell.ShellIntegration = cfg.ShellIntegration + for i, block := range cfg.Blocks { // only fetch cursor position when relevant if !cfg.DisableCursorPositioning && (i == 0 && block.Newline) { @@ -77,11 +81,18 @@ func runInit(shellName string) { shell.RPrompt = true } } + + // allow overriding the upgrade notice from the config + if cfg.DisableNotice { + env.Cache().Set(upgrade.CACHEKEY, "disabled", -1) + } + if printOutput { init := shell.PrintInit(env) fmt.Print(init) return } + init := shell.Init(env) fmt.Print(init) } diff --git a/src/engine/config.go b/src/engine/config.go index 378cffa3..a96b1ce4 100644 --- a/src/engine/config.go +++ b/src/engine/config.go @@ -51,6 +51,7 @@ type Config struct { Var map[string]any `json:"var,omitempty" toml:"var,omitempty"` DisableCursorPositioning bool `json:"disable_cursor_positioning,omitempty" toml:"disable_cursor_positioning,omitempty"` PatchPwshBleed bool `json:"patch_pwsh_bleed,omitempty" toml:"patch_pwsh_bleed,omitempty"` + DisableNotice bool `json:"disable_notice,omitempty" toml:"disable_notice,omitempty"` // Deprecated OSC99 bool `json:"osc99,omitempty" toml:"osc99,omitempty"` diff --git a/src/upgrade/notice.go b/src/upgrade/notice.go index 371b2b66..5564e797 100644 --- a/src/upgrade/notice.go +++ b/src/upgrade/notice.go @@ -59,15 +59,16 @@ func Latest(env platform.Environment) (string, error) { // // The upgrade check is only performed every other week. func Notice(env platform.Environment) (string, bool) { - // never validate when we install using the Windows Store - if env.Getenv("POSH_INSTALLER") == "ws" { - return "", false - } // do not check when last validation was < 1 week ago if _, OK := env.Cache().Get(CACHEKEY); OK { return "", false } + // never validate when we install using the Windows Store + if env.Getenv("POSH_INSTALLER") == "ws" { + return "", false + } + latest, err := Latest(env) if err != nil { return "", false diff --git a/themes/schema.json b/themes/schema.json index f9e249b3..c85678d8 100644 --- a/themes/schema.json +++ b/themes/schema.json @@ -4449,6 +4449,18 @@ "description": "https://ohmyposh.dev/docs/configuration/general#general-settings", "default": "" }, + "disable_notice": { + "type": "boolean", + "title": "Disable Upgrade Notice", + "description": "https://ohmyposh.dev/docs/configuration/title#general-settings", + "default": false + }, + "patch_pwsh_bleed": { + "type": "boolean", + "title": "Patch PowerShell Color Bleed", + "description": "https://ohmyposh.dev/docs/configuration/title#general-settings", + "default": false + }, "console_title_template": { "type": "string", "title": "Console Title Template", diff --git a/website/docs/configuration/general.mdx b/website/docs/configuration/general.mdx index e6c2cc6c..6a33108f 100644 --- a/website/docs/configuration/general.mdx +++ b/website/docs/configuration/general.mdx @@ -136,6 +136,7 @@ For example, the following is a valid `--config` flag: | `shell_integration` | `boolean` | enable shell integration using FinalTerm's OSC sequences. Works in bash, cmd (Clink v1.14.25+), fish, powershell and zsh | | `disable_cursor_positioning` | `boolean` | disable fetching the cursor position in bash and zsh in case of unwanted side-effects | | `patch_pwsh_bleed` | `boolean` | patch a PowerShell bug where the background colors bleed into the next line at the end of the buffer (can be removed when [this][pwsh-bleed] is merged) | +| `disable_notice` | `boolean` | disable the upgrade notice | ### JSON Schema Validation From 5cab6ee81bbd820fe3c7414684f63b1d93a3aab7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 7 May 2024 00:45:48 +0000 Subject: [PATCH 129/157] chore(deps): bump golangci/golangci-lint-action from 5.3.0 to 6.0.0 Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 5.3.0 to 6.0.0. - [Release notes](https://github.com/golangci/golangci-lint-action/releases) - [Commits](https://github.com/golangci/golangci-lint-action/compare/38e1018663fa5173f3968ea0777460d3de38f256...23faadfdeb23a6f9e511beaba149bb123b5b145a) --- updated-dependencies: - dependency-name: golangci/golangci-lint-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/code.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/code.yml b/.github/workflows/code.yml index 1fad175f..c517b118 100644 --- a/.github/workflows/code.yml +++ b/.github/workflows/code.yml @@ -27,7 +27,7 @@ jobs: - name: Checkout code uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b - name: Golang CI - uses: golangci/golangci-lint-action@38e1018663fa5173f3968ea0777460d3de38f256 + uses: golangci/golangci-lint-action@23faadfdeb23a6f9e511beaba149bb123b5b145a with: working-directory: src - name: Unit Tests From aee7ccab5dd5526797a97391b684608536bd0a35 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 7 May 2024 00:51:52 +0000 Subject: [PATCH 130/157] chore(deps): bump actions/checkout from 4.1.4 to 4.1.5 Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.4 to 4.1.5. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/0ad4b8fadaa221de15dcec353f45205ec38ea70b...44c2b7a8a4ea60a981eaca3cf939b5f4305c123b) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/android.yml | 2 +- .github/workflows/build_code.yml | 2 +- .github/workflows/close_themes_pr.yml | 2 +- .github/workflows/code.yml | 2 +- .github/workflows/codeql.yml | 2 +- .github/workflows/docs.yml | 2 +- .github/workflows/gomod.yml | 2 +- .github/workflows/inno.yml | 2 +- .github/workflows/markdown.yml | 2 +- .github/workflows/merge_contributions_pr.yml | 2 +- .github/workflows/release.yml | 4 ++-- .github/workflows/scoop.yml | 2 +- .github/workflows/winget.yml | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 993bd4be..4767a691 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -9,7 +9,7 @@ jobs: container: ghcr.io/jandedobbeleer/golang-android-container:latest steps: - name: Checkout code 👋 - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b - name: Build run: | VERSION=$(echo "${{ github.event.release.name }}" | cut -c2-) diff --git a/.github/workflows/build_code.yml b/.github/workflows/build_code.yml index 4c257ff4..c6bd109a 100644 --- a/.github/workflows/build_code.yml +++ b/.github/workflows/build_code.yml @@ -17,7 +17,7 @@ jobs: shell: pwsh steps: - name: Checkout code 👋 - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b - name: Install Go 🗳 uses: ./.github/workflows/composite/bootstrap-go - name: Run GoReleaser 🚀 diff --git a/.github/workflows/close_themes_pr.yml b/.github/workflows/close_themes_pr.yml index a4aac7cb..5d3aefda 100644 --- a/.github/workflows/close_themes_pr.yml +++ b/.github/workflows/close_themes_pr.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code 👋 - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b - name: Check and close 🔐 uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea with: diff --git a/.github/workflows/code.yml b/.github/workflows/code.yml index c517b118..007afffe 100644 --- a/.github/workflows/code.yml +++ b/.github/workflows/code.yml @@ -25,7 +25,7 @@ jobs: go-version: 1.21 cache-dependency-path: src/go.sum - name: Checkout code - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b - name: Golang CI uses: golangci/golangci-lint-action@23faadfdeb23a6f9e511beaba149bb123b5b145a with: diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index baa42c78..5938ce19 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -25,7 +25,7 @@ jobs: go-version: 1.21 cache-dependency-path: src/go.sum - name: Checkout code - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b - name: Initialize CodeQL uses: github/codeql-action/init@cdcdbb579706841c47f7063dda365e292e5cad7a with: diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 6799f301..02e6a6e3 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest name: Build and Deploy steps: - - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b + - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b with: submodules: true persist-credentials: false diff --git a/.github/workflows/gomod.yml b/.github/workflows/gomod.yml index 945bf5ee..28073ec7 100644 --- a/.github/workflows/gomod.yml +++ b/.github/workflows/gomod.yml @@ -15,7 +15,7 @@ jobs: go-version: 1.21 cache-dependency-path: src/go.sum - name: Checkout code - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b - name: Check for unused dependencies run: | go mod tidy diff --git a/.github/workflows/inno.yml b/.github/workflows/inno.yml index c9f846b8..7198da16 100644 --- a/.github/workflows/inno.yml +++ b/.github/workflows/inno.yml @@ -15,7 +15,7 @@ jobs: working-directory: ${{ github.workspace }}/packages/inno steps: - name: Checkout code 👋 - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b - name: Build installer 📦 id: build env: diff --git a/.github/workflows/markdown.yml b/.github/workflows/markdown.yml index 0040e968..ec9b5bc6 100644 --- a/.github/workflows/markdown.yml +++ b/.github/workflows/markdown.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b - name: Lint files uses: articulate/actions-markdownlint@17b8abe7407cd17590c006ecc837c35e1ac3ed83 with: diff --git a/.github/workflows/merge_contributions_pr.yml b/.github/workflows/merge_contributions_pr.yml index d9f5baee..0b762a75 100644 --- a/.github/workflows/merge_contributions_pr.yml +++ b/.github/workflows/merge_contributions_pr.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code 👋 - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b - name: Check and merge ⛙ uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 27faeae6..88a65262 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,7 +19,7 @@ jobs: skipped: ${{ steps.changelog.outputs.skipped }} steps: - name: Checkout code 👋 - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b - name: Create changelog ✍️ id: changelog uses: TriPSs/conventional-changelog-action@f04dac1fd07687cec8ea302937ca588b33786e98 @@ -41,7 +41,7 @@ jobs: working-directory: ${{ github.workspace }}/src steps: - name: Checkout code 👋 - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b - name: Install Go 🗳 uses: ./.github/workflows/composite/bootstrap-go - name: Tag HEAD 😸 diff --git a/.github/workflows/scoop.yml b/.github/workflows/scoop.yml index cfe3732a..1dbe67c3 100644 --- a/.github/workflows/scoop.yml +++ b/.github/workflows/scoop.yml @@ -18,7 +18,7 @@ jobs: working-directory: ${{ github.workspace }}/packages/scoop steps: - name: Checkout code 👋 - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b - name: Update Template ✍️ run: | ./build.ps1 -Version ${{ github.event.inputs.version }} diff --git a/.github/workflows/winget.yml b/.github/workflows/winget.yml index 7a607361..ede56fe6 100644 --- a/.github/workflows/winget.yml +++ b/.github/workflows/winget.yml @@ -17,7 +17,7 @@ jobs: WINGETCREATE_TOKEN: ${{ secrets.WINGETCREATE_TOKEN }} steps: - name: Checkout code 👋 - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b - name: Create manifest and submit PR 📦 run: | ./build.ps1 -Version "${{ github.event.inputs.version }}" -Token $env:WINGETCREATE_TOKEN From c47fb6ffc66beb2393e2f7c5fdb11391168da8ff Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 8 May 2024 00:53:02 +0000 Subject: [PATCH 131/157] chore(deps): bump softprops/action-gh-release from 2.0.4 to 2.0.5 Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 2.0.4 to 2.0.5. - [Release notes](https://github.com/softprops/action-gh-release/releases) - [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md) - [Commits](https://github.com/softprops/action-gh-release/compare/9d7c94cfd0a1f3ed45544c887983e9fa900f0564...69320dbe05506a9a39fc8ae11030b214ec2d1f87) --- updated-dependencies: - dependency-name: softprops/action-gh-release dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 88a65262..4f48dfba 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -85,7 +85,7 @@ jobs: } shell: pwsh - name: Release 🎓 - uses: softprops/action-gh-release@9d7c94cfd0a1f3ed45544c887983e9fa900f0564 + uses: softprops/action-gh-release@69320dbe05506a9a39fc8ae11030b214ec2d1f87 with: tag_name: ${{ needs.changelog.outputs.tag }} body: ${{ needs.changelog.outputs.body }} From 5b141cfd3f38d1dcf6604b6d8a9ce573a1c9c81e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 9 May 2024 00:20:08 +0000 Subject: [PATCH 132/157] chore(deps): bump golangci/golangci-lint-action from 6.0.0 to 6.0.1 Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 6.0.0 to 6.0.1. - [Release notes](https://github.com/golangci/golangci-lint-action/releases) - [Commits](https://github.com/golangci/golangci-lint-action/compare/23faadfdeb23a6f9e511beaba149bb123b5b145a...a4f60bb28d35aeee14e6880718e0c85ff1882e64) --- updated-dependencies: - dependency-name: golangci/golangci-lint-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/code.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/code.yml b/.github/workflows/code.yml index 007afffe..715ff483 100644 --- a/.github/workflows/code.yml +++ b/.github/workflows/code.yml @@ -27,7 +27,7 @@ jobs: - name: Checkout code uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b - name: Golang CI - uses: golangci/golangci-lint-action@23faadfdeb23a6f9e511beaba149bb123b5b145a + uses: golangci/golangci-lint-action@a4f60bb28d35aeee14e6880718e0c85ff1882e64 with: working-directory: src - name: Unit Tests From be2e63e680a50eb643320740d7bcda1812cd1a72 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 9 May 2024 00:36:32 +0000 Subject: [PATCH 133/157] chore(deps): bump github.com/charmbracelet/bubbletea in /src Bumps [github.com/charmbracelet/bubbletea](https://github.com/charmbracelet/bubbletea) from 0.26.1 to 0.26.2. - [Release notes](https://github.com/charmbracelet/bubbletea/releases) - [Commits](https://github.com/charmbracelet/bubbletea/compare/v0.26.1...v0.26.2) --- updated-dependencies: - dependency-name: github.com/charmbracelet/bubbletea dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/go.mod | 4 ++-- src/go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/go.mod b/src/go.mod index 24ed540a..1af30342 100644 --- a/src/go.mod +++ b/src/go.mod @@ -29,7 +29,7 @@ require ( require ( github.com/ConradIrwin/font v0.0.0-20210318200717-ce8d41cc0732 github.com/charmbracelet/bubbles v0.18.0 - github.com/charmbracelet/bubbletea v0.26.1 + github.com/charmbracelet/bubbletea v0.26.2 github.com/charmbracelet/lipgloss v0.10.0 github.com/goccy/go-json v0.10.2 github.com/goccy/go-yaml v1.11.3 @@ -88,7 +88,7 @@ require ( github.com/yusufpapurcu/wmi v1.2.4 // indirect github.com/zclconf/go-cty v1.14.3 // indirect golang.org/x/sync v0.7.0 // indirect - golang.org/x/term v0.19.0 // indirect + golang.org/x/term v0.20.0 // indirect golang.org/x/tools v0.19.0 // indirect golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect ) diff --git a/src/go.sum b/src/go.sum index 7a737785..aacdf056 100644 --- a/src/go.sum +++ b/src/go.sum @@ -25,8 +25,8 @@ github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiE github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= github.com/charmbracelet/bubbles v0.18.0 h1:PYv1A036luoBGroX6VWjQIE9Syf2Wby2oOl/39KLfy0= github.com/charmbracelet/bubbles v0.18.0/go.mod h1:08qhZhtIwzgrtBjAcJnij1t1H0ZRjwHyGsy6AL11PSw= -github.com/charmbracelet/bubbletea v0.26.1 h1:xujcQeF73rh4jwu3+zhfQsvV18x+7zIjlw7/CYbzGJ0= -github.com/charmbracelet/bubbletea v0.26.1/go.mod h1:FzKr7sKoO8iFVcdIBM9J0sJOcQv5nDQaYwsee3kpbgo= +github.com/charmbracelet/bubbletea v0.26.2 h1:Eeb+n75Om9gQ+I6YpbCXQRKHt5Pn4vMwusQpwLiEgJQ= +github.com/charmbracelet/bubbletea v0.26.2/go.mod h1:6I0nZ3YHUrQj7YHIHlM8RySX4ZIthTliMY+W8X8b+Gs= github.com/charmbracelet/lipgloss v0.10.0 h1:KWeXFSexGcfahHX+54URiZGkBFazf70JNMtwg/AFW3s= github.com/charmbracelet/lipgloss v0.10.0/go.mod h1:Wig9DSfvANsxqkRsqj6x87irdy123SR4dOXlKa91ciE= github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= @@ -238,8 +238,8 @@ golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= -golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q= -golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk= +golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw= +golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= From 0b5277e4a2f24044fdcd68b30969de208d1e74b0 Mon Sep 17 00:00:00 2001 From: "L. Yeung" Date: Thu, 9 May 2024 17:19:48 +0800 Subject: [PATCH 134/157] feat(os): add a default icon for deepin --- src/segments/os.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/segments/os.go b/src/segments/os.go index 5fd16e0f..ee2ab16e 100644 --- a/src/segments/os.go +++ b/src/segments/os.go @@ -54,13 +54,14 @@ func (oi *Os) getDistroIcon(distro string) string { "almalinux": "\uF31D", "almalinux9": "\uF31D", "alpine": "\uF300", + "android": "\uF17b", "aosc": "\uF301", "arch": "\uF303", "centos": "\uF304", "coreos": "\uF305", "debian": "\uF306", + "deepin": "\uF321", "devuan": "\uF307", - "raspbian": "\uF315", "elementary": "\uF309", "fedora": "\uF30a", "gentoo": "\uF30d", @@ -70,12 +71,12 @@ func (oi *Os) getDistroIcon(distro string) string { "nixos": "\uF313", "opensuse": "\uF314", "opensuse-tumbleweed": "\uF314", + "raspbian": "\uF315", "redhat": "\uF316", "rocky": "\uF32B", "sabayon": "\uF317", "slackware": "\uF319", "ubuntu": "\uF31b", - "android": "\uf17b", } if icon, ok := iconMap[distro]; ok { From b227fcece96b225d9dde77d06c570eaae23006b1 Mon Sep 17 00:00:00 2001 From: "L. Yeung" Date: Thu, 9 May 2024 17:28:52 +0800 Subject: [PATCH 135/157] docs(os): use exact names of Linux distros --- website/docs/segments/os.mdx | 61 +++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 28 deletions(-) diff --git a/website/docs/segments/os.mdx b/website/docs/segments/os.mdx index f7359a98..16a3e280 100644 --- a/website/docs/segments/os.mdx +++ b/website/docs/segments/os.mdx @@ -25,34 +25,39 @@ import Config from '@site/src/components/Config.js'; ## Properties -| Name | Type | Default | Description | -| --------------------- | :-------: | :------: | --------------------------------------------------- | -| `macos` | `string` | `\uF179` | the string to use for macOS | -| `linux` | `string` | `\uF17C` | the icon to use for Linux | -| `windows` | `string` | `\uE62A` | the icon to use for Windows | -| `display_distro_name` | `boolean` | `false` | display the distro name or icon (for WSL and Linux) | -| `alma` | `string` | `\uF31D` | the icon to use for Alma | -| `alpine` | `string` | `\uF300` | the icon to use for Alpine | -| `aosc` | `string` | `\uF301` | the icon to use for Aosc | -| `arch` | `string` | `\uF303` | the icon to use for Arch | -| `centos` | `string` | `\uF304` | the icon to use for Centos | -| `coreos` | `string` | `\uF305` | the icon to use for Coreos | -| `debian` | `string` | `\uF306` | the icon to use for Debian | -| `devuan` | `string` | `\uF307` | the icon to use for Devuan | -| `raspbian` | `string` | `\uF315` | the icon to use for Raspbian | -| `elementary` | `string` | `\uF309` | the icon to use for Elementary | -| `fedora` | `string` | `\uF30a` | the icon to use for Fedora | -| `gentoo` | `string` | `\uF30d` | the icon to use for Gentoo | -| `mageia` | `string` | `\uF310` | the icon to use for Mageia | -| `manjaro` | `string` | `\uF312` | the icon to use for Manjaro | -| `mint` | `string` | `\uF30e` | the icon to use for Mint | -| `nixos` | `string` | `\uF313` | the icon to use for Nixos | -| `opensuse` | `string` | `\uF314` | the icon to use for Opensuse | -| `redhat` | `string` | `\uF316` | the icon to use for Redhat | -| `rocky` | `string` | `\uF32B` | the icon to use for Rocky | -| `sabayon` | `string` | `\uF317` | the icon to use for Sabayon | -| `slackware` | `string` | `\uF319` | the icon to use for Slackware | -| `ubuntu` | `string` | `\uF31b` | the icon to use for Ubuntu | +| Name | Type | Default | Description | +| --------------------- | :-------: | :------: | -------------------------------------------------------- | +| `macos` | `string` | `\uF179` | the string to use for macOS | +| `linux` | `string` | `\uF17C` | the icon to use for Linux | +| `windows` | `string` | `\uE62A` | the icon to use for Windows | +| `display_distro_name` | `boolean` | `false` | display the distro name instead of icon for Linux or WSL | +| `alma` | `string` | `\uF31D` | the icon to use for AlmaLinux OS | +| `almalinux` | `string` | `\uF31D` | the icon to use for AlmaLinux OS | +| `almalinux9` | `string` | `\uF31D` | the icon to use for AlmaLinux OS 9 | +| `alpine` | `string` | `\uF300` | the icon to use for Alpine Linux | +| `android` | `string` | `\uF17b` | the icon to use for Android | +| `aosc` | `string` | `\uF301` | the icon to use for AOSC OS | +| `arch` | `string` | `\uF303` | the icon to use for Arch Linux | +| `centos` | `string` | `\uF304` | the icon to use for CentOS | +| `coreos` | `string` | `\uF305` | the icon to use for CoreOS Container Linux | +| `debian` | `string` | `\uF306` | the icon to use for Debian | +| `deepin` | `string` | `\uF321` | the icon to use for deepin | +| `devuan` | `string` | `\uF307` | the icon to use for Devuan GNU+Linux | +| `elementary` | `string` | `\uF309` | the icon to use for elementary OS | +| `fedora` | `string` | `\uF30a` | the icon to use for Fedora | +| `gentoo` | `string` | `\uF30d` | the icon to use for Gentoo Linux | +| `mageia` | `string` | `\uF310` | the icon to use for Mageia | +| `manjaro` | `string` | `\uF312` | the icon to use for Manjaro Linux | +| `mint` | `string` | `\uF30e` | the icon to use for Linux Mint | +| `nixos` | `string` | `\uF313` | the icon to use for NixOS | +| `opensuse` | `string` | `\uF314` | the icon to use for openSUSE | +| `opensuse-tumbleweed` | `string` | `\uF314` | the icon to use for openSUSE Tumbleweed | +| `raspbian` | `string` | `\uF315` | the icon to use for Raspberry Pi OS (Raspbian) | +| `redhat` | `string` | `\uF316` | the icon to use for Red Hat Enterprise Linux (RHEL) | +| `rocky` | `string` | `\uF32B` | the icon to use for Rocky Linux | +| `sabayon` | `string` | `\uF317` | the icon to use for Sabayon | +| `slackware` | `string` | `\uF319` | the icon to use for Slackware Linux | +| `ubuntu` | `string` | `\uF31b` | the icon to use for Ubuntu | ## Template ([info][templates]) From f94b6071066aa6fd9a54bb801969dd43d070d00a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 13 May 2024 00:57:50 +0000 Subject: [PATCH 136/157] chore(deps): bump goreleaser/goreleaser-action from 5.0.0 to 5.1.0 Bumps [goreleaser/goreleaser-action](https://github.com/goreleaser/goreleaser-action) from 5.0.0 to 5.1.0. - [Release notes](https://github.com/goreleaser/goreleaser-action/releases) - [Commits](https://github.com/goreleaser/goreleaser-action/compare/7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8...5742e2a039330cbb23ebf35f046f814d4c6ff811) --- updated-dependencies: - dependency-name: goreleaser/goreleaser-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/build_code.yml | 2 +- .github/workflows/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_code.yml b/.github/workflows/build_code.yml index c6bd109a..5a3da3ad 100644 --- a/.github/workflows/build_code.yml +++ b/.github/workflows/build_code.yml @@ -21,7 +21,7 @@ jobs: - name: Install Go 🗳 uses: ./.github/workflows/composite/bootstrap-go - name: Run GoReleaser 🚀 - uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 + uses: goreleaser/goreleaser-action@5742e2a039330cbb23ebf35f046f814d4c6ff811 with: distribution: goreleaser version: latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4f48dfba..7d0b0602 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -60,7 +60,7 @@ jobs: env: COSIGN_KEY: ${{secrets.COSIGN_KEY}} - name: Run GoReleaser 🚀 - uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 + uses: goreleaser/goreleaser-action@5742e2a039330cbb23ebf35f046f814d4c6ff811 with: distribution: goreleaser version: latest From 6177afd4236044e436d025145f375e9c241e002c Mon Sep 17 00:00:00 2001 From: Yash Mistry Date: Mon, 13 May 2024 02:29:01 -0400 Subject: [PATCH 137/157] theme(montys): add space to status template --- themes/montys.omp.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/montys.omp.json b/themes/montys.omp.json index fd11aa23..fcb5fd5a 100644 --- a/themes/montys.omp.json +++ b/themes/montys.omp.json @@ -81,7 +81,7 @@ "always_enabled": true }, "style": "diamond", - "template": " {{ if gt .Code 0 }}\uf421{{ else }}\uf469{{ end }}", + "template": " {{ if gt .Code 0 }}\uf421{{ else }}\uf469{{ end }} ", "trailing_diamond": "\ue0b4", "type": "status" } From 962e424f9b30af94a2c922937e1067d787f09e7f Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 13 May 2024 06:29:19 +0000 Subject: [PATCH 138/157] docs: update website/docs/contributors.md [skip ci] --- website/docs/contributors.md | 1 + 1 file changed, 1 insertion(+) diff --git a/website/docs/contributors.md b/website/docs/contributors.md index bc99b5e9..14b555d1 100644 --- a/website/docs/contributors.md +++ b/website/docs/contributors.md @@ -342,6 +342,7 @@ Thanks goes to these wonderful people ([emoji key][acek]): Jack Tracey
Jack Tracey

🎨 MarkDaveny
MarkDaveny

💻 🎨 📖 Timothy Huber
Timothy Huber

🎨 + Yash Mistry
Yash Mistry

🎨 From fd8fe94cffb2a418bd07e90e7624ae160deb9b73 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 13 May 2024 06:29:20 +0000 Subject: [PATCH 139/157] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index c136feee..e1e10a39 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2407,6 +2407,15 @@ "contributions": [ "design" ] + }, + { + "login": "YashJM", + "name": "Yash Mistry", + "avatar_url": "https://avatars.githubusercontent.com/u/63824041?v=4", + "profile": "http://yashjmistry.me", + "contributions": [ + "design" + ] } ], "contributorsPerLine": 7, From 738048bc9fa53828366554c5c11663ee52a74aa4 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Mon, 13 May 2024 08:31:38 +0200 Subject: [PATCH 140/157] feat(python): add support for py launcher resolves #4923 --- src/segments/python.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/segments/python.go b/src/segments/python.go index 49cace56..ba518b05 100644 --- a/src/segments/python.go +++ b/src/segments/python.go @@ -51,6 +51,11 @@ func (p *Python) Init(props properties.Properties, env platform.Environment) { args: []string{"--version"}, regex: `(?:Python (?P((?P[0-9]+).(?P[0-9]+).(?P[0-9]+))))`, }, + { + executable: "py", + args: []string{"--version"}, + regex: `(?:Python (?P((?P[0-9]+).(?P[0-9]+).(?P[0-9]+))))`, + }, }, versionURLTemplate: "https://docs.python.org/release/{{ .Major }}.{{ .Minor }}.{{ .Patch }}/whatsnew/changelog.html#python-{{ .Major }}-{{ .Minor }}-{{ .Patch }}", displayMode: props.GetString(DisplayMode, DisplayModeEnvironment), From 68037c9368b601c5a1cc92329317aab279eb7bcc Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Mon, 13 May 2024 08:36:01 +0200 Subject: [PATCH 141/157] chore: lock issues after 90 days --- .github/workflows/lock.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lock.yml b/.github/workflows/lock.yml index c46bb827..47fb429d 100644 --- a/.github/workflows/lock.yml +++ b/.github/workflows/lock.yml @@ -16,7 +16,7 @@ jobs: steps: - uses: dessant/lock-threads@1bf7ec25051fe7c00bdd17e6a7cf3d7bfb7dc771 with: - issue-inactive-days: '182' + issue-inactive-days: '90' issue-comment: > This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. From 2a144c9d07b20518f7c45f01948a1158be293139 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Tue, 14 May 2024 20:10:45 +0200 Subject: [PATCH 142/157] fix(template): correctly map SHLVL for use --- src/template/text.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/template/text.go b/src/template/text.go index 116e0e9c..fe09fd1e 100644 --- a/src/template/text.go +++ b/src/template/text.go @@ -28,15 +28,16 @@ var ( "ShellVersion", "UserName", "HostName", - "Env", - "Data", "Code", + "Env", "OS", "WSL", - "Segments", - "Templates", "PromptCount", + "Segments", + "SHLVL", + "Templates", "Var", + "Data", } ) From 6a84d275ac671eb492e80be1cd69c09d43f9e76a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 17 May 2024 00:06:41 +0000 Subject: [PATCH 143/157] chore(deps): bump actions/checkout from 4.1.5 to 4.1.6 Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.5 to 4.1.6. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/44c2b7a8a4ea60a981eaca3cf939b5f4305c123b...a5ac7e51b41094c92402da3b24376905380afc29) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/android.yml | 2 +- .github/workflows/build_code.yml | 2 +- .github/workflows/close_themes_pr.yml | 2 +- .github/workflows/code.yml | 2 +- .github/workflows/codeql.yml | 2 +- .github/workflows/docs.yml | 2 +- .github/workflows/gomod.yml | 2 +- .github/workflows/inno.yml | 2 +- .github/workflows/markdown.yml | 2 +- .github/workflows/merge_contributions_pr.yml | 2 +- .github/workflows/release.yml | 4 ++-- .github/workflows/scoop.yml | 2 +- .github/workflows/winget.yml | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 4767a691..edf64ed0 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -9,7 +9,7 @@ jobs: container: ghcr.io/jandedobbeleer/golang-android-container:latest steps: - name: Checkout code 👋 - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 - name: Build run: | VERSION=$(echo "${{ github.event.release.name }}" | cut -c2-) diff --git a/.github/workflows/build_code.yml b/.github/workflows/build_code.yml index 5a3da3ad..60bbcfd9 100644 --- a/.github/workflows/build_code.yml +++ b/.github/workflows/build_code.yml @@ -17,7 +17,7 @@ jobs: shell: pwsh steps: - name: Checkout code 👋 - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 - name: Install Go 🗳 uses: ./.github/workflows/composite/bootstrap-go - name: Run GoReleaser 🚀 diff --git a/.github/workflows/close_themes_pr.yml b/.github/workflows/close_themes_pr.yml index 5d3aefda..7ea74c77 100644 --- a/.github/workflows/close_themes_pr.yml +++ b/.github/workflows/close_themes_pr.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code 👋 - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 - name: Check and close 🔐 uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea with: diff --git a/.github/workflows/code.yml b/.github/workflows/code.yml index 715ff483..520c59f2 100644 --- a/.github/workflows/code.yml +++ b/.github/workflows/code.yml @@ -25,7 +25,7 @@ jobs: go-version: 1.21 cache-dependency-path: src/go.sum - name: Checkout code - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 - name: Golang CI uses: golangci/golangci-lint-action@a4f60bb28d35aeee14e6880718e0c85ff1882e64 with: diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 5938ce19..a76f8048 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -25,7 +25,7 @@ jobs: go-version: 1.21 cache-dependency-path: src/go.sum - name: Checkout code - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 - name: Initialize CodeQL uses: github/codeql-action/init@cdcdbb579706841c47f7063dda365e292e5cad7a with: diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 02e6a6e3..b8166fbe 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest name: Build and Deploy steps: - - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 with: submodules: true persist-credentials: false diff --git a/.github/workflows/gomod.yml b/.github/workflows/gomod.yml index 28073ec7..c1bb6396 100644 --- a/.github/workflows/gomod.yml +++ b/.github/workflows/gomod.yml @@ -15,7 +15,7 @@ jobs: go-version: 1.21 cache-dependency-path: src/go.sum - name: Checkout code - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 - name: Check for unused dependencies run: | go mod tidy diff --git a/.github/workflows/inno.yml b/.github/workflows/inno.yml index 7198da16..a00a2626 100644 --- a/.github/workflows/inno.yml +++ b/.github/workflows/inno.yml @@ -15,7 +15,7 @@ jobs: working-directory: ${{ github.workspace }}/packages/inno steps: - name: Checkout code 👋 - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 - name: Build installer 📦 id: build env: diff --git a/.github/workflows/markdown.yml b/.github/workflows/markdown.yml index ec9b5bc6..6b2cc80b 100644 --- a/.github/workflows/markdown.yml +++ b/.github/workflows/markdown.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 - name: Lint files uses: articulate/actions-markdownlint@17b8abe7407cd17590c006ecc837c35e1ac3ed83 with: diff --git a/.github/workflows/merge_contributions_pr.yml b/.github/workflows/merge_contributions_pr.yml index 0b762a75..8b4293f7 100644 --- a/.github/workflows/merge_contributions_pr.yml +++ b/.github/workflows/merge_contributions_pr.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code 👋 - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 - name: Check and merge ⛙ uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7d0b0602..c99f34ae 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,7 +19,7 @@ jobs: skipped: ${{ steps.changelog.outputs.skipped }} steps: - name: Checkout code 👋 - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 - name: Create changelog ✍️ id: changelog uses: TriPSs/conventional-changelog-action@f04dac1fd07687cec8ea302937ca588b33786e98 @@ -41,7 +41,7 @@ jobs: working-directory: ${{ github.workspace }}/src steps: - name: Checkout code 👋 - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 - name: Install Go 🗳 uses: ./.github/workflows/composite/bootstrap-go - name: Tag HEAD 😸 diff --git a/.github/workflows/scoop.yml b/.github/workflows/scoop.yml index 1dbe67c3..3f2ee402 100644 --- a/.github/workflows/scoop.yml +++ b/.github/workflows/scoop.yml @@ -18,7 +18,7 @@ jobs: working-directory: ${{ github.workspace }}/packages/scoop steps: - name: Checkout code 👋 - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 - name: Update Template ✍️ run: | ./build.ps1 -Version ${{ github.event.inputs.version }} diff --git a/.github/workflows/winget.yml b/.github/workflows/winget.yml index ede56fe6..ace25848 100644 --- a/.github/workflows/winget.yml +++ b/.github/workflows/winget.yml @@ -17,7 +17,7 @@ jobs: WINGETCREATE_TOKEN: ${{ secrets.WINGETCREATE_TOKEN }} steps: - name: Checkout code 👋 - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 - name: Create manifest and submit PR 📦 run: | ./build.ps1 -Version "${{ github.event.inputs.version }}" -Token $env:WINGETCREATE_TOKEN From 4e9f7f90603c28810d6b182e3130c03e4c5d6066 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Fri, 17 May 2024 13:50:34 +0200 Subject: [PATCH 144/157] feat(font): add official Cascadia Code release resolves #4936 --- src/font/cli.go | 5 ++-- src/font/{nerd.go => fonts.go} | 45 ++++++++++++++++++++++++++++------ 2 files changed, 40 insertions(+), 10 deletions(-) rename src/font/{nerd.go => fonts.go} (56%) diff --git a/src/font/cli.go b/src/font/cli.go index 421bd197..56531f5e 100644 --- a/src/font/cli.go +++ b/src/font/cli.go @@ -98,12 +98,13 @@ func (m *main) buildFontList(nerdFonts []*Asset) { } func getFontsList() { - nerdFonts, err := Nerds() + fonts, err := Fonts() if err != nil { program.Send(errMsg(err)) return } - program.Send(loadMsg(nerdFonts)) + + program.Send(loadMsg(fonts)) } func downloadFontZip(location string) { diff --git a/src/font/nerd.go b/src/font/fonts.go similarity index 56% rename from src/font/nerd.go rename to src/font/fonts.go index 7646ec9b..d3c5d15b 100644 --- a/src/font/nerd.go +++ b/src/font/fonts.go @@ -4,7 +4,9 @@ import ( "context" "encoding/json" "errors" + "fmt" "net/http" + "sort" "strings" "time" @@ -23,30 +25,57 @@ type Asset struct { func (a Asset) FilterValue() string { return a.Name } -func Nerds() ([]*Asset, error) { - ctx, cancelF := context.WithTimeout(context.Background(), time.Second*time.Duration(20)) - defer cancelF() - req, err := http.NewRequestWithContext(ctx, "GET", "https://api.github.com/repos/ryanoasis/nerd-fonts/releases/latest", nil) +func Fonts() ([]*Asset, error) { + assets, err := fetchFontAssets("ryanoasis/nerd-fonts") if err != nil { return nil, err } + + cascadiaCode, err := fetchFontAssets("microsoft/cascadia-code") + if err != nil { + return assets, nil + } + + assets = append(assets, cascadiaCode...) + sort.Slice(assets, func(i, j int) bool { return assets[i].Name < assets[j].Name }) + + return assets, nil +} + +func CascadiaCode() ([]*Asset, error) { + return fetchFontAssets("microsoft/cascadia-code") +} + +func fetchFontAssets(repo string) ([]*Asset, error) { + ctx, cancelF := context.WithTimeout(context.Background(), time.Second*time.Duration(20)) + defer cancelF() + + repoURL := "https://api.github.com/repos/" + repo + "/releases/latest" + req, err := http.NewRequestWithContext(ctx, "GET", repoURL, nil) + if err != nil { + return nil, err + } + req.Header.Add("Accept", "application/vnd.github.v3+json") response, err := platform.Client.Do(req) if err != nil || response.StatusCode != http.StatusOK { - return nil, errors.New("failed to get nerd fonts release") + return nil, fmt.Errorf("failed to get %s release", repo) } + defer response.Body.Close() var release release err = json.NewDecoder(response.Body).Decode(&release) if err != nil { return nil, errors.New("failed to parse nerd fonts release") } - var nerdFonts []*Asset + + var fonts []*Asset for _, asset := range release.Assets { if asset.State == "uploaded" && strings.HasSuffix(asset.Name, ".zip") { asset.Name = strings.TrimSuffix(asset.Name, ".zip") - nerdFonts = append(nerdFonts, asset) + fonts = append(fonts, asset) } } - return nerdFonts, nil + + return fonts, nil } From 950c608939832984dce9b47539c1d89d1aa6fe86 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Sun, 19 May 2024 08:28:16 +0200 Subject: [PATCH 145/157] feat(go): upgrade to 1.22.3 --- .devcontainer/devcontainer.json | 2 +- .github/workflows/composite/bootstrap-go/action.yml | 2 +- src/go.mod | 2 +- src/segments/golang_test.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 726e5dcc..ed76a361 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -8,7 +8,7 @@ // Update the VARIANT arg to pick a version of Go: 1, 1.16, 1.17 // Append -bullseye or -buster to pin to an OS version. // Use -bullseye variants on local arm64/Apple Silicon. - "VARIANT": "1-1.22-bullseye", + "VARIANT": "1-1.22.3-bullseye", // Options: "POSH_THEME": "/workspaces/oh-my-posh/themes/jandedobbeleer.omp.json", diff --git a/.github/workflows/composite/bootstrap-go/action.yml b/.github/workflows/composite/bootstrap-go/action.yml index 63f93482..8a5415e3 100644 --- a/.github/workflows/composite/bootstrap-go/action.yml +++ b/.github/workflows/composite/bootstrap-go/action.yml @@ -9,4 +9,4 @@ runs: steps: - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 with: - go-version: '1.22.0' + go-version: '1.22.3' diff --git a/src/go.mod b/src/go.mod index 1af30342..668661ac 100644 --- a/src/go.mod +++ b/src/go.mod @@ -1,6 +1,6 @@ module github.com/jandedobbeleer/oh-my-posh/src -go 1.22.0 +go 1.22.3 require ( github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 diff --git a/src/segments/golang_test.go b/src/segments/golang_test.go index 022c02ee..730516eb 100644 --- a/src/segments/golang_test.go +++ b/src/segments/golang_test.go @@ -22,7 +22,7 @@ func TestGolang(t *testing.T) { }{ {Case: "Go 1.15", ExpectedString: "1.15.8", Version: "go version go1.15.8 darwin/amd64"}, {Case: "Go 1.16", ExpectedString: "1.16", Version: "go version go1.16 darwin/amd64"}, - {Case: "go.mod 1.22.0", ParseModFile: true, HasModFileInParentDir: true, ExpectedString: "1.22.0"}, + {Case: "go.mod 1.22.3", ParseModFile: true, HasModFileInParentDir: true, ExpectedString: "1.22.3"}, {Case: "no go.mod file fallback", ParseModFile: true, ExpectedString: "1.16", Version: "go version go1.16 darwin/amd64"}, { Case: "invalid go.mod file fallback", From 391ceaf5f0406940149bb81d780e4ec07cc52cb6 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Sun, 19 May 2024 09:04:36 +0200 Subject: [PATCH 146/157] feat(zsh): remove rprompt space natively --- src/engine/engine.go | 8 -------- src/shell/scripts/omp.zsh | 1 + 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/engine/engine.go b/src/engine/engine.go index e51bb712..73d93f61 100644 --- a/src/engine/engine.go +++ b/src/engine/engine.go @@ -222,14 +222,6 @@ func (e *Engine) renderBlock(block *Block, cancelNewline bool) bool { return false } - // in ZSH, RPROMPT is printed with a trailing space - // to ensure alignment, we need to print a space here - // see https://github.com/JanDeDobbeleer/oh-my-posh/issues/4327 - if e.Env.Shell() == shell.ZSH { - text += " " - length++ - } - space, OK := e.canWriteRightBlock(false) // we can't print the right block as there's not enough room available if !OK { diff --git a/src/shell/scripts/omp.zsh b/src/shell/scripts/omp.zsh index 9f43f9a7..50c33f07 100644 --- a/src/shell/scripts/omp.zsh +++ b/src/shell/scripts/omp.zsh @@ -4,6 +4,7 @@ export POSH_PID=$$ export POWERLINE_COMMAND="oh-my-posh" export CONDA_PROMPT_MODIFIER=false export POSH_PROMPT_COUNT=0 +export ZLE_RPROMPT_INDENT=0 # set secondary prompt PS2="$(::OMP:: print secondary --config="$POSH_THEME" --shell=zsh)" From e7a10ac02982f587f5177306eea2a8a7407d7219 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Sun, 19 May 2024 13:31:19 +0200 Subject: [PATCH 147/157] feat(iterm): add iTerm features to the root configuration BREAKING CHANGE: The iTerm segment has been removed and its features have been added to the root configuration. To re-enable the iTerm features, remove the iTerm segment and add the following to your oh-my-posh configuration: ```json { "iterm_features": ["prompt_mark", "current_dir", "remote_host"] } ``` Choose this option if you want to enable the prompt mark for shell integration and/or enable current directory and remote host in the iTerm status bar. --- src/ansi/ansi_writer.go | 13 ++ src/ansi/iterm.go | 32 +++++ src/engine/config.go | 43 +++--- src/engine/engine.go | 4 + src/engine/prompt.go | 5 + src/engine/segment.go | 3 - src/platform/shell.go | 8 ++ src/segments/iterm.go | 69 --------- src/segments/iterm_test.go | 46 ------ themes/schema.json | 190 ++++++++++++++++++++----- website/docs/configuration/general.mdx | 24 ++-- website/docs/segments/iterm.mdx | 65 --------- website/sidebars.js | 1 - 13 files changed, 248 insertions(+), 255 deletions(-) create mode 100644 src/ansi/iterm.go delete mode 100644 src/segments/iterm.go delete mode 100644 src/segments/iterm_test.go delete mode 100644 website/docs/segments/iterm.mdx diff --git a/src/ansi/ansi_writer.go b/src/ansi/ansi_writer.go index 1180400f..a6b38b56 100644 --- a/src/ansi/ansi_writer.go +++ b/src/ansi/ansi_writer.go @@ -114,6 +114,10 @@ type Writer struct { hyperlinkStart string hyperlinkCenter string hyperlinkEnd string + + iTermPromptMark string + iTermCurrentDir string + iTermRemoteHost string } func (w *Writer) Init(shellName string) { @@ -137,6 +141,9 @@ func (w *Writer) Init(shellName string) { w.osc99 = "\\[\x1b]9;9;%s\x1b\\\\\\]" w.osc7 = "\\[\x1b]7;file://%s/%s\x1b\\\\\\]" w.osc51 = "\\[\x1b]51;A;%s@%s:%s\x1b\\\\\\]" + w.iTermPromptMark = "\\[$(iterm2_prompt_mark)\\]" + w.iTermCurrentDir = "\\[\x1b]1337;CurrentDir=%s\x07\\]" + w.iTermRemoteHost = "\\[\x1b]1337;RemoteHost=%s@%s\x07\\]" case shell.ZSH, shell.TCSH: w.format = "%%{%s%%}" w.linechange = "%%{\x1b[%d%s%%}" @@ -154,6 +161,9 @@ func (w *Writer) Init(shellName string) { w.osc99 = "%%{\x1b]9;9;%s\x1b\\%%}" w.osc7 = "%%{\x1b]7;file://%s/%s\x1b\\%%}" w.osc51 = "%%{\x1b]51;A%s@%s:%s\x1b\\%%}" + w.iTermPromptMark = "%{$(iterm2_prompt_mark)%}" + w.iTermCurrentDir = "%%{\x1b]1337;CurrentDir=%s\x07%%}" + w.iTermRemoteHost = "%%{\x1b]1337;RemoteHost=%s@%s\x07%%}" default: w.linechange = "\x1b[%d%s" w.left = "\x1b[%dD" @@ -171,6 +181,9 @@ func (w *Writer) Init(shellName string) { w.osc99 = "\x1b]9;9;%s\x1b\\" w.osc7 = "\x1b]7;file://%s/%s\x1b\\" w.osc51 = "\x1b]51;A%s@%s:%s\x1b\\" + w.iTermPromptMark = "$(iterm2_prompt_mark)" + w.iTermCurrentDir = "\x1b]1337;CurrentDir=%s\x07" + w.iTermRemoteHost = "\x1b]1337;RemoteHost=%s@%s\x07" } } diff --git a/src/ansi/iterm.go b/src/ansi/iterm.go new file mode 100644 index 00000000..6b013319 --- /dev/null +++ b/src/ansi/iterm.go @@ -0,0 +1,32 @@ +package ansi + +import ( + "fmt" + "strings" +) + +type iTermFeature string + +const ( + PromptMark iTermFeature = "prompt_mark" + CurrentDir iTermFeature = "current_dir" + RemoteHost iTermFeature = "remote_host" +) + +type ITermFeatures []iTermFeature + +func (w *Writer) RenderItermFeatures(features ITermFeatures, pwd, user, host string) string { + var result strings.Builder + for _, feature := range features { + switch feature { + case PromptMark: + result.WriteString(w.iTermPromptMark) + case CurrentDir: + result.WriteString(fmt.Sprintf(w.iTermCurrentDir, pwd)) + case RemoteHost: + result.WriteString(fmt.Sprintf(w.iTermRemoteHost, user, host)) + } + } + + return result.String() +} diff --git a/src/engine/config.go b/src/engine/config.go index a96b1ce4..78745131 100644 --- a/src/engine/config.go +++ b/src/engine/config.go @@ -31,27 +31,28 @@ const ( // Config holds all the theme for rendering the prompt type Config struct { - Version int `json:"version" toml:"version"` - FinalSpace bool `json:"final_space,omitempty" toml:"final_space,omitempty"` - ConsoleTitleTemplate string `json:"console_title_template,omitempty" toml:"console_title_template,omitempty"` - TerminalBackground string `json:"terminal_background,omitempty" toml:"terminal_background,omitempty"` - AccentColor string `json:"accent_color,omitempty" toml:"accent_color,omitempty"` - Blocks []*Block `json:"blocks,omitempty" toml:"blocks,omitempty"` - Tooltips []*Segment `json:"tooltips,omitempty" toml:"tooltips,omitempty"` - TransientPrompt *Segment `json:"transient_prompt,omitempty" toml:"transient_prompt,omitempty"` - ValidLine *Segment `json:"valid_line,omitempty" toml:"valid_line,omitempty"` - ErrorLine *Segment `json:"error_line,omitempty" toml:"error_line,omitempty"` - SecondaryPrompt *Segment `json:"secondary_prompt,omitempty" toml:"secondary_prompt,omitempty"` - DebugPrompt *Segment `json:"debug_prompt,omitempty" toml:"debug_prompt,omitempty"` - Palette ansi.Palette `json:"palette,omitempty" toml:"palette,omitempty"` - Palettes *ansi.Palettes `json:"palettes,omitempty" toml:"palettes,omitempty"` - Cycle ansi.Cycle `json:"cycle,omitempty" toml:"cycle,omitempty"` - ShellIntegration bool `json:"shell_integration,omitempty" toml:"shell_integration,omitempty"` - PWD string `json:"pwd,omitempty" toml:"pwd,omitempty"` - Var map[string]any `json:"var,omitempty" toml:"var,omitempty"` - DisableCursorPositioning bool `json:"disable_cursor_positioning,omitempty" toml:"disable_cursor_positioning,omitempty"` - PatchPwshBleed bool `json:"patch_pwsh_bleed,omitempty" toml:"patch_pwsh_bleed,omitempty"` - DisableNotice bool `json:"disable_notice,omitempty" toml:"disable_notice,omitempty"` + Version int `json:"version" toml:"version"` + FinalSpace bool `json:"final_space,omitempty" toml:"final_space,omitempty"` + ConsoleTitleTemplate string `json:"console_title_template,omitempty" toml:"console_title_template,omitempty"` + TerminalBackground string `json:"terminal_background,omitempty" toml:"terminal_background,omitempty"` + AccentColor string `json:"accent_color,omitempty" toml:"accent_color,omitempty"` + Blocks []*Block `json:"blocks,omitempty" toml:"blocks,omitempty"` + Tooltips []*Segment `json:"tooltips,omitempty" toml:"tooltips,omitempty"` + TransientPrompt *Segment `json:"transient_prompt,omitempty" toml:"transient_prompt,omitempty"` + ValidLine *Segment `json:"valid_line,omitempty" toml:"valid_line,omitempty"` + ErrorLine *Segment `json:"error_line,omitempty" toml:"error_line,omitempty"` + SecondaryPrompt *Segment `json:"secondary_prompt,omitempty" toml:"secondary_prompt,omitempty"` + DebugPrompt *Segment `json:"debug_prompt,omitempty" toml:"debug_prompt,omitempty"` + Palette ansi.Palette `json:"palette,omitempty" toml:"palette,omitempty"` + Palettes *ansi.Palettes `json:"palettes,omitempty" toml:"palettes,omitempty"` + Cycle ansi.Cycle `json:"cycle,omitempty" toml:"cycle,omitempty"` + ShellIntegration bool `json:"shell_integration,omitempty" toml:"shell_integration,omitempty"` + PWD string `json:"pwd,omitempty" toml:"pwd,omitempty"` + Var map[string]any `json:"var,omitempty" toml:"var,omitempty"` + DisableCursorPositioning bool `json:"disable_cursor_positioning,omitempty" toml:"disable_cursor_positioning,omitempty"` + PatchPwshBleed bool `json:"patch_pwsh_bleed,omitempty" toml:"patch_pwsh_bleed,omitempty"` + DisableNotice bool `json:"disable_notice,omitempty" toml:"disable_notice,omitempty"` + ITermFeatures ansi.ITermFeatures `json:"iterm_features,omitempty" toml:"iterm_features,omitempty"` // Deprecated OSC99 bool `json:"osc99,omitempty" toml:"osc99,omitempty"` diff --git a/src/engine/engine.go b/src/engine/engine.go index 73d93f61..6de86202 100644 --- a/src/engine/engine.go +++ b/src/engine/engine.go @@ -132,6 +132,10 @@ func (e *Engine) isWarp() bool { return e.Env.Getenv("TERM_PROGRAM") == "WarpTerminal" } +func (e *Engine) isIterm() bool { + return e.Env.Getenv("TERM_PROGRAM") == "iTerm.app" +} + func (e *Engine) shouldFill(filler string, remaining, blockLength int) (string, bool) { if len(filler) == 0 { return "", false diff --git a/src/engine/prompt.go b/src/engine/prompt.go index bb8279b3..7fdfb406 100644 --- a/src/engine/prompt.go +++ b/src/engine/prompt.go @@ -68,6 +68,11 @@ func (e *Engine) Primary() string { e.currentLineLength++ } + if e.Config.ITermFeatures != nil && e.isIterm() { + host, _ := e.Env.Host() + e.write(e.Writer.RenderItermFeatures(e.Config.ITermFeatures, e.Env.Pwd(), e.Env.User(), host)) + } + if e.Config.ShellIntegration && e.Config.TransientPrompt == nil { e.write(e.Writer.CommandStart()) } diff --git a/src/engine/segment.go b/src/engine/segment.go index 8c55a265..1d8be362 100644 --- a/src/engine/segment.go +++ b/src/engine/segment.go @@ -160,8 +160,6 @@ const ( HELM SegmentType = "helm" // IPIFY segment IPIFY SegmentType = "ipify" - // ITERM inserts the Shell Integration prompt mark on iTerm zsh/bash/fish - ITERM SegmentType = "iterm" // JAVA writes the active java version JAVA SegmentType = "java" // JULIA writes which julia version is currently active @@ -307,7 +305,6 @@ var Segments = map[SegmentType]func() SegmentWriter{ HASKELL: func() SegmentWriter { return &segments.Haskell{} }, HELM: func() SegmentWriter { return &segments.Helm{} }, IPIFY: func() SegmentWriter { return &segments.IPify{} }, - ITERM: func() SegmentWriter { return &segments.ITerm{} }, JAVA: func() SegmentWriter { return &segments.Java{} }, JULIA: func() SegmentWriter { return &segments.Julia{} }, KOTLIN: func() SegmentWriter { return &segments.Kotlin{} }, diff --git a/src/platform/shell.go b/src/platform/shell.go index e1d70831..bf992697 100644 --- a/src/platform/shell.go +++ b/src/platform/shell.go @@ -200,6 +200,7 @@ type Shell struct { Var SimpleMap cwd string + host string cmdCache *commandCache fileCache *fileCache tmplCache *TemplateCache @@ -496,13 +497,20 @@ func (env *Shell) User() string { func (env *Shell) Host() (string, error) { defer env.Trace(time.Now()) + if len(env.host) != 0 { + return env.host, nil + } + hostName, err := os.Hostname() if err != nil { env.Error(err) return "", err } + hostName = cleanHostName(hostName) env.Debug(hostName) + env.host = hostName + return hostName, nil } diff --git a/src/segments/iterm.go b/src/segments/iterm.go deleted file mode 100644 index c4bae7fa..00000000 --- a/src/segments/iterm.go +++ /dev/null @@ -1,69 +0,0 @@ -package segments - -import ( - "fmt" - - "github.com/jandedobbeleer/oh-my-posh/src/platform" - "github.com/jandedobbeleer/oh-my-posh/src/properties" - "github.com/jandedobbeleer/oh-my-posh/src/shell" -) - -type ITerm struct { - props properties.Properties - env platform.Environment -} - -func (i *ITerm) Template() string { - return "{{ .PromptMark }}" -} - -func (i *ITerm) Enabled() bool { - return i.env.Getenv("TERM_PROGRAM") == "iTerm.app" -} - -func (i *ITerm) PromptMark() string { - // Check to ensure the user has squelched the default mark for BASH and ZSH - if i.env.Getenv("ITERM2_SQUELCH_MARK") != "1" { - i.env.Debug("iTerm default mark enabled, adjust using export ITERM2_SQUELCH_MARK=1") - return "" - } - - sh := i.env.Shell() - if sh != shell.ZSH && sh != shell.BASH { - i.env.Debug("Shell is not ZSH or BASH, cannot set prompt mark") - return "" - } - - return i.format("$(iterm2_prompt_mark)") -} - -func (i *ITerm) CurrentDir() string { - dir := fmt.Sprintf("\x1b]1337;CurrentDir=%s\x07", i.env.Pwd()) - return i.format(dir) -} - -func (i *ITerm) RemoteHost() string { - host, err := i.env.Host() - if err != nil { - return "" - } - - remoteHost := fmt.Sprintf("\x1b]1337;RemoteHost=%s@%s\x07", i.env.User(), host) - return i.format(remoteHost) -} - -func (i *ITerm) format(input string) string { - switch i.env.Shell() { - case shell.ZSH: - return fmt.Sprintf(`%%{%s%%}`, input) - case shell.BASH: - return fmt.Sprintf(`\[%s\]`, input) - default: - return input - } -} - -func (i *ITerm) Init(props properties.Properties, env platform.Environment) { - i.props = props - i.env = env -} diff --git a/src/segments/iterm_test.go b/src/segments/iterm_test.go deleted file mode 100644 index a1cb73e6..00000000 --- a/src/segments/iterm_test.go +++ /dev/null @@ -1,46 +0,0 @@ -package segments - -import ( - "testing" - - "github.com/jandedobbeleer/oh-my-posh/src/mock" - - "github.com/stretchr/testify/assert" - mock2 "github.com/stretchr/testify/mock" -) - -func TestITermSegment(t *testing.T) { - cases := []struct { - Case string - TermProgram string - SquelchMark string - Shell string - Template string - ExpectedString string - ExpectedDisabled bool - }{ - {Case: "not iterm", TermProgram: "", SquelchMark: "1", Shell: "zsh", ExpectedDisabled: true}, - {Case: "default mark", TermProgram: "iTerm.app", Shell: "zsh", Template: "{{ .PromptMark }}", ExpectedDisabled: false}, - {Case: "zsh", TermProgram: "iTerm.app", SquelchMark: "1", Shell: "zsh", Template: "{{ .PromptMark }}", ExpectedString: `%{$(iterm2_prompt_mark)%}`}, - {Case: "bash", TermProgram: "iTerm.app", SquelchMark: "1", Shell: "bash", Template: "{{ .PromptMark }}", ExpectedString: `\[$(iterm2_prompt_mark)\]`}, - {Case: "fish", TermProgram: "iTerm.app", SquelchMark: "1", Shell: "fish", Template: "{{ .PromptMark }}", ExpectedDisabled: false}, - {Case: "pwsh", TermProgram: "iTerm.app", SquelchMark: "1", Shell: "pwsh", Template: "{{ .PromptMark }}", ExpectedDisabled: false}, - {Case: "gibberishshell", TermProgram: "iTerm.app", SquelchMark: "1", Shell: "jaserhuashf", Template: "{{ .PromptMark }}", ExpectedDisabled: false}, - } - - for _, tc := range cases { - env := new(mock.MockedEnvironment) - env.On("PathSeparator").Return("/") - env.On("Getenv", "TERM_PROGRAM").Return(tc.TermProgram) - env.On("Getenv", "ITERM2_SQUELCH_MARK").Return(tc.SquelchMark) - env.On("Shell").Return(tc.Shell) - env.On("Error", mock2.Anything).Return() - iterm := &ITerm{ - env: env, - } - assert.Equal(t, !tc.ExpectedDisabled, iterm.Enabled(), tc.Case) - if !tc.ExpectedDisabled { - assert.Equal(t, tc.ExpectedString, renderTemplate(env, tc.Template, iterm), tc.Case) - } - } -} diff --git a/themes/schema.json b/themes/schema.json index c85678d8..bfa75aad 100644 --- a/themes/schema.json +++ b/themes/schema.json @@ -321,7 +321,6 @@ "haskell", "helm", "ipify", - "iterm", "julia", "java", "kotlin", @@ -549,7 +548,10 @@ "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if a folder is an NPM workspace", - "default": ["package.json", "package-lock.json"], + "default": [ + "package.json", + "package-lock.json" + ], "items": { "type": "string" } @@ -631,7 +633,11 @@ "title": "Source", "description": "https://ohmyposh.dev/docs/segments/az#properties", "default": "first_match", - "enum": ["first_match", "cli", "pwsh"] + "enum": [ + "first_match", + "cli", + "pwsh" + ] } } } @@ -745,7 +751,11 @@ "type": "array", "title": "Folders", "description": "The folders to look for when determining if a folder is a Bazel workspace", - "default": ["bazel-bin", "bazel-out", "bazel-testlogs"], + "default": [ + "bazel-bin", + "bazel-out", + "bazel-testlogs" + ], "items": { "type": "string" } @@ -791,7 +801,11 @@ "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if a folder is a Buf workspace", - "default": ["buf.yaml", "buf.gen.yaml", "buf.work.yaml"], + "default": [ + "buf.yaml", + "buf.gen.yaml", + "buf.work.yaml" + ], "items": { "type": "string" } @@ -884,7 +898,12 @@ "type": "string", "title": "Connection type", "description": "The connection type to display", - "enum": ["ethernet", "wifi", "cellular", "bluetooth"], + "enum": [ + "ethernet", + "wifi", + "cellular", + "bluetooth" + ], "default": "wifi|ethernet" }, "unit": { @@ -946,7 +965,10 @@ "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if a folder is a CMake workspace", - "default": ["*.cmake", "CMakeLists.txt"], + "default": [ + "*.cmake", + "CMakeLists.txt" + ], "items": { "type": "string" } @@ -1054,10 +1076,10 @@ "default": false }, "status_template": { - "type": "string", - "title": "Status Template", - "description": "The template to use for the status segment", - "default": "|" + "type": "string", + "title": "Status Template", + "description": "The template to use for the status segment", + "default": "|" }, "status_separator": { "type": "string", @@ -1120,7 +1142,9 @@ "type": "array", "title": "Folders", "description": "The folders to look for when determining if a folder is a Flutter workspace", - "default": [".dart_tool"], + "default": [ + ".dart_tool" + ], "items": { "type": "string" } @@ -1393,7 +1417,10 @@ "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if a folder is a Go workspace", - "default": ["*.go", "go.mod"], + "default": [ + "*.go", + "go.mod" + ], "items": { "type": "string" } @@ -1456,7 +1483,9 @@ "type": "array", "title": "Folders", "description": "The folders to look for when determining if a folder is a Dart workspace", - "default": [".dart_tool"], + "default": [ + ".dart_tool" + ], "items": { "type": "string" } @@ -1502,7 +1531,11 @@ "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if a folder is a Deno workspace", - "default": ["*.js", "*.ts", "deno.json"], + "default": [ + "*.js", + "*.ts", + "deno.json" + ], "items": { "type": "string" } @@ -1551,7 +1584,10 @@ "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if a folder is a Crystal workspace", - "default": ["*.cr", "shard.yml"], + "default": [ + "*.cr", + "shard.yml" + ], "items": { "type": "string" } @@ -1600,7 +1636,9 @@ "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if a folder is a Julia workspace", - "default": ["*.jl"], + "default": [ + "*.jl" + ], "items": { "type": "string" } @@ -1649,7 +1687,12 @@ "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if a folder is a Perl workspace", - "default": [".perl-version", "*.pl", "*.pm", "*.t"], + "default": [ + ".perl-version", + "*.pl", + "*.pm", + "*.t" + ], "items": { "type": "string" } @@ -1812,7 +1855,11 @@ "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if a folder is a Ruby workspace", - "default": ["*.rb", "Rakefile", "Gemfile"] + "default": [ + "*.rb", + "Rakefile", + "Gemfile" + ] }, "folders": { "$ref": "#/definitions/folders" @@ -1858,7 +1905,11 @@ "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if a folder is a Rust workspace", - "default": ["*.rs", "Cargo.toml", "Cargo.lock"] + "default": [ + "*.rs", + "Cargo.toml", + "Cargo.lock" + ] }, "folders": { "$ref": "#/definitions/folders" @@ -1904,7 +1955,9 @@ "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if a folder is a XMake workspace", - "default": ["xmake.lua"], + "default": [ + "xmake.lua" + ], "items": { "type": "string" } @@ -2564,7 +2617,10 @@ "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if a folder is a Quasar workspace", - "default": ["quasar.config", "quasar.config.js"] + "default": [ + "quasar.config", + "quasar.config.js" + ] }, "folders": { "$ref": "#/definitions/folders" @@ -2890,13 +2946,13 @@ "description": "Location to use for the API call interpreted only if valid coordinates aren't given. Formatted as ,,. City name, state code and country code divided by comma. Please, refer to ISO 3166 for the state codes or country codes.", "default": "De Bilt,NL" }, - "latitude" : { + "latitude": { "type": "number", "title": "Latitude", "description": "The latitude of the requested location, valid between -90 and 90", "default": 91 }, - "longitude" : { + "longitude": { "type": "number", "title": "Longitude", "description": "The longitude of the requested location, valid between -180 and 180", @@ -2907,7 +2963,11 @@ "title": "units", "description": "Units of measurement. Available values are standard (kelvin), metric (celsius), and imperial (fahrenheit). Default is standard", "default": "standard", - "enum": ["standard", "metric", "imperial"] + "enum": [ + "standard", + "metric", + "imperial" + ] }, "http_timeout": { "$ref": "#/definitions/http_timeout" @@ -2956,7 +3016,10 @@ "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if a folder is a Elixir workspace", - "default": ["*.ex", "*.exs"], + "default": [ + "*.ex", + "*.exs" + ], "items": { "type": "string" } @@ -3179,7 +3242,9 @@ "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if the current directory is an Angular project", - "default": ["angular.json"], + "default": [ + "angular.json" + ], "items": { "type": "string" } @@ -3228,7 +3293,9 @@ "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if the current directory is a React project", - "default": ["package.json"], + "default": [ + "package.json" + ], "items": { "type": "string" } @@ -3277,7 +3344,10 @@ "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if the current directory is an Nx project", - "default": ["workspace.json", "nx.json"], + "default": [ + "workspace.json", + "nx.json" + ], "items": { "type": "string" } @@ -3696,7 +3766,11 @@ "type": "string", "title": "Use Stack GHC", "description": "Get the GHC version used by Stack. Will decrease performance. Boolean indicating whether stack ghc was used available in template as .StackGhc", - "enum": ["always", "package", "never"], + "enum": [ + "always", + "package", + "never" + ], "default": "never" }, "extensions": { @@ -3781,7 +3855,9 @@ "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if the current directory is a UI5 project", - "default": ["*ui5*.y*ml"], + "default": [ + "*ui5*.y*ml" + ], "items": { "type": "string" } @@ -3874,7 +3950,9 @@ "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if the current directory is a Vala project", - "default": ["*.vala"], + "default": [ + "*.vala" + ], "items": { "type": "string" } @@ -3923,7 +4001,10 @@ "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if the current directory is a Cloud Foundry project", - "default": ["manifest.yml", "mta.yaml"], + "default": [ + "manifest.yml", + "mta.yaml" + ], "items": { "type": "string" } @@ -4001,7 +4082,11 @@ "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if the current directory is a Kotlin project", - "default": ["*.kt", "*.kts", "*.ktm"], + "default": [ + "*.kt", + "*.kts", + "*.ktm" + ], "items": { "type": "string" } @@ -4099,14 +4184,20 @@ "type": "string", "title": "Preferred Executable", "description": "The preferred executable to use when fetching the version.", - "enum": ["lua", "luajit"], + "enum": [ + "lua", + "luajit" + ], "default": "lua" }, "extensions": { "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if the current directory is a Lua project", - "default": ["*.lua", "*.rockspec"], + "default": [ + "*.lua", + "*.rockspec" + ], "items": { "type": "string" } @@ -4155,7 +4246,10 @@ "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if the current directory is a Swift project", - "default": ["*.swift", "*.SWIFT"], + "default": [ + "*.swift", + "*.SWIFT" + ], "items": { "type": "string" } @@ -4204,7 +4298,11 @@ "type": "array", "title": "Extensions", "description": "The extensions to look for when determining if the current directory is a CDS project", - "default": [".cdsrc.json", ".cdsrc-private.json", "*.cds"], + "default": [ + ".cdsrc.json", + ".cdsrc-private.json", + "*.cds" + ], "items": { "type": "string" } @@ -4399,7 +4497,9 @@ { "if": { "properties": { - "type": { "const": "umbraco" } + "type": { + "const": "umbraco" + } } }, "then": { @@ -4587,6 +4687,18 @@ "accent_color": { "title": "Accent color", "$ref": "#/definitions/color" + }, + "iterm_features": { + "type": "array", + "title": "The iTerm2 features to enable", + "items": { + "type": "string", + "enum": [ + "prompt_mark", + "current_dir", + "remote_host" + ] + } } } } diff --git a/website/docs/configuration/general.mdx b/website/docs/configuration/general.mdx index 6a33108f..640a4375 100644 --- a/website/docs/configuration/general.mdx +++ b/website/docs/configuration/general.mdx @@ -126,17 +126,18 @@ For example, the following is a valid `--config` flag: ## General Settings -| Name | Type | Description | -| ---------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `final_space` | `boolean` | when true adds a space at the end of the prompt | -| `pwd` | `string` | notify terminal of current working directory, values can be `osc99`, `osc7` or `osc51` depending on your terminal. Supports [templates][templates] | -| `terminal_background` | `string` | [color][colors] - terminal background color, set to your terminal's background color when you notice black elements in Windows Terminal or the Visual Studio Code integrated terminal | -| `accent_color` | `string` | [color][colors] - accent color, used as a fallback when the `accent` [color][accent] is not supported | -| `var` | `map[string]any` | config variables to use in [templates][templates]. Can be any value | -| `shell_integration` | `boolean` | enable shell integration using FinalTerm's OSC sequences. Works in bash, cmd (Clink v1.14.25+), fish, powershell and zsh | -| `disable_cursor_positioning` | `boolean` | disable fetching the cursor position in bash and zsh in case of unwanted side-effects | -| `patch_pwsh_bleed` | `boolean` | patch a PowerShell bug where the background colors bleed into the next line at the end of the buffer (can be removed when [this][pwsh-bleed] is merged) | -| `disable_notice` | `boolean` | disable the upgrade notice | +| Name | Type | Description | +| ---------------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `final_space` | `boolean` | when true adds a space at the end of the prompt | +| `pwd` | `string` | notify terminal of current working directory, values can be `osc99`, `osc7` or `osc51` depending on your terminal. Supports [templates][templates] | +| `terminal_background` | `string` | [color][colors] - terminal background color, set to your terminal's background color when you notice black elements in Windows Terminal or the Visual Studio Code integrated terminal | +| `accent_color` | `string` | [color][colors] - accent color, used as a fallback when the `accent` [color][accent] is not supported | +| `var` | `map[string]any` | config variables to use in [templates][templates]. Can be any value | +| `shell_integration` | `boolean` | enable shell integration using FinalTerm's OSC sequences. Works in bash, cmd (Clink v1.14.25+), fish, powershell and zsh | +| `disable_cursor_positioning` | `boolean` | disable fetching the cursor position in bash and zsh in case of unwanted side-effects | +| `patch_pwsh_bleed` | `boolean` | patch a PowerShell bug where the background colors bleed into the next line at the end of the buffer (can be removed when [this][pwsh-bleed] is merged) | +| `disable_notice` | `boolean` | disable the upgrade notice | +| `iterm_features` | `[]string` | enable iTerm2 specific features:
  • `prompt_mark`: add the `iterm2_prompt_mark` [function][iterm2-si] for supported shells
  • `current_dir`: expose the current directory for iTerm2
  • `remote_host`: expose the current remote and user for iTerm2
| ### JSON Schema Validation @@ -191,3 +192,4 @@ Converters won't catch this change, so you will need to adjust manually. [accent]: /docs/configuration/colors#standard-colors [templates]: /docs/configuration/templates#config-variables [pwsh-bleed]: https://github.com/PowerShell/PowerShell/pull/19019 +[iterm2-si]: https://iterm2.com/documentation-shell-integration.html diff --git a/website/docs/segments/iterm.mdx b/website/docs/segments/iterm.mdx deleted file mode 100644 index 4ca42fb5..00000000 --- a/website/docs/segments/iterm.mdx +++ /dev/null @@ -1,65 +0,0 @@ ---- -id: iterm -title: iTerm -sidebar_label: iTerm ---- - -## What - -Inserts iTerm2 shell integration prompt marks and extensions. This segment has no visible output -but is used to enable iTerm2 terminal features. -For more information, read the [shell integration][int-page] and [extension page][ext-page] on -the developer's website. - -:::info PromptMark in Bash and ZSH -You will need to add `export ITERM2_SQUELCH_MARK=1` before the shell integration script is sourced. -::: - -:::info PromptMark in Fish shell -For fish, you can make use of Oh My Posh's `set_poshcontext` function to set the prompt mark. Add the -following line after initialising Oh My Posh: - -```fish -function set_poshcontext - iterm2_prompt_mark -end -``` - -You do not need to add this segment to use the prompt mark. -::: - -## Sample Configuration - -import Config from "@site/src/components/Config.js"; - - - -## Template ([info][templates]) - -:::note default template - -```template -{{ .PromptMark }} -``` - -::: - -### Properties - -| Name | Type | Description | -| ------------- | -------- | --------------------------------------------------- | -| `.PromptMark` | `string` | inserts the prompt mark to enable shell integration | -| `.CurrentDir` | `string` | inserts the current directory | -| `.RemoteHost` | `string` | inserts the current user and host name | - -[templates]: /docs/configuration/templates -[int-page]: https://iterm2.com/documentation-shell-integration.html -[ext-page]: https://iterm2.com/documentation-escape-codes.html diff --git a/website/sidebars.js b/website/sidebars.js index 870214be..bad40203 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -84,7 +84,6 @@ module.exports = { "segments/haskell", "segments/helm", "segments/ipify", - "segments/iterm", "segments/java", "segments/julia", "segments/kotlin", From be9faf1a2c9846ba03862635ff60b4e30164a006 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 May 2024 00:52:14 +0000 Subject: [PATCH 148/157] chore(deps): bump github/codeql-action from 2.13.4 to 3.25.5 Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.13.4 to 3.25.5. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/cdcdbb579706841c47f7063dda365e292e5cad7a...b7cec7526559c32f1616476ff32d17ba4c59b2d6) --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/codeql.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index a76f8048..fcf946de 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -27,10 +27,10 @@ jobs: - name: Checkout code uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 - name: Initialize CodeQL - uses: github/codeql-action/init@cdcdbb579706841c47f7063dda365e292e5cad7a + uses: github/codeql-action/init@b7cec7526559c32f1616476ff32d17ba4c59b2d6 with: languages: go - name: Autobuild - uses: github/codeql-action/autobuild@cdcdbb579706841c47f7063dda365e292e5cad7a + uses: github/codeql-action/autobuild@b7cec7526559c32f1616476ff32d17ba4c59b2d6 - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@cdcdbb579706841c47f7063dda365e292e5cad7a + uses: github/codeql-action/analyze@b7cec7526559c32f1616476ff32d17ba4c59b2d6 From 5dee9d74a6221d89cd9c3f276079c3a3548c1780 Mon Sep 17 00:00:00 2001 From: Ernesto Casablanca <65033249+TendTo@users.noreply.github.com> Date: Mon, 20 May 2024 11:02:15 +0000 Subject: [PATCH 149/157] fix: correct links for versions higher than 6 --- src/segments/bazel.go | 4 ++-- src/segments/bazel_test.go | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/segments/bazel.go b/src/segments/bazel.go index 0c146cd5..ff97002c 100644 --- a/src/segments/bazel.go +++ b/src/segments/bazel.go @@ -33,8 +33,8 @@ func (c *Bazel) Init(props properties.Properties, env platform.Environment) { regex: `bazel (?P((?P[0-9]+).(?P[0-9]+).(?P[0-9]+)))`, }, }, - // Use the correct URL for Bazel 6.x. it does not have the docs subdomain. - versionURLTemplate: "https://{{ if ne .Major \"6\" }}docs.{{ end }}bazel.build/versions/{{ .Major }}.{{ .Minor }}.{{ .Patch }}", + // Use the correct URL for Bazel >5.4.1, since they do not have the docs subdomain. + versionURLTemplate: "https://{{ if lt .Major 6 }}docs.{{ end }}bazel.build/versions/{{ .Major }}.{{ .Minor }}.{{ .Patch }}", } c.Icon = props.GetString(Icon, "\ue63a") } diff --git a/src/segments/bazel_test.go b/src/segments/bazel_test.go index 243cdd7d..72ff2131 100644 --- a/src/segments/bazel_test.go +++ b/src/segments/bazel_test.go @@ -14,9 +14,12 @@ func TestBazel(t *testing.T) { Version string Template string }{ + {Case: "bazel 4.0.0", ExpectedString: "https://docs.bazel.build/versions/4.0.0\ue63a 4.0.0", Version: "bazel 4.0.0", Template: ""}, + {Case: "bazel 5.4.1", ExpectedString: "https://docs.bazel.build/versions/5.4.1\ue63a 5.4.1", Version: "bazel 5.4.1", Template: ""}, {Case: "bazel 6.4.0", ExpectedString: "https://bazel.build/versions/6.4.0\ue63a 6.4.0", Version: "bazel 6.4.0", Template: ""}, - {Case: "bazel 10.11.12", ExpectedString: "https://docs.bazel.build/versions/3.7.0\ue63a 3.7.0", Version: "bazel 3.7.0"}, - {Case: "", ExpectedString: "\ue63a err parsing info from bazel with", Version: ""}, + {Case: "bazel 7.1.1", ExpectedString: "https://bazel.build/versions/7.1.1\ue63a 7.1.1", Version: "bazel 7.1.1", Template: ""}, + {Case: "bazel 10.11.12", ExpectedString: "https://bazel.build/versions/10.11.12\ue63a 10.11.12", Version: "bazel 10.11.12", Template: ""}, + {Case: "", ExpectedString: "\ue63a err parsing info from bazel with", Version: "", Template: ""}, } for _, tc := range cases { params := &mockedLanguageParams{ From eebb45ef07343f4e989f028603afcd2ba13d8f7a Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Mon, 20 May 2024 19:59:39 +0200 Subject: [PATCH 150/157] fix(iterm): initialize prompt mark correctly for all supported shells --- src/ansi/ansi_writer.go | 1 - src/ansi/iterm.go | 21 ++++++++++++++++++++- src/cli/init.go | 2 ++ src/engine/prompt.go | 2 +- src/shell/init.go | 11 +++++++++++ src/shell/scripts/omp.fish | 10 ++++++++++ 6 files changed, 44 insertions(+), 3 deletions(-) diff --git a/src/ansi/ansi_writer.go b/src/ansi/ansi_writer.go index a6b38b56..13522a38 100644 --- a/src/ansi/ansi_writer.go +++ b/src/ansi/ansi_writer.go @@ -181,7 +181,6 @@ func (w *Writer) Init(shellName string) { w.osc99 = "\x1b]9;9;%s\x1b\\" w.osc7 = "\x1b]7;file://%s/%s\x1b\\" w.osc51 = "\x1b]51;A%s@%s:%s\x1b\\" - w.iTermPromptMark = "$(iterm2_prompt_mark)" w.iTermCurrentDir = "\x1b]1337;CurrentDir=%s\x07" w.iTermRemoteHost = "\x1b]1337;RemoteHost=%s@%s\x07" } diff --git a/src/ansi/iterm.go b/src/ansi/iterm.go index 6b013319..d2f692a4 100644 --- a/src/ansi/iterm.go +++ b/src/ansi/iterm.go @@ -2,7 +2,10 @@ package ansi import ( "fmt" + "slices" "strings" + + "github.com/jandedobbeleer/oh-my-posh/src/shell" ) type iTermFeature string @@ -15,11 +18,27 @@ const ( type ITermFeatures []iTermFeature -func (w *Writer) RenderItermFeatures(features ITermFeatures, pwd, user, host string) string { +func (f ITermFeatures) Contains(feature iTermFeature) bool { + for _, item := range f { + if item == feature { + return true + } + } + + return false +} + +func (w *Writer) RenderItermFeatures(features ITermFeatures, sh, pwd, user, host string) string { + supportedShells := []string{shell.BASH, shell.ZSH} + var result strings.Builder for _, feature := range features { switch feature { case PromptMark: + if !slices.Contains(supportedShells, sh) { + continue + } + result.WriteString(w.iTermPromptMark) case CurrentDir: result.WriteString(fmt.Sprintf(w.iTermCurrentDir, pwd)) diff --git a/src/cli/init.go b/src/cli/init.go index 9ff287b1..75689ff0 100644 --- a/src/cli/init.go +++ b/src/cli/init.go @@ -3,6 +3,7 @@ package cli import ( "fmt" + "github.com/jandedobbeleer/oh-my-posh/src/ansi" "github.com/jandedobbeleer/oh-my-posh/src/engine" "github.com/jandedobbeleer/oh-my-posh/src/platform" "github.com/jandedobbeleer/oh-my-posh/src/shell" @@ -71,6 +72,7 @@ func runInit(shellName string) { shell.ErrorLine = cfg.ErrorLine != nil || cfg.ValidLine != nil shell.Tooltips = len(cfg.Tooltips) > 0 shell.ShellIntegration = cfg.ShellIntegration + shell.PromptMark = shellName == shell.FISH && cfg.ITermFeatures != nil && cfg.ITermFeatures.Contains(ansi.PromptMark) for i, block := range cfg.Blocks { // only fetch cursor position when relevant diff --git a/src/engine/prompt.go b/src/engine/prompt.go index 7fdfb406..30e098dd 100644 --- a/src/engine/prompt.go +++ b/src/engine/prompt.go @@ -70,7 +70,7 @@ func (e *Engine) Primary() string { if e.Config.ITermFeatures != nil && e.isIterm() { host, _ := e.Env.Host() - e.write(e.Writer.RenderItermFeatures(e.Config.ITermFeatures, e.Env.Pwd(), e.Env.User(), host)) + e.write(e.Writer.RenderItermFeatures(e.Config.ITermFeatures, e.Env.Shell(), e.Env.Pwd(), e.Env.User(), host)) } if e.Config.ShellIntegration && e.Config.TransientPrompt == nil { diff --git a/src/shell/init.go b/src/shell/init.go index 14bfe60b..df74910e 100644 --- a/src/shell/init.go +++ b/src/shell/init.go @@ -52,6 +52,7 @@ var ( ShellIntegration bool RPrompt bool CursorPositioning bool + PromptMark bool ) func getExecutablePath(env platform.Environment) (string, error) { @@ -207,9 +208,18 @@ func PrintInit(env platform.Environment) string { if env.Flags().Manual { return "false" } + return strconv.FormatBool(setting) } + promptMark := func() string { + if PromptMark { + return "iterm2_prompt_mark" + } + + return "" + } + shell := env.Flags().Shell configFile := env.Flags().Config @@ -273,6 +283,7 @@ func PrintInit(env platform.Environment) string { "::CURSOR::", strconv.FormatBool(CursorPositioning), "::UPGRADE::", strconv.FormatBool(hasNotice), "::UPGRADENOTICE::", notice, + "::PROMPT_MARK::", promptMark(), ).Replace(script) } diff --git a/src/shell/scripts/omp.fish b/src/shell/scripts/omp.fish index 925e304c..6b795fb3 100644 --- a/src/shell/scripts/omp.fish +++ b/src/shell/scripts/omp.fish @@ -23,16 +23,19 @@ function fish_prompt ::OMP:: print transient --config $POSH_THEME --shell fish --status $omp_status_cache --pipestatus="$omp_pipestatus_cache" --execution-time $omp_duration --stack-count $omp_stack_count --shell-version $FISH_VERSION --no-status=$omp_no_exit_code return end + set --global omp_status_cache $omp_status_cache_temp set --global omp_pipestatus_cache $omp_pipestatus_cache_temp set --global omp_stack_count (count $dirstack) set --global omp_duration "$CMD_DURATION$cmd_duration" set --global omp_no_exit_code false + # check if variable set, < 3.2 case if set --query omp_lastcommand; and test "$omp_lastcommand" = "" set omp_duration 0 set omp_no_exit_code true end + # works with fish >=3.2 if set --query omp_last_status_generation; and test "$omp_last_status_generation" = "$status_generation" set omp_duration 0 @@ -41,16 +44,23 @@ function fish_prompt # first execution - $status_generation is 0, $omp_last_status_generation is empty set omp_no_exit_code true end + if set --query status_generation set --global --export omp_last_status_generation $status_generation end + set_poshcontext + # validate if the user cleared the screen set --local omp_cleared false set --local last_command (history search --max 1) + if test "$last_command" = "clear" set omp_cleared true end + + ::PROMPT_MARK:: + ::OMP:: print primary --config $POSH_THEME --shell fish --status $omp_status_cache --pipestatus="$omp_pipestatus_cache" --execution-time $omp_duration --stack-count $omp_stack_count --shell-version $FISH_VERSION --cleared=$omp_cleared --no-status=$omp_no_exit_code end From 44da6a660e9c407a886c6da39af38b2a2e4fdfd3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 May 2024 00:57:21 +0000 Subject: [PATCH 151/157] chore: update github/codeql-action to v3.25.6 Signed-off-by: dependabot[bot] --- .github/workflows/codeql.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index fcf946de..42c69761 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -27,10 +27,10 @@ jobs: - name: Checkout code uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 - name: Initialize CodeQL - uses: github/codeql-action/init@b7cec7526559c32f1616476ff32d17ba4c59b2d6 + uses: github/codeql-action/init@9fdb3e49720b44c48891d036bb502feb25684276 with: languages: go - name: Autobuild - uses: github/codeql-action/autobuild@b7cec7526559c32f1616476ff32d17ba4c59b2d6 + uses: github/codeql-action/autobuild@9fdb3e49720b44c48891d036bb502feb25684276 - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@b7cec7526559c32f1616476ff32d17ba4c59b2d6 + uses: github/codeql-action/analyze@9fdb3e49720b44c48891d036bb502feb25684276 From be47940d0065693244fc40a602324b4ecb7cbd84 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Thu, 23 May 2024 09:49:47 +0200 Subject: [PATCH 152/157] feat(powerline): add leading_powerline_symbol --- src/engine/block.go | 48 +++++++++++++++++++++----- src/engine/segment.go | 41 +++++++++++----------- themes/schema.json | 8 ++++- website/docs/configuration/segment.mdx | 46 +++++++++++++----------- 4 files changed, 94 insertions(+), 49 deletions(-) diff --git a/src/engine/block.go b/src/engine/block.go index f07e4d4b..21410507 100644 --- a/src/engine/block.go +++ b/src/engine/block.go @@ -176,38 +176,70 @@ func (b *Block) writeSeparator(final bool) { if isPreviousDiamond { b.adjustTrailingDiamondColorOverrides() } + if isPreviousDiamond && isCurrentDiamond && len(b.activeSegment.LeadingDiamond) == 0 { b.writer.Write(ansi.Background, ansi.ParentBackground, b.previousActiveSegment.TrailingDiamond) return } + if isPreviousDiamond && len(b.previousActiveSegment.TrailingDiamond) > 0 { b.writer.Write(ansi.Transparent, ansi.ParentBackground, b.previousActiveSegment.TrailingDiamond) } - resolvePowerlineSymbol := func() string { - var symbol string - if b.activeSegment.isPowerline() { - symbol = b.activeSegment.PowerlineSymbol - } else if b.previousActiveSegment != nil && b.previousActiveSegment.isPowerline() { - symbol = b.previousActiveSegment.PowerlineSymbol + isPowerline := b.activeSegment.isPowerline() + + shouldOverridePowerlineLeadingSymbol := func() bool { + if !isPowerline { + return false } - return symbol + + if isPowerline && len(b.activeSegment.LeadingPowerlineSymbol) == 0 { + return false + } + + if b.previousActiveSegment != nil && b.previousActiveSegment.isPowerline() { + return false + } + + return true } + + if shouldOverridePowerlineLeadingSymbol() { + b.writer.Write(ansi.Transparent, ansi.Background, b.activeSegment.LeadingPowerlineSymbol) + return + } + + resolvePowerlineSymbol := func() string { + if isPowerline { + return b.activeSegment.PowerlineSymbol + } + + if b.previousActiveSegment != nil && b.previousActiveSegment.isPowerline() { + return b.previousActiveSegment.PowerlineSymbol + } + + return "" + } + symbol := resolvePowerlineSymbol() if len(symbol) == 0 { return } + bgColor := ansi.Background - if final || !b.activeSegment.isPowerline() { + if final || !isPowerline { bgColor = ansi.Transparent } + if b.activeSegment.style() == Diamond && len(b.activeSegment.LeadingDiamond) == 0 { bgColor = ansi.Background } + if b.activeSegment.InvertPowerline { b.writer.Write(b.getPowerlineColor(), bgColor, symbol) return } + b.writer.Write(bgColor, b.getPowerlineColor(), symbol) } diff --git a/src/engine/segment.go b/src/engine/segment.go index 1d8be362..aa26c35c 100644 --- a/src/engine/segment.go +++ b/src/engine/segment.go @@ -20,26 +20,27 @@ import ( // Segment represent a single segment and it's configuration type Segment struct { - Type SegmentType `json:"type,omitempty" toml:"type,omitempty"` - Tips []string `json:"tips,omitempty" toml:"tips,omitempty"` - Style SegmentStyle `json:"style,omitempty" toml:"style,omitempty"` - PowerlineSymbol string `json:"powerline_symbol,omitempty" toml:"powerline_symbol,omitempty"` - InvertPowerline bool `json:"invert_powerline,omitempty" toml:"invert_powerline,omitempty"` - Foreground string `json:"foreground,omitempty" toml:"foreground,omitempty"` - ForegroundTemplates template.List `json:"foreground_templates,omitempty" toml:"foreground_templates,omitempty"` - Background string `json:"background,omitempty" toml:"background,omitempty"` - BackgroundTemplates template.List `json:"background_templates,omitempty" toml:"background_templates,omitempty"` - LeadingDiamond string `json:"leading_diamond,omitempty" toml:"leading_diamond,omitempty"` - TrailingDiamond string `json:"trailing_diamond,omitempty" toml:"trailing_diamond,omitempty"` - Template string `json:"template,omitempty" toml:"template,omitempty"` - Templates template.List `json:"templates,omitempty" toml:"templates,omitempty"` - TemplatesLogic template.Logic `json:"templates_logic,omitempty" toml:"templates_logic,omitempty"` - Properties properties.Map `json:"properties,omitempty" toml:"properties,omitempty"` - Interactive bool `json:"interactive,omitempty" toml:"interactive,omitempty"` - Alias string `json:"alias,omitempty" toml:"alias,omitempty"` - MaxWidth int `json:"max_width,omitempty" toml:"max_width,omitempty"` - MinWidth int `json:"min_width,omitempty" toml:"min_width,omitempty"` - Filler string `json:"filler,omitempty" toml:"filler,omitempty"` + Type SegmentType `json:"type,omitempty" toml:"type,omitempty"` + Tips []string `json:"tips,omitempty" toml:"tips,omitempty"` + Style SegmentStyle `json:"style,omitempty" toml:"style,omitempty"` + PowerlineSymbol string `json:"powerline_symbol,omitempty" toml:"powerline_symbol,omitempty"` + LeadingPowerlineSymbol string `json:"leading_powerline_symbol,omitempty" toml:"leading_powerline_symbol,omitempty"` + InvertPowerline bool `json:"invert_powerline,omitempty" toml:"invert_powerline,omitempty"` + Foreground string `json:"foreground,omitempty" toml:"foreground,omitempty"` + ForegroundTemplates template.List `json:"foreground_templates,omitempty" toml:"foreground_templates,omitempty"` + Background string `json:"background,omitempty" toml:"background,omitempty"` + BackgroundTemplates template.List `json:"background_templates,omitempty" toml:"background_templates,omitempty"` + LeadingDiamond string `json:"leading_diamond,omitempty" toml:"leading_diamond,omitempty"` + TrailingDiamond string `json:"trailing_diamond,omitempty" toml:"trailing_diamond,omitempty"` + Template string `json:"template,omitempty" toml:"template,omitempty"` + Templates template.List `json:"templates,omitempty" toml:"templates,omitempty"` + TemplatesLogic template.Logic `json:"templates_logic,omitempty" toml:"templates_logic,omitempty"` + Properties properties.Map `json:"properties,omitempty" toml:"properties,omitempty"` + Interactive bool `json:"interactive,omitempty" toml:"interactive,omitempty"` + Alias string `json:"alias,omitempty" toml:"alias,omitempty"` + MaxWidth int `json:"max_width,omitempty" toml:"max_width,omitempty"` + MinWidth int `json:"min_width,omitempty" toml:"min_width,omitempty"` + Filler string `json:"filler,omitempty" toml:"filler,omitempty"` Enabled bool `json:"-" toml:"-"` diff --git a/themes/schema.json b/themes/schema.json index bfa75aad..833902be 100644 --- a/themes/schema.json +++ b/themes/schema.json @@ -578,7 +578,13 @@ "type": "string", "title": "Powerline Symbol", "description": "https://ohmyposh.dev/docs/configuration/segment#powerline-symbol", - "default": "\uE0B0" + "default": "\ue0b0" + }, + "leading_powerline_symbol": { + "type": "string", + "title": "Leading Powerline Symbol", + "description": "https://ohmyposh.dev/docs/configuration/segment#powerline-symbol", + "default": "\ue0d7" }, "invert_powerline": { "type": "boolean", diff --git a/website/docs/configuration/segment.mdx b/website/docs/configuration/segment.mdx index cad2a121..9b61d5a0 100644 --- a/website/docs/configuration/segment.mdx +++ b/website/docs/configuration/segment.mdx @@ -33,26 +33,27 @@ understand how to configure a segment. } ``` -| Name | Type | Description | -| ---------------------- | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `type` | `string` | takes the `string` value referencing which segment logic it needs to run (see [segments][segments] for possible values) | -| `style` | `string` | see [Style][style] below. Possible values:
  • `powerline`
  • `plain`
  • `diamond`
  • `accordion`
  • a go [text/template][go-text-template] [template][templates] resolving to the above values
| -| `powerline_symbol` | `string` | character to use when `"style": "powerline"` | -| `invert_powerline` | `boolean` | if `true` swaps the foreground and background colors. Can be useful when the character you want does not exist in the perfectly mirrored variant for example - defaults to `false` | -| `leading_diamond` | `string` | character to use at the start of the segment. Will take the background color of the segment as its foreground color | -| `trailing_diamond` | `string` | character to use at the end of the segment. Will take the background color of the segment as its foreground color | -| `foreground` | `string` | [color][colors] | -| `foreground_templates` | `[]Template` | [color templates][color-templates] | -| `background` | `string` | [color][colors] | -| `background_templates` | `[]Template` | [color templates][color-templates] | -| `template` | `string` | a go [text/template][go-text-template] [template][templates] to render the prompt | -| `templates` | `[]Template` | in some cases having a single [template][templates] string is a bit cumbersome. Templates allows you to span the segment's [template][templates] string multiple lines where every [template][templates] is evaluated and depending on what you aim to achieve, there are two possible outcomes based on `templates_logic` | -| `templates_logic` | `string` |
  • `first_match`: return the first non-whitespace string and skip everything else
  • `join`:evaluate all templates and join all non-whitespace strings (**default**)
| -| `properties` | `[]Property` | see [Properties][properties] below | -| `interactive` | `boolean` | when is true, the segment text is not escaped to allow the use of interactive prompt escape sequences - defaults to `false` | -| `alias` | `string` | for use with [cross segment template properties][cstp] | -| `min_width` | `int` | if the terminal width is smaller than this value, the segment will be hidden. For your terminal width, see `oh-my-posh get width`. Defaults to `0` (disable) | -| `max_width` | `int` | if the terminal width exceeds this value, the segment will be hidden. For your terminal width, see `oh-my-posh get width`. Defaults to `0` (disable) | +| Name | Type | Description | +| -------------------------- | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `type` | `string` | takes the `string` value referencing which segment logic it needs to run (see [segments][segments] for possible values) | +| `style` | `string` | see [Style][style] below. Possible values:
  • `powerline`
  • `plain`
  • `diamond`
  • `accordion`
  • a go [text/template][go-text-template] [template][templates] resolving to the above values
| +| `powerline_symbol` | `string` | character to use when `"style": "powerline"` | +| `leading_powerline_symbol` | `string` | when `"style": "powerline"` we use an ANSI hack to invert the `powerline_symbol` to create a transparent glyph. This gives the best alignment, but might not work in every terminal. If you see black elements at the start of powerline segments, you can set this to the "opening" version of the `powerline_symbol`. | +| `invert_powerline` | `boolean` | if `true` swaps the foreground and background colors. Can be useful when the character you want does not exist in the perfectly mirrored variant for example - defaults to `false` | +| `leading_diamond` | `string` | character to use at the start of the segment. Will take the background color of the segment as its foreground color | +| `trailing_diamond` | `string` | character to use at the end of the segment. Will take the background color of the segment as its foreground color | +| `foreground` | `string` | [color][colors] | +| `foreground_templates` | `[]Template` | [color templates][color-templates] | +| `background` | `string` | [color][colors] | +| `background_templates` | `[]Template` | [color templates][color-templates] | +| `template` | `string` | a go [text/template][go-text-template] [template][templates] to render the prompt | +| `templates` | `[]Template` | in some cases having a single [template][templates] string is a bit cumbersome. Templates allows you to span the segment's [template][templates] string multiple lines where every [template][templates] is evaluated and depending on what you aim to achieve, there are two possible outcomes based on `templates_logic` | +| `templates_logic` | `string` |
  • `first_match`: return the first non-whitespace string and skip everything else
  • `join`:evaluate all templates and join all non-whitespace strings (**default**)
| +| `properties` | `[]Property` | see [Properties][properties] below | +| `interactive` | `boolean` | when is true, the segment text is not escaped to allow the use of interactive prompt escape sequences - defaults to `false` | +| `alias` | `string` | for use with [cross segment template properties][cstp] | +| `min_width` | `int` | if the terminal width is smaller than this value, the segment will be hidden. For your terminal width, see `oh-my-posh get width`. Defaults to `0` (disable) | +| `max_width` | `int` | if the terminal width exceeds this value, the segment will be hidden. For your terminal width, see `oh-my-posh get width`. Defaults to `0` (disable) | ## Style @@ -66,6 +67,11 @@ What started it all for us. Makes use of a single symbol (`powerline_symbol`) to background color of the previous segment (or transparent if none) and the foreground of the current one (or transparent if we're at the last segment). Expects segments to have a colored background, else there little use for this one. +When you see black triangles (or other characters depending on the `powerline_symbol` you use) at the start of a segment, +you can set `leading_powerline_symbol` to the "opening" version of the `powerline_symbol`. +This will not use the inverted ANSI hack we have in place as that's not supported in every terminal. You might need to tweak +your font settings to get the best alignment. + ### Plain Simple. Colored text on a transparent background. Make sure to set `foreground` for maximum enjoyment. From e03023d1cc51434a5945dedac9a6eddc9ed7779c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 22 May 2024 00:19:08 +0000 Subject: [PATCH 153/157] chore: bump github.com/goccy/go-json from 0.10.2 to 0.10.3 Signed-off-by: dependabot[bot] --- src/go.mod | 2 +- src/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/go.mod b/src/go.mod index 668661ac..31cfec89 100644 --- a/src/go.mod +++ b/src/go.mod @@ -31,7 +31,7 @@ require ( github.com/charmbracelet/bubbles v0.18.0 github.com/charmbracelet/bubbletea v0.26.2 github.com/charmbracelet/lipgloss v0.10.0 - github.com/goccy/go-json v0.10.2 + github.com/goccy/go-json v0.10.3 github.com/goccy/go-yaml v1.11.3 github.com/gookit/goutil v0.6.15 github.com/hashicorp/hcl/v2 v2.20.1 diff --git a/src/go.sum b/src/go.sum index aacdf056..17556de1 100644 --- a/src/go.sum +++ b/src/go.sum @@ -57,8 +57,8 @@ github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7a github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68= github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= -github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= -github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= +github.com/goccy/go-json v0.10.3 h1:KZ5WoDbxAIgm2HNbYckL0se1fHD6rz5j4ywS6ebzDqA= +github.com/goccy/go-json v0.10.3/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= From 9058a9778ec00d2b2319312ba879461f1c3fbd9a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 22 May 2024 00:19:18 +0000 Subject: [PATCH 154/157] chore: bump TriPSs/conventional-changelog-action from 5.2.1 to 5.3.0 Signed-off-by: dependabot[bot] --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c99f34ae..bb0efde7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,7 +22,7 @@ jobs: uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 - name: Create changelog ✍️ id: changelog - uses: TriPSs/conventional-changelog-action@f04dac1fd07687cec8ea302937ca588b33786e98 + uses: TriPSs/conventional-changelog-action@3a392e9aa44a72686b0fc13259a90d287dd0877c with: github-token: ${{ secrets.github_token }} skip-version-file: "true" From 11606ead7ade84fdbce06e63b89a78e9a7ba3354 Mon Sep 17 00:00:00 2001 From: Jeffrey Labonski Date: Tue, 21 May 2024 17:56:21 -0400 Subject: [PATCH 155/157] feat(helm): add helmfile support --- src/segments/helm.go | 2 +- src/segments/helm_test.go | 16 ++++++++++++++++ website/docs/segments/helm.mdx | 2 +- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/segments/helm.go b/src/segments/helm.go index 9df1e745..9fa4d830 100644 --- a/src/segments/helm.go +++ b/src/segments/helm.go @@ -19,7 +19,7 @@ func (h *Helm) Enabled() bool { } inChart := false - files := []string{"Chart.yml", "Chart.yaml"} + files := []string{"Chart.yml", "Chart.yaml", "helmfile.yaml", "helmfile.yml"} for _, file := range files { if _, err := h.env.HasParentFilePath(file); err == nil { inChart = true diff --git a/src/segments/helm_test.go b/src/segments/helm_test.go index 83e5d4a3..f7a299e2 100644 --- a/src/segments/helm_test.go +++ b/src/segments/helm_test.go @@ -57,6 +57,22 @@ func TestHelmSegment(t *testing.T) { DisplayMode: "files", ChartFile: "Chart.yaml", }, + { + Case: "DisplayMode always inside chart. Chart file helmfile.yaml", + HelmExists: true, + ExpectedEnabled: true, + ExpectedString: "Helm 3.12.3", + DisplayMode: "files", + ChartFile: "helmfile.yaml", + }, + { + Case: "DisplayMode always inside chart. Chart file helmfile.yml", + HelmExists: true, + ExpectedEnabled: true, + ExpectedString: "Helm 3.12.3", + DisplayMode: "files", + ChartFile: "helmfile.yml", + }, { Case: "DisplayMode always outside chart", HelmExists: true, diff --git a/website/docs/segments/helm.mdx b/website/docs/segments/helm.mdx index b232c151..58fc7e07 100644 --- a/website/docs/segments/helm.mdx +++ b/website/docs/segments/helm.mdx @@ -25,7 +25,7 @@ import Config from '@site/src/components/Config.js'; | Name | Type | Default | Description | | -------------- | :------: | :------: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `display_mode` | `string` | `always` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when a `Chart.yaml` (or `Chart.yml`) file is present
| +| `display_mode` | `string` | `always` |
  • `always`: the segment is always displayed
  • `files`: the segment is only displayed when a chart source file `Chart.yaml` (or `Chart.yml`) or helmfile `helmfile.yaml` (or `helmfile.yml`) is present
| ## Template ([info][templates]) From 781b6fabbaaeffc069f4caec4b93e5d7089f4e3f Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Thu, 23 May 2024 16:13:13 +0000 Subject: [PATCH 156/157] docs: update website/docs/contributors.md [skip ci] --- website/docs/contributors.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/website/docs/contributors.md b/website/docs/contributors.md index 14b555d1..120952ff 100644 --- a/website/docs/contributors.md +++ b/website/docs/contributors.md @@ -344,6 +344,9 @@ Thanks goes to these wonderful people ([emoji key][acek]): Timothy Huber
Timothy Huber

🎨 Yash Mistry
Yash Mistry

🎨 + + Jeffrey Labonski
Jeffrey Labonski

💻 📖 + From eadb4da449abb26d45bc94da0500c321793c6f2c Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Thu, 23 May 2024 16:13:14 +0000 Subject: [PATCH 157/157] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index e1e10a39..ab9bed33 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2416,6 +2416,16 @@ "contributions": [ "design" ] + }, + { + "login": "jlabonski", + "name": "Jeffrey Labonski", + "avatar_url": "https://avatars.githubusercontent.com/u/2981369?v=4", + "profile": "https://github.com/jlabonski", + "contributions": [ + "code", + "doc" + ] } ], "contributorsPerLine": 7,