Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .chezmoi.toml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
{{- $headless := promptBool "headless" $headlessGuess -}}
{{- $gpgconfigured := promptBool "gpgconfigured" $gpgconfiguredGuess -}}
{{- $autoGit := promptBool "auto git?" true -}}
{{- $spellcheckGuess := true -}}
{{- $spellcheck := promptBool "spellcheck" $spellcheckGuess -}}
{{- $spellcheck := or (lookPath "hunspell" | not | not) (lookPath "aspell" | not | not) (lookPath "ispell" | not | not) -}}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Automating the detection of spellcheck tools is a good improvement, but removing the promptBool prevents users from opting out if they have the tools installed but prefer not to enable the feature (e.g., for performance reasons). It is recommended to use the automated detection as the default value for the prompt. This maintains consistency with other configuration options in this file (like headless and gpgconfigured) and preserves user flexibility. The logic can also be simplified by applying not | not once to the result of the or expression.

{{- $spellcheckGuess := or (lookPath "hunspell") (lookPath "aspell") (lookPath "ispell") | not | not -}}
{{- $spellcheck := promptBool "spellcheck" $spellcheckGuess -}}

{{- $gitUserName := promptString "git user.name" (trim (output "sh" "-c" "git config --get user.name 2>/dev/null || getent passwd $(id -un) | cut -d ':' -f5 | cut -d ',' -f1 || getent passwd $(id -un) | cut -d ':' -f1")) -}}
{{- $gitUserEmail := promptString "git user.email" (trim (output "sh" "-c" "git config --get user.email 2>/dev/null || true")) -}}
{{- $generatedTime := now | date "2006-01-02 15:04:05 -0700" -}}
Expand Down
Loading