Add Github Token to data + some cleanup

This commit is contained in:
Lockszmith (@VAST) 2025-03-11 15:47:48 -04:00
parent ae2ec14d46
commit f7d2944ed4
1 changed files with 22 additions and 10 deletions

View File

@ -1,3 +1,13 @@
{{- $githubToken := (env "CHEZMOI_GITHUB_ACCESS_TOKEN") }}
{{- if not ($githubToken) }}
{{- $githubToken = (env "GITHUB_ACCESS_TOKEN") }}
{{- end }}
{{- if not ($githubToken) }}
{{- $githubToken = (env "GITHUB_TOKEN") }}
{{- end }}
{{- if not ($githubToken) }}
{{- $githubToken = promptStringOnce . "githubToken" "Public GITHUB token (mostly for rate limits - !insecure!)" }}
{{- end }}
{{- $sysname := promptStringOnce . "sysname" "System name" }} {{- $sysname := promptStringOnce . "sysname" "System name" }}
{{- $sysgroup := promptStringOnce . "sysgroup" "System group" }} {{- $sysgroup := promptStringOnce . "sysgroup" "System group" }}
{{- $sysarea := promptStringOnce . "sysarea" "System area" }} {{- $sysarea := promptStringOnce . "sysarea" "System area" }}
@ -22,7 +32,6 @@
{{- $sysVendor = "pc" }} {{- $sysVendor = "pc" }}
{{- $chassisType = (output "powershell.exe" "-NoProfile" "-NonInteractive" "-Command" "if ((Get-CimInstance -Class Win32_Battery | Measure-Object).Count -gt 0) { Write-Output 'laptop' } else { Write-Output 'desktop' }") | trim }} {{- $chassisType = (output "powershell.exe" "-NoProfile" "-NonInteractive" "-Command" "if ((Get-CimInstance -Class Win32_Battery | Measure-Object).Count -gt 0) { Write-Output 'laptop' } else { Write-Output 'desktop' }") | trim }}
{{- end }} {{- end }}
{{- $githubToken := promptStringOnce . "githubToken" "Public GITHUB token (mostly for rate limits - !insecure!)" -}}
{{- $scriptTempDir := "~/.cache/chezmoi/tmp" }} {{- $scriptTempDir := "~/.cache/chezmoi/tmp" }}
scriptTempDir={{- $scriptTempDir | quote }} scriptTempDir={{- $scriptTempDir | quote }}
@ -30,32 +39,35 @@ scriptTempDir={{- $scriptTempDir | quote }}
[data] [data]
{{- if ($altArch) }} {{- if ($altArch) }}
altArch={{- $altArch | quote }} altArch={{- $altArch | quote }}
{{- end -}} {{- end }}
{{- if ($chassisType) }} {{- if ($chassisType) }}
chassisType={{- $chassisType | quote }} chassisType={{- $chassisType | quote }}
{{- end -}} {{- end }}
{{- if ($sysType) }} {{- if ($sysType) }}
sysType={{- $sysType | quote }} sysType={{- $sysType | quote }}
{{- end -}} {{- end }}
{{- if ($githubToken) }} {{- if ($githubToken) }}
githubToken={{- $githubToken | quote }} githubToken={{- $githubToken | quote }}
{{- end -}} {{- end }}
{{- if ($sysname) }} {{- if ($sysname) }}
sysname = {{ $sysname | quote }} sysname = {{ $sysname | quote }}
{{- end -}} {{- end }}
{{- if ($sysgroup) }} {{- if ($sysgroup) }}
sysgroup = {{ $sysgroup | quote }} sysgroup = {{ $sysgroup | quote }}
{{- end -}} {{- end }}
{{- if ($sysarea) }} {{- if ($sysarea) }}
sysarea = {{ $sysarea | quote }} sysarea = {{ $sysarea | quote }}
{{ end -}} {{ end }}
{{ if ($gitEmail) }} {{ if ($gitEmail) }}
gitEmail = {{ $gitEmail | quote }} gitEmail = {{ $gitEmail | quote }}
{{- end -}} {{- end }}
{{- if ($gitName) }} {{- if ($gitName) }}
gitName = {{ $gitName | quote }} gitName = {{ $gitName | quote }}
{{- end }} {{- end }}
{{- if not ($githubToken) }}
githubToken={{- $githubToken | quote }}
{{- end }}
[scriptEnv] [scriptEnv]
GITHUB_ACCESS_TOKEN={{- $githubToken | quote }} GITHUB_ACCESS_TOKEN={{- $githubToken | quote }}
@ -63,7 +75,7 @@ scriptTempDir={{- $scriptTempDir | quote }}
[diff] [diff]
# command = "nvim" # command = "nvim"
# args = ["-d", "{{- "{{ .Destination }}" -}}", "{{- "{{ .Target }}" -}}"] # args = ["-d", "{{ "{{ .Destination }}" }}", "{{ "{{ .Target }}" }}"]
command = "delta" command = "delta"
args = ["--paging=never", "{{ "{{ .Destination }}" }}", "{{ "{{ .Target }}" }}"] args = ["--paging=never", "{{ "{{ .Destination }}" }}", "{{ "{{ .Target }}" }}"]