ScoopInstaller / Scoop

A command-line installer for Windows.
https://scoop.sh
Other
21.19k stars 1.41k forks source link

[Feature] Remove `last_update` from config to make it more dotfile-complient #5344

Closed goto1134 closed 1 year ago

goto1134 commented 1 year ago

Feature Request

Is your feature request related to a problem? Please describe.

I am using dotfiles to sync configuration across machines. There is a repository that contains all my configs managed by chezmoi, and I have a scoop config.json template there too.

Every time I check for any changes in configuration, scoop's config.json is different from the committed version. The only difference is the last_update field.

Describe the solution you'd like

last_update field is excluded from config.json and stored somewhere else.

rashil2000 commented 1 year ago

IMHO this feels like a limitation of the dotfile manager. It should have an option to allow for transient or wildcard fields.

The last_udpate field is necessary for best functioning of Scoop - and the ~/.config/scoop/config.json is the only file (outside of Scoop home) that Scoop manages - so it can't be stored anywhere else.

goto1134 commented 1 year ago

For anyone who will find this issue here is my bulky solution for the problem using templates:

{
  {{- $configFile := joinPath .chezmoi.homeDir ".config/scoop/config.json" }}
  {{- if stat $configFile }}
  {{- $configJson := include $configFile | fromJson }}
  {{- if $configJson }}
  {{- if index $configJson "last_update" }}
  {{- $last_update := $configJson.last_update }}
  {{- if $last_update }}
  "last_update": {{ $last_update | quote }},
  {{- end }}
  {{- end }}
  {{- end }}
  {{- end }}
  "aria2-enabled": true,
  "aria2-warning-enabled": false,
  "debug": false,
  "scoop_branch": "master",
  "scoop_repo": "https://github.com/ScoopInstaller/Scoop"
}