Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chezmoi data doesn't respect format configuration variable #2305

Closed
Blacksmoke16 opened this issue Aug 28, 2022 · 1 comment · Fixed by #2306
Closed

chezmoi data doesn't respect format configuration variable #2305

Blacksmoke16 opened this issue Aug 28, 2022 · 1 comment · Fixed by #2306
Labels
bug Something isn't working

Comments

@Blacksmoke16
Copy link

Blacksmoke16 commented Aug 28, 2022

Describe the bug

Running chezmoi data with an explicit format: yaml configuration value set results in the data still being printed as JSON.

To reproduce

  1. Set format: yaml in your configuration file
  2. Run chezmoi data
  3. See that the data output is JSON

Expected behavior

Based on the description of the format configuration value, I would have expected the output of chezmoi data to be YAML.

Output of command with the --verbose flag

$ cat ~/.config/chezmoi/chezmoi.yaml | grep format
format: yaml

$ chezmoi --verbose data
{
  "chezmoi": {
    "arch": "amd64",
    "args": [
      "chezmoi",
      "--verbose",
      "data"
    ],
    # ..
  }
}

Output of chezmoi doctor

$ chezmoi doctor
RESULT    CHECK                MESSAGE
warning   version              v2.21.0, built at 2022-08-24T07:16:53Z
ok        latest-version       v2.21.0
ok        os-arch              linux/amd64 (Arch Linux)
ok        uname                Linux theStone 5.19.4-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 25 Aug 2022 17:31:12 +0000 x86_64 GNU/Linux
ok        go-version           go1.19 (gc)
ok        executable           /usr/bin/chezmoi
ok        config-file          ~/.config/chezmoi/chezmoi.yaml, last modified 2022-08-28T10:39:21-04:00
ok        source-dir           ~/dev/git/pc-configs/chezmoi is a directory
ok        suspicious-entries   no suspicious entries
warning   working-tree         ~/dev/git/pc-configs is a git working tree (dirty)
ok        dest-dir             ~ is a directory
ok        shell-command        found /bin/bash
ok        shell-args           /bin/bash
ok        cd-command           found /bin/bash
ok        cd-args              /bin/bash
ok        edit-command         found /usr/bin/subl
ok        edit-args            /usr/bin/subl
info      diff-command         not set
ok        umask                022
ok        git-command          found /usr/bin/git, version 2.37.2
warning   merge-command        vimdiff not found in $PATH
info      age-command          age not found in $PATH
ok        gpg-command          found /usr/bin/gpg, version 2.2.36
info      pinentry-command     not set
info      1password-command    op not found in $PATH
info      bitwarden-command    bw not found in $PATH
info      gopass-command       gopass not found in $PATH
info      keepassxc-command    keepassxc-cli not found in $PATH
info      keeper-command       keeper not found in $PATH
info      keepassxc-db         not set
info      lastpass-command     lpass not found in $PATH
info      pass-command         pass not found in $PATH
info      vault-command        vault not found in $PATH
info      secret-command       not set

Additional context

It does work correctly if you explicitly use the --format=yaml option.

@twpayne
Copy link
Owner

twpayne commented Aug 28, 2022

Thanks for reporting this! The format configuration variable was not correctly ported in the move to v2 (#654). #2306 should fix it.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants