[!umask:022] skip

mksourcedir

chezmoi dump --format=json
cmp stdout golden/dump.json

chezmoi dump --format=json $HOME${/}.file
cmp stdout golden/dump-file.json

chezmoi dump --format=json $HOME${/}.dir
cmp stdout golden/dump-dir.json

chezmoi dump --format=json --recursive=false $HOME${/}.dir
cmp stdout golden/dump-dir-non-recursive.json

! chezmoi dump $HOME${/}.inputrc
stderr 'not in source state'

-- golden/dump.json --
{
  ".create": {
    "type": "file",
    "name": ".create",
    "contents": "# contents of .create\n",
    "perm": 420
  },
  ".dir": {
    "type": "dir",
    "name": ".dir",
    "perm": 493
  },
  ".dir/file": {
    "type": "file",
    "name": ".dir/file",
    "contents": "# contents of .dir/file\n",
    "perm": 420
  },
  ".dir/subdir": {
    "type": "dir",
    "name": ".dir/subdir",
    "perm": 493
  },
  ".dir/subdir/file": {
    "type": "file",
    "name": ".dir/subdir/file",
    "contents": "# contents of .dir/subdir/file\n",
    "perm": 420
  },
  ".empty": {
    "type": "file",
    "name": ".empty",
    "contents": "",
    "perm": 420
  },
  ".executable": {
    "type": "file",
    "name": ".executable",
    "contents": "# contents of .executable\n",
    "perm": 493
  },
  ".file": {
    "type": "file",
    "name": ".file",
    "contents": "# contents of .file\n",
    "perm": 420
  },
  ".private": {
    "type": "file",
    "name": ".private",
    "contents": "# contents of .private\n",
    "perm": 384
  },
  ".symlink": {
    "type": "symlink",
    "name": ".symlink",
    "linkname": ".dir/subdir/file"
  },
  ".template": {
    "type": "file",
    "name": ".template",
    "contents": "key = value\n",
    "perm": 420
  }
}
-- golden/dump-file.json --
{
  ".file": {
    "type": "file",
    "name": ".file",
    "contents": "# contents of .file\n",
    "perm": 420
  }
}
-- golden/dump-dir.json --
{
  ".dir": {
    "type": "dir",
    "name": ".dir",
    "perm": 493
  },
  ".dir/file": {
    "type": "file",
    "name": ".dir/file",
    "contents": "# contents of .dir/file\n",
    "perm": 420
  },
  ".dir/subdir": {
    "type": "dir",
    "name": ".dir/subdir",
    "perm": 493
  },
  ".dir/subdir/file": {
    "type": "file",
    "name": ".dir/subdir/file",
    "contents": "# contents of .dir/subdir/file\n",
    "perm": 420
  }
}
-- golden/dump-dir-non-recursive.json --
{
  ".dir": {
    "type": "dir",
    "name": ".dir",
    "perm": 493
  }
}
