how to make repo status appear in posh git (oh-my-posh) - powershell

so basically i want the repository status to be shown and not hidden like this example :
and my terminal without theme shows the repo status but when i apply a theme the numbers (repo status ) disapear like yo see in this pic :
so any fix to that prob ??

The theme you have chosen does not include the git add/modified/deleted/untracked counts. For example paradox.omp.json does not include them. To include these counts, you can either:
Choose a theme which does include the full git information, such as peru
or
Edit your oh-my-posh theme file (e.g. paradox.omp.json) to include the git counts. Find the git segment, and add the following lines into the properties section:
"fetch_status": true,
"template": "{{ .HEAD }} {{ .BranchStatus }}{{ if .Working.Changed }} \uF044 {{ .Working.String }}{{ end }}{{ if and (.Staging.Changed) (.Working.Changed) }} |{{ end }}{{ if .Staging.Changed }} \uF046 {{ .Staging.String }}{{ end }}{{ if gt .StashCount 0}} \uF692 {{ .StashCount }}{{ end }}{{ if gt .WorktreeCount 0}} \uf1bb {{ .WorktreeCount }}{{ end }}"

Related

What syntax to use for parsing {{ from_dttm }} and {{ to_dttm }} Jinja variables as datetime objects in Custom SQL queries?

Question: How to correctly format {{ from_dttm }} and {{ to_dttm }} default Jinja variables so that they are parsed as datetime objects in Apache Superset Custom SQL metrics?
MWE: Say I want to show what is the time range covered by the data I use in my dashboards — what can be affected by the Time Range filter.
I use the public.birth_names demo dataset for the sake of the example.
So I create a BigNumber chart, with the following custom Metric:
age(
{% if from_dttm is not none %}
'{{ from_dttm }}'
{% else %}
min(ds)
{% endif %}
,
{% if to_dttm is not none %}
'{{ to_dttm }}'
{% else %}
max(ds)
{% endif %}
)
However, if I format the Jinja variables as:
{{ from_dttm }}, I get:
Error: syntax error at or near "{"
LINE 1: SELECT age({{ from_dttm }} , '{{ to_dttm }}') AS "age(
'{{ from_dttm }}', I get
Error: invalid input syntax for type timestamp with time zone: "{{ from_dttm }}"
LINE 1: SELECT age('{{ from_dttm }}'
"{{ from_dttm }}", I get
Error: column "{{ from_dttm }}" does not exist
LINE 1: SELECT age("{{ from_dttm }}" ,
I'm using Superset at 5ae7e5499 (Latest commit on Mar 25, 2022), with PostgreSQL as back-end db engine.
After offline discussion with #villebro, it turns out that:
'{{ from_dttm }}' is the valid syntax — one can try with a simpler example: MIN('{{ from_dttm }}'): this works, whereas both other syntaxes yield an error.
however, there is still a bug in current (version 1.4.*) versions, where {{ from_dttm }} is not rendered (what caused AGE() to yield an error in the particular example above). This issue has been raised in #19564, and a fix submitted in #19565.

Helm: overloading global variables on {{ include }} call?

I have a shared metadata block, based on the commons library that I would like to override a name for one specific instance. Is it possible?
metadata:
{{ include "common.metadata" (merge (dict ".Values.fullnameSuffix" "-redirect") .) }} # Doesn't work - How do I add a `-redirect` suffix?
name: {{ include "common.fullname" . }}-redirect # Causes two `name:` attributes
Within common.metadata there is a call to "fullname" as well:
{{ define "common.metadata" -}}
name: {{ template "common.fullname" . }}
namespace: {{ .Release.Namespace }}
{{- end -}}
Is there a way to pass-down a variable override from the first include so that I can override the name:? It's specific only to this chart.
Use set to add a new key/value pair to a dictionary and pass it to slightly modified common.metadata helper function.
values.yaml
fullnameSuffix: redirect
_helpers.tpl
{{- define "common.metadata" -}}
{{- if .suffix }}
name: {{ template "common.fullname" . }}-{{ .suffix }}
{{- else }}
name: {{ template "common.fullname" . }}
{{- end }}
namespace: {{ .Release.Namespace }}
{{- end -}}
manifest.yaml
metadata:
{{- include "common.metadata" (set . "suffix" .Values.fullnameSuffix ) }}
If your fullnameSuffix is empty, name without suffix will be used.

HELM _helpers.tpl : How to check if template block is defined in _helpers.tpl?

I want to check if a template block has been defined in _helpers.tpl.
Sudo Code:
{{- if "sample.color" template is defined }}
color: {{ include "sample.color" . }}
{{- else }}
color: {{ .Values.color }}
{{- end }}
Is there a way to achieve {{- if "sample.color" template is defined }} in helm?

Define a variable in Helm template

I need to define a variable based on an if statement and use that variable multiple times.
In order not to repeat the if I tried something like this:
{{ if condition}}
{{ $my_val = "http" }}
{{ else }}
{{ $my_val = "https" }}
{{ end }}
{{ $my_val }}://google.com
However this returns an error:
Error: render error in "templates/deployment.yaml":
template: templates/deployment.yaml:30:28:
executing "templates/deployment.yaml" at
<include (print $.Template.BasePath "/config.yaml") .>: error calling
include: template: templates/config.yaml:175:59:
executing "templates/config.yaml" at <"https">: undefined variable: $my_val
Ideas?
The most direct path to this is to use the ternary function provided by the Sprig library. That would let you write something like
{{ $myVal := ternary "http" "https" condition -}}
{{ $myVal }}://google.com
A simpler, but more indirect path, is to write a template that generates the value, and calls it
{{- define "scheme" -}}
{{- if condition }}http{{ else }}https{{ end }}
{{- end -}}
{{ template "scheme" . }}://google.com
If you need to include this in another variable, Helm provides an include function that acts just like template except that it's an "expression" rather than something that outputs directly.
{{- $url := printf "%s://google.com" (include "scheme" .) -}}

Use Twig object as tag

Is there any way to use any random object as a tag in Twig?
I know I can set a variable - it's just that this would really be cleaner.
i.e.
{{ get_an_entry() }}
{{ name }} is {{ id }}
{{ end }}
or
{{ entry }}
{{ name }} is {{ id }}
{{ end }}
In the examples, the name and id values would come from entry or the return of get_an_entry()
Yes! It just need the __toString() PHP magic method implemented. An usage like that in fact triggers a string conversion.