twpayne / chezmoi

Manage your dotfiles across multiple diverse machines, securely.
https://www.chezmoi.io/
MIT License
13.4k stars 493 forks source link

“chezmoi add” should create ~/.chezmoi #15

Closed stapelberg closed 5 years ago

stapelberg commented 5 years ago
 % chezmoi add ~/.zshrc
Error: rename /tmp/.dot_zshrc208154389 /home/michael/.chezmoi/dot_zshrc: no such file or directory
Usage:
  chezmoi add [flags]

Flags:
  -e, --empty       add empty files
  -h, --help        help for add
  -r, --recursive   recurse in to subdirectories
  -T, --template    add files as templates

Global Flags:
  -c, --config string       config file (default "/home/michael/.chezmoi.yaml")
  -n, --dry-run             dry run
  -s, --source string       source directory (default "/home/michael/.chezmoi")
      --source-vcs string   source version control system command (default "git")
  -t, --target string       target directory (default "/home/michael")
  -u, --umask int           umask (default 2)
  -v, --verbose             verbose

2018/11/22 16:29:15 rename /tmp/.dot_zshrc208154389 /home/michael/.chezmoi/dot_zshrc: no such file or directory

After creating the directory with install -d -m 0700 .chezmoi, the command works as expected. But, to make setup easier, I think the command should create the directory for me :)

twpayne commented 5 years ago

There's a chezmoi init command that creates ~/.chezmoi, but I think you're right that it's easier to just do it on the first add.

twpayne commented 5 years ago

This functionality is now in the add command, and I've removed the init command. Thanks for the feedback!