chezmoiでdotfileの管理を楽にする
こんにちは、ナナオです。 今回はchezmoiというツールでdotfileを管理する基盤を作っていこうと思います。 chezmoiとは WSLとかlinuxとかMacとか触ってると、.sshとか.zshrcとかいろいろ出来上がると思います。 chezmoiはそんなdotfileたちを管理するためのツールです。 chezmoi - chezmoi インストール&ファイルを管理対象に含める miseを使ってインストールします。 mise use -g chezmoi brewでもインストールできます。 brew install chezmoi インストールはこれで完了です。 コマンドを確認してみましょう。 ❯ chezmoi Manage your dotfiles across multiple diverse machines, securely Usage: chezmoi [command] Documentation commands: doctor Check your system for potential problems help Print help about a command license Print license Daily commands: add Add an existing file, directory, or symlink to the source state apply Update the destination directory to match the target state chattr Change the attributes of a target in the source state diff Print the diff between the target state and the destination state edit Edit the source state of a target forget Remove a target from the source state init Setup the source directory and update the destination directory to match the target state merge Perform a three-way merge between the destination state, the source state, and the target state merge-all Perform a three-way merge for each modified file re-add Re-add modified files status Show the status of targets update Pull and apply any changes Template commands: cat Print the target contents of a file, script, or symlink data Print the template data execute-template Execute the given template(s) Advanced commands: cd Launch a shell in the source directory edit-config Edit the configuration file edit-config-template Edit the configuration file template generate Generate a file for use with chezmoi git Run git in the source directory ignored Print ignored targets managed List the managed entries in the destination directory unmanaged List the unmanaged files in the destination directory verify Exit with success if the destination state matches the target state, fail otherwise Encryption commands: age Interact with age age-keygen Generate an age identity or convert an age identity to an age recipient decrypt Decrypt file or standard input edit-encrypted Edit an encrypted file encrypt Encrypt file or standard input Remote commands: docker Use your dotfiles in a Docker container ssh SSH to a host and initialize dotfiles Migration commands: archive Generate a tar archive of the target state destroy Permanently delete an entry from the source state, the destination directory, and the state import Import an archive into the source state purge Purge chezmoi's configuration and data upgrade Upgrade chezmoi to the latest released version Internal commands: cat-config Print the configuration file completion Generate shell completion code dump Generate a dump of the target state dump-config Dump the configuration values secret Interact with a secret manager source-path Print the source path of a target state Manipulate the persistent state target-path Print the target path of a source path Flags: --age-recipient string Override age recipient --age-recipient-file string Override age recipient --cache path Set cache directory (default /home/banan/.cache/chezmoi) --color bool|auto Colorize output (default auto) -c, --config path Set config file --config-format <none>|json|toml|yaml Set config file format --debug Include debug information in output -D, --destination path Set destination directory (default /home/banan) -n, --dry-run Do not make any modifications to the destination directory --force Make all changes without prompting -h, --help help for chezmoi --interactive Prompt for all changes -k, --keep-going Keep going as far as possible after an error --less-interactive Prompt for changed or pre-existing targets --mode file|symlink Mode (default file) --no-pager Do not use the pager --no-tty Do not attempt to get a TTY for prompts -o, --output path Write output to path instead of stdout --override-data string Override data --override-data-file path Override data with file --persistent-state path Set persistent state file --progress bool|auto Display progress bars (default auto) -R, --refresh-externals always|auto|never[=always] Refresh external cache (default auto) -S, --source path Set source directory (default /home/banan/.local/share/chezmoi) --source-path Specify targets by source path --use-builtin-age bool|auto Use builtin age (default auto) --use-builtin-diff Use builtin diff --use-builtin-git bool|auto Use builtin git (default auto) -v, --verbose Make output more verbose --version version for chezmoi -W, --working-tree path Set working tree directory Use "chezmoi [command] --help" for more information about a command. なにやらいろいろ出力されました。 ...