Finished project
This commit is contained in:
parent
6849f1afae
commit
31179d64e5
12 changed files with 2207 additions and 3 deletions
84
README.md
Normal file
84
README.md
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
# dm
|
||||
|
||||
`dm` is a Rust CLI for switching between dotfile themes by symlinking a selected theme tree into the matching locations under `$HOME`.
|
||||
|
||||
## Theme Layout
|
||||
|
||||
Themes are discovered from subdirectories under `~/dotfiles/themes`.
|
||||
|
||||
```text
|
||||
~/dotfiles/themes/
|
||||
dracula/
|
||||
.config/
|
||||
alacritty/
|
||||
alacritty.toml
|
||||
nvim/
|
||||
init.lua
|
||||
.zshrc
|
||||
catppuccin/
|
||||
.config/
|
||||
alacritty/
|
||||
alacritty.toml
|
||||
```
|
||||
|
||||
The directory name is the theme name. The relative path inside the theme becomes the target path under `$HOME`.
|
||||
|
||||
Examples:
|
||||
- `~/dotfiles/themes/dracula/.config/nvim/init.lua` → `~/.config/nvim/init.lua`
|
||||
- `~/dotfiles/themes/dracula/.zshrc` → `~/.zshrc`
|
||||
|
||||
## Commands
|
||||
|
||||
```
|
||||
dm list
|
||||
```
|
||||
List all themes discovered under `~/dotfiles/themes`.
|
||||
|
||||
```
|
||||
dm status
|
||||
```
|
||||
Show the active theme, when it was applied, and the number of tracked symlinks.
|
||||
Also reports any broken links.
|
||||
|
||||
```
|
||||
dm apply <theme> [--dry-run] [--force] [--verbose]
|
||||
```
|
||||
Apply a theme by creating symlinks under `$HOME`.
|
||||
|
||||
- `--dry-run` — print what would happen without making changes.
|
||||
- `--force` — overwrite unmanaged files (they are backed up first).
|
||||
- `--verbose` — print each action as it executes.
|
||||
|
||||
On conflict (an unmanaged file would be overwritten), `apply` aborts with a clear
|
||||
error message. Use `--force` to allow it.
|
||||
|
||||
On any mid-apply failure, all completed changes are rolled back automatically.
|
||||
|
||||
```
|
||||
dm backup
|
||||
```
|
||||
Manually snapshot all currently managed files to
|
||||
`~/.config/theme-manager/backups/<timestamp>/`.
|
||||
|
||||
```
|
||||
dm rollback
|
||||
```
|
||||
Restore the backup set recorded in the last `apply` run, then clear state.
|
||||
Files that were newly created as symlinks (no prior content) are removed.
|
||||
|
||||
## State
|
||||
|
||||
State is persisted to `~/.config/theme-manager/state.json`.
|
||||
Backups live under `~/.config/theme-manager/backups/<timestamp>/`.
|
||||
|
||||
## Development
|
||||
|
||||
```
|
||||
cargo build
|
||||
cargo run -- --help
|
||||
cargo test
|
||||
cargo fmt
|
||||
cargo clippy --all-targets --all-features -- -D warnings
|
||||
```
|
||||
|
||||
Implementation order is tracked in [`TODO.md`](TODO.md).
|
||||
Loading…
Add table
Add a link
Reference in a new issue