CLI Reference¶
Complete reference for all tidydots commands, flags, and usage patterns.
Global flags¶
These flags are available on every command.
| Flag | Short | Description |
|---|---|---|
--dir <path> | -d | Override the configurations directory (ignores app config) |
--os <os> | -o | Override OS detection (linux or windows) |
--dry-run | -n | Show what would be done without making changes |
--verbose | -v | Enable verbose output |
tidydots¶
Run tidydots with no subcommand to launch the interactive TUI.
The TUI provides a visual interface for browsing applications, restoring configs, installing packages, and editing your tidydots.yaml. It requires a terminal -- if standard input is not a TTY, tidydots prints an error and exits.
Note
The TUI reads your configuration on startup. Make sure you have run tidydots init first, or pass --dir to point at your dotfiles repo.
tidydots init¶
Initialize the app configuration by setting the path to your dotfiles repository.
Arguments¶
| Argument | Required | Description |
|---|---|---|
path | Yes | Path to your dotfiles repository |
Behavior¶
- Resolves the path to an absolute directory (expands
~). - Verifies the directory exists.
- Writes the path to
~/.config/tidydots/config.yaml. - Warns if
tidydots.yamlis not found inside the directory.
You only need to run this once per machine. After initialization, all other commands will read the saved path automatically.
Examples¶
# Initialize with an absolute path
tidydots init ~/dotfiles
# Initialize with a relative path
tidydots init ./my-configs
# Output
App configuration saved to /home/youruser/.config/tidydots/config.yaml
Configurations directory: /home/youruser/dotfiles
tidydots restore¶
Restore configurations by creating symlinks from target locations to backup sources in your dotfiles repo.
Flags¶
| Flag | Short | Description |
|---|---|---|
--interactive | -i | Run in interactive TUI mode |
--no-merge | Disable merge mode; return an error if the target already exists | |
--force | When combined with --no-merge, delete existing files instead of erroring | |
--force-render | Force re-render of templates, skipping the 3-way merge |
Behavior¶
For each config entry that matches the current OS and when conditions:
- If the target does not exist and the backup does, a symlink is created.
- If the target exists but the backup does not, the target is adopted -- moved into the backup location and then symlinked back.
- Template files (
.tmplsuffix) are rendered through the template engine. Rendered output is written to.tmpl.renderedand symlinked to the target path with the.tmplsuffix stripped. - On re-render, a 3-way merge preserves any manual edits made to the rendered file.
Warning
The --force flag deletes existing target files. Always preview with -n first to verify what will be removed.
Examples¶
# Preview what would happen
tidydots restore -n
# Restore all configs
tidydots restore
# Restore in interactive mode
tidydots restore -i
# Restore with strict mode (error if targets already exist)
tidydots restore --no-merge
# Restore with strict mode, replacing existing files
tidydots restore --no-merge --force
# Force re-render all templates (discard manual edits to rendered files)
tidydots restore --force-render
# Restore with OS override
tidydots restore -o windows
tidydots backup¶
Copy configuration files from target locations back into the backup directory in your dotfiles repo.
Flags¶
| Flag | Short | Description |
|---|---|---|
--interactive | -i | Run in interactive TUI mode |
Behavior¶
For each config entry that matches the current OS and when conditions, copies the files from the target location into the backup path. This is the inverse of restore -- it captures the current state of your live configs into the repo.
Examples¶
# Preview what would be backed up
tidydots backup -n
# Backup all configs
tidydots backup
# Backup in interactive mode
tidydots backup -i
tidydots list¶
Display all configured paths and their symlink targets for the current OS.
Behavior¶
Lists every config entry that matches the current OS and when conditions, showing the backup path and the target path. This is useful for verifying your configuration and checking for broken symlinks.
Examples¶
# List all configured paths
tidydots list
# List paths for a different OS
tidydots list -o windows
# List paths from a specific directory
tidydots list -d ~/dotfiles
tidydots install¶
Install packages using the configured package managers.
Arguments¶
| Argument | Required | Description |
|---|---|---|
package-names | No | Specific package names to install. If omitted, all matching packages are installed. |
Flags¶
| Flag | Short | Description |
|---|---|---|
--interactive | -i | Run in interactive TUI mode |
Behavior¶
- Loads the configuration and filters packages by OS and
whenconditions. - Detects available package managers on the system.
- Selects the best manager for each package based on
default_managerandmanager_prioritysettings. - Installs each package, reporting success or failure.
If specific package names are provided as arguments, only those packages are installed. Otherwise, all matching packages are installed.
Examples¶
# Preview all package installations
tidydots install -n
# Install all packages
tidydots install
# Install specific packages
tidydots install neovim zsh
# Install in interactive mode
tidydots install -i
# Install with verbose output
tidydots install -v
tidydots list-packages¶
Display all configured packages with their availability and installation method.
Behavior¶
Lists every package that matches the current OS and when conditions. For each package, shows:
- An availability indicator (
✓if installable,✗if not) - The package name
- The installation method (which package manager will be used, or
unavailable) - The package description, if configured
Examples¶
# List all packages
tidydots list-packages
# Check package availability for a different OS
tidydots list-packages -o windows
Sample output:
Available package managers: [pacman yay]
✓ neovim (pacman)
Neovim text editor
✓ zsh (pacman)
✓ nvim-plugins (git)
✗ powershell (unavailable)
tidydots preview¶
Watch template files for changes and render them in real time.
Arguments¶
| Argument | Required | Description |
|---|---|---|
path | Yes | A single .tmpl file or a directory containing .tmpl files |
Behavior¶
- Discovers all
.tmplfiles at the given path (recursively if a directory). - Performs an initial render of every discovered template.
- Watches for file saves using filesystem notifications.
- On each save, re-renders the changed template and writes the output to the sibling
.tmpl.renderedfile. - On a syntax error, prints the error and keeps the last good
.tmpl.renderedintact. - Runs until interrupted with
Ctrl+C.
The command uses the current platform context (OS, Hostname, User, etc.) for rendering, and inherits the global --dir, --os, and --verbose flags.
Examples¶
# Preview a single template file
tidydots preview ./alacritty/alacritty.toml.tmpl
# Preview all templates in a directory
tidydots preview ./alacritty
# Preview with OS override
tidydots preview ./zsh -o windows
# Preview with verbose logging
tidydots preview ./alacritty -v
Sample terminal output:
Watching 3 template(s)...
config.zshrc.tmpl
config.gitconfig.tmpl
config.alacritty.tmpl
✓ config.zshrc.tmpl rendered (14:32:05)
✗ config.zshrc.tmpl error: template: config.zshrc.tmpl:12: unexpected "}" (14:32:08)
✓ config.zshrc.tmpl rendered (14:32:11)
Tip
Open the .tmpl source and its .tmpl.rendered output side by side in your editor for a live preview workflow. Every time you save the template, the rendered file updates automatically.
NDJSON Protocol¶
When watching a single template, tidydots preview communicates with editor plugins via NDJSON (newline-delimited JSON) on stdin/stdout.
Stdout (CLI → editor): After each render, the CLI emits a source map response:
{"source_map":{"1":"1","2":"3"},"reverse_map":{"1":"1","3":"2"},"line_types":{"1":"text","2":"directive","3":"expression"},"file":"config.toml.tmpl"}
| Field | Description |
|---|---|
source_map | Template line → rendered line (forward mapping) |
reverse_map | Rendered line → template line (reverse mapping) |
line_types | Template line → type (text, expression, or directive) |
file | Path of the template file |
Stdin (editor → CLI): The editor can send content updates or structural edits:
{"content":"updated template content here"}
{"rendered_edit":{"inserts":[{"after_rendered_line":3,"text":"new line"}],"deletes":[5]}}
Stdout (CLI → editor): After a structural edit, the CLI responds with a template update:
tidydots completion¶
Generate shell autocompletion scripts for tidydots.
Supported shells¶
| Shell | Command |
|---|---|
| bash | tidydots completion bash |
| zsh | tidydots completion zsh |
| fish | tidydots completion fish |
| powershell | tidydots completion powershell |
Examples¶
# Add to your ~/.bashrc
source <(tidydots completion bash)
# Add to your ~/.zshrc
source <(tidydots completion zsh)
# Add to your fish config
tidydots completion fish | source
# Add to your PowerShell profile
tidydots completion powershell | Out-String | Invoke-Expression
Tip
Run tidydots completion <shell> --help for detailed instructions on setting up autocompletion for your specific shell.
Examples¶
First-time setup on a new machine¶
# 1. Clone your dotfiles repo
git clone https://github.com/youruser/dotfiles.git ~/dotfiles
# 2. Initialize tidydots
tidydots init ~/dotfiles
# 3. Preview what will happen
tidydots restore -n
# 4. Restore all configs
tidydots restore
# 5. Install all packages
tidydots install
Day-to-day usage¶
# Launch the interactive TUI to browse and manage everything
tidydots
# After editing configs on disk, back them up into the repo
tidydots backup
# Check what is currently configured
tidydots list
tidydots list-packages
Working with templates¶
# Live preview a template while editing
tidydots preview ./alacritty/alacritty.toml.tmpl
# Live preview all templates in a directory
tidydots preview ./alacritty
# Preview template rendering (one-shot, no watch)
tidydots restore -n -v
# Force re-render templates after changing a .tmpl file
tidydots restore --force-render
# Re-render with dry-run to verify
tidydots restore --force-render -n