Here’s the updated README.md with the new usage instructions (including the init command) and the installation options using curl and wget.
A robust CLI tool to manage, install, and synchronize your dotfiles across multiple systems. The tool supports various Linux distributions (Debian, Ubuntu, Fedora, Arch) and macOS, ensuring your development environment is consistent everywhere.
- Cross-Platform Compatibility: Works seamlessly on Linux (Debian, Ubuntu, Fedora, Arch) and macOS.
- Tool Installation: Automatically installs required tools like
git,zsh,neovim, etc., based on your configuration. - Dotfiles Synchronization:
- Clones your dotfiles repository.
- Manages symlinks using GNU Stow.
- Pulls and pushes updates to your dotfiles repository with meaningful commit messages.
- Repository Initialization:
- Quickly set up a new dotfiles repository with a basic structure and optional remote origin.
- Customizable:
- Configure tools, dotfiles repository, and installation preferences using
config.yml.
- Configure tools, dotfiles repository, and installation preferences using
- Extensible CLI: Built with Cobra, offering modular commands with flags.
Ensure the following are installed on your system:
- Git: For cloning your dotfiles repository.
- GNU Stow: For managing symlinks.
curl -L https://github.com/fwartner/dot/releases/latest/download/dotfiles-$(uname -s)-$(uname -m) -o /usr/local/bin/dot
chmod +x /usr/local/bin/dotwget https://github.com/fwartner/dot/releases/latest/download/dotfiles-$(uname -s)-$(uname -m) -O /usr/local/bin/dot
chmod +x /usr/local/bin/dotThe $(uname -s) and $(uname -m) dynamically resolve the operating system (Linux, Darwin) and architecture (x86_64, arm64), ensuring the correct binary is downloaded.
-
Clone the Repository
git clone https://github.com/fwartner/dot.git cd dot -
Initialize
go.modIf
go.moddoes not exist (e.g., for fresh forks), initialize it:go mod init github.com/fwartner/dot go mod tidy
-
Build the Binary
go build -o dotfiles
-
Install Locally
Place the binary in your
$PATHfor easier usage:mv dotfiles /usr/local/bin/dot
Create a config.yml file in one of the following locations:
./config.yml(current directory)~/.config/dotfiles/config.yml~/.dotfiles-config.yml
Example configuration:
# Repository URL for your dotfiles
dotfiles_repo: "https://github.com/fwartner/dotfiles-arch.git"
# Directory where the dotfiles will be cloned
dotfiles_dir: "~/dotfiles"
# List of tools to install
tools:
- git
- stow
- zsh
- neovim
- tmuxThe tool provides several commands to manage your dotfiles. Each command supports additional flags for customization.
dot init [--remote <repository-url>]- Sets up a new directory for managing dotfiles.
- Initializes a Git repository in the directory.
- Optionally adds a remote origin if
--remoteis provided.
Example:
dot init --remote https://github.com/username/dotfiles.gitdot install [--skip <tool1,tool2>]- Installs tools specified in
config.yml. - Skips installing tools listed with the
--skipflag.
Example:
dot install --skip zsh,neovimdot setup- Clones the dotfiles repository.
- Manages symlinks using GNU Stow.
dot pull- Pulls the latest changes from your dotfiles repository.
dot push- Pushes local changes to the dotfiles repository.
- Generates meaningful commit messages based on file changes, such as:
"Added: .zshrc, .vimrc; Modified: .bashrc; Deleted: .oldconfig"
- Go: Version 1.19 or later.
dot/
├── cmd/ # Command implementations
│ ├── init.go
│ ├── install.go
│ ├── setup.go
│ ├── pull.go
│ ├── push.go
├── utils/ # Reusable utilities
│ └── utils.go
├── main.go # Entry point
├── config.yml # Configuration file
go run main.go <command>Contributions are welcome! Feel free to fork the project and submit a pull request.
- Fork the repository.
- Create a new feature branch:
git checkout -b feature/new-feature
- Commit your changes:
git commit -m "Add new feature" - Push to the branch:
git push origin feature/new-feature
- Open a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.