### Installs Section: Examples Source: https://github.com/volllly/rotz/blob/main/_autodocs/dotfiles-format.md Provides example install configurations for Rust, Neovim, and Node Version Manager (NVM). ```yaml # ~/.dotfiles/rust/dot.yaml installs: cmd: > curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y # ~/.dotfiles/nvim/dot.yaml installs: cmd: "cargo install nvim" depends: - base - rust # ~/.dotfiles/node/dot.yaml installs: cmd: "nvm install 20" depends: - base ``` -------------------------------- ### Standard Installation Example Source: https://github.com/volllly/rotz/blob/main/_autodocs/features.md Install Rotz with its default features, which include all file formats and HTTP template support. ```bash # Install with default features cargo install rotz ``` ```bash # Same as: cargo install rotz --features all-formats,handlebars_misc_helpers/http_attohttpc ``` -------------------------------- ### Simple Multi-File and Install Configuration Source: https://github.com/volllly/rotz/blob/main/_autodocs/dotfiles-format.md Example of a dotfile managing multiple file links and an installation command with dependencies. ```yaml # ~/.dotfiles/nvim/dot.yaml links: init.lua: ~/.config/nvim/init.lua lua/config.lua: ~/.config/nvim/lua/config.lua installs: cmd: "brew install neovim" depends: - base depends: - base ``` -------------------------------- ### Typical Setup Workflow: Clone, Link, Install Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/commands.md A common workflow for setting up dotfiles: first cloning an existing repository, then linking configuration files, and finally installing applications. ```bash # 1. Clone existing dotfiles repository rotz clone https://github.com/user/dotfiles.git # 2. Link configuration files rotz link # 3. Install applications rotz install ``` -------------------------------- ### Custom Installation Examples Source: https://github.com/volllly/rotz/blob/main/_autodocs/features.md Examples of custom Rotz installations for specific use cases like YAML repositories, TOML configurations, or profiling. ```bash # For YAML dotfile repositories cargo install rotz --no-default-features --features yaml ``` ```bash # For TOML configuration cargo install rotz --no-default-features --features toml ``` ```bash # With profiling for analysis cargo build --release --features all-formats,profiling ``` -------------------------------- ### Development Setup Example Source: https://github.com/volllly/rotz/blob/main/_autodocs/features.md Build Rotz with all features enabled for development, including all file formats, HTTP support, and profiling. ```bash cargo build --all-features ``` -------------------------------- ### Basic Dot Configuration Example Source: https://github.com/volllly/rotz/blob/main/_autodocs/QUICK-REFERENCE.md Example of a `dot.yaml` file for a specific dot (e.g., Neovim). Defines links, installation commands, and dependencies. ```yaml links: init.lua: ~/.config/nvim/init.lua lua/config.lua: ~/.config/nvim/lua/config.lua installs: cmd: "brew install neovim" depends: - base depends: - base ``` -------------------------------- ### Complex Platform-Specific Configuration with Templates Source: https://github.com/volllly/rotz/blob/main/_autodocs/dotfiles-format.md A comprehensive dotfile example demonstrating global settings, platform-specific links and installs, and templating. ```yaml # ~/.dotfiles/shell/dot.yaml global: links: rc: ~/.shellrc installs: depends: - base windows: links: powershell_profile: ~/Documents/PowerShell/profile.ps1 linux: installs: cmd: "apt-get install -y bash-completion" darwin: installs: cmd: "brew install bash bash-completion" ``` -------------------------------- ### Complete Dotfile Example (YAML) Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/dot.md A comprehensive example of a dotfile's YAML configuration, including links, installs, and dependencies. ```yaml # ~/.dotfiles/nvim/dot.yaml links: init.lua: - ~/.config/nvim/init.lua lua/config.lua: ~/.config/nvim/lua/config.lua installs: cmd: "cargo install nvim-native-lua" depends: - base depends: - base ``` -------------------------------- ### Depends Section: Example with Installs Source: https://github.com/volllly/rotz/blob/main/_autodocs/dotfiles-format.md Illustrates a dot configuration that specifies both installation dependencies and linking dependencies. ```yaml # ~/.dotfiles/nvim/dot.yaml links: init.lua: ~/.config/nvim/init.lua installs: cmd: "brew install neovim" depends: - base # base must be installed before nvim depends: - base # base must be linked before nvim ``` -------------------------------- ### Dot File Installs Section Example (YAML) Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/dot.md Shows the 'installs' section in a dotfile's YAML configuration, specifying the command to execute and its dependencies. ```yaml installs: cmd: "cargo install ripgrep" depends: - rust - base ``` -------------------------------- ### InstallRaw Struct Initialization Example Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/cli.md Demonstrates the initialization of an InstallRaw struct, specifying dotfiles to install and enabling the skip_dependencies flag. ```rust // rotz install /zsh -d let install = InstallRaw { dots: Dots { dots: vec!["/zsh".to_string()] }, skip_dependencies: true, continue_on_error: false, skip_installation_dependencies: false, skip_all_dependencies: false, }; ``` -------------------------------- ### Example: Install Command Error Handling Source: https://github.com/volllly/rotz/blob/main/_autodocs/errors.md Illustrates common error scenarios during `rotz install`, such as cyclic dependencies, missing dependencies, and failed install commands, along with their fixes. ```bash # Cyclic dependency $ rotz install Error: /nvim has a cyclic dependency Depends on itself through /nvim # Fix: Remove circular reference in ~/.dotfiles/nvim/dot.yaml # Dependency not found $ rotz install Error: Dependency /nvim of /base was not found # Fix: Create /nvim dot or update base dependencies # Install command failed $ rotz install Error: Install command for /rust did not run successfully # Fix: Check install command, test it manually ``` -------------------------------- ### Defaults Files: Example Source: https://github.com/volllly/rotz/blob/main/_autodocs/dotfiles-format.md Shows a defaults file that sets default links and installation dependencies inherited by child dots. ```yaml # ~/.dotfiles/shell/defaults.yaml links: rc: ~/.shellrc installs: depends: - base ``` -------------------------------- ### Creating an Installs Instance Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/dot.md Shows how to create an Installs struct with a specific command and its dependencies. ```rust use rotz::dot::Installs; let installs = Installs { cmd: "cargo install ripgrep".to_string(), depends: { let mut set = std::collections::HashSet::new(); set.insert("rust".to_string()); set } }; ``` -------------------------------- ### Cross-Platform Configuration Example Source: https://github.com/volllly/rotz/blob/main/_autodocs/configuration.md Illustrates a cross-platform setup where different shell commands and link types are defined for global, Windows, macOS, and Linux environments. ```yaml # ~/.dotfiles/config.yaml global: shell_command: "bash -c {{ quote "" cmd }}" windows: shell_command: "powershell -NoProfile -C {{ quote "" cmd }}" link_type: hard darwin: shell_command: "zsh -c {{ quote "" cmd }}" linux: variables: distro_specific: true ``` -------------------------------- ### Multi-User Setup Configuration Source: https://github.com/volllly/rotz/blob/main/_autodocs/configuration.md Configuration example for a multi-user setup, defining a base dotfiles path and a user_config variable. Allows for different user configurations via environment variables. ```yaml # ~/.config/rotz/config.yaml dotfiles: ~/.dotfiles variables: user_config: ~/.config # Different settings per user via environment: # ROTZ_VARIABLES_USER_CONFIG=~/custom-config rotz link ``` -------------------------------- ### Start Local Development Server Source: https://github.com/volllly/rotz/blob/main/docs/README.md Starts a local development server for live preview. Changes are reflected without restarting. ```bash yarn start ``` -------------------------------- ### Install Rotz using Installer Script (Windows) Source: https://github.com/volllly/rotz/blob/main/docs/docs/getting-started.md Install Rotz on Windows using an Invoke-RestMethod (irm) based installer script. This is a quick way to get Rotz set up. ```pwsh irm volllly.github.io/rotz/install.sh | iex ``` -------------------------------- ### Install all applications Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/commands.md Run the `install` command without arguments to install all applications defined in your dot configurations. Rotz handles dependency resolution automatically. ```bash rotz install ``` -------------------------------- ### Link and Install Dotfiles Source: https://github.com/volllly/rotz/blob/main/_autodocs/README.md Executes the linking and installation commands defined in your dotfiles. This applies your configurations and installs necessary software. ```bash rotz link rotz install ``` -------------------------------- ### Install specific applications Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/commands.md Use glob patterns with the `install` command to install applications for specific categories, such as language environments. ```bash rotz install /*/lang ``` -------------------------------- ### Installs Section: With Dependencies Source: https://github.com/volllly/rotz/blob/main/_autodocs/dotfiles-format.md Specifies an installation command that requires other dots to be installed first. ```yaml installs: cmd: "brew install neovim" depends: - base - rust ``` -------------------------------- ### Install Specific Subset Source: https://github.com/volllly/rotz/blob/main/_autodocs/QUICK-REFERENCE.md Install a specific subset of tools or configurations using glob patterns with 'rotz install'. For example, install all language tools or just shell configuration. ```bash rotz install /lang/** # All language tools ``` ```bash rotz install /shell # Shell configuration ``` -------------------------------- ### Installs Section: Basic Install Source: https://github.com/volllly/rotz/blob/main/_autodocs/dotfiles-format.md Defines a simple command to install an application using a package manager. ```yaml installs: cmd: "brew install neovim" ``` -------------------------------- ### Rotz Command Matching Example Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/cli.md Illustrates how to use a match statement to handle different Rotz subcommands like Clone, Link, and Install, extracting relevant arguments for each. ```rust match cli.command { Command::Clone { repo } => { println!("Clone {} to ~/.dotfiles", repo) } Command::Link { link } => { println!("Link dotfiles with patterns: {:?}", link.dots.dots) } Command::Install { install } => { println!("Install with force: {}", install.force) } _ => {} } ``` -------------------------------- ### Links Section: Git and Zsh Examples Source: https://github.com/volllly/rotz/blob/main/_autodocs/dotfiles-format.md Provides example configurations for Git and Zsh dots, defining multiple symlinks for each. ```yaml # ~/.dotfiles/git/dot.yaml links: .gitconfig: ~/.gitconfig .gitignore_global: ~/.config/git/ignore attributes: ~/.config/git/attributes # ~/.dotfiles/zsh/dot.yaml links: .zshrc: ~/.zshrc .zsh_aliases: ~/.config/zsh/aliases completions: ~/.config/zsh/completions ``` -------------------------------- ### Example: defaults.{{ format }} Source: https://github.com/volllly/rotz/blob/main/docs/docs/configuration/defaults.mdx This snippet shows an example of a default configuration file using a tabbed code block. It demonstrates the use of template strings like '{{ name }}' for dynamic substitution of the application name. ```yaml installs: cmd: "scoop install {{ name }}" depends: - "scoop" - "extras" ``` -------------------------------- ### Conditional Link Configuration Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/templating.md A complete dotfile example demonstrating conditional logic using `env.EDITOR` to configure editor-specific links. It also shows basic installation commands and dependencies. ```yaml # ~/.dotfiles/dev-tools/dot.yaml links: {{#if env.EDITOR}} editor_config: "{{dirs.user.config}}/{{env.EDITOR}}/init.lua" {{/if}} gitconfig: ~/.gitconfig installs: cmd: "cargo install ripgrep fzf exa" depends: - base depends: - base ``` -------------------------------- ### Installs Section: Skipping Dependencies CLI Source: https://github.com/volllly/rotz/blob/main/_autodocs/dotfiles-format.md Shows command-line options to skip dependency installation during the install process. ```bash # Don't install dependencies for this dot rotz install /nvim --skip-dependencies # Don't install installation dependencies rotz install /nvim --skip-installation-dependencies # Don't install any dependencies rotz install /nvim --skip-all-dependencies ``` -------------------------------- ### Development Setup and Build Source: https://github.com/volllly/rotz/blob/main/_autodocs/README.md Provides instructions for cloning the Rotz repository, building the project, and running tests. This is essential for contributing to the development of Rotz. ```bash git clone https://github.com/volllly/rotz.git cd rotz cargo build cargo test ``` -------------------------------- ### Continue installation on error Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/commands.md The `--continue-on-error` flag allows the installation process to proceed even if errors occur for certain applications. This ensures that other installations are attempted. ```bash rotz install --continue-on-error ``` -------------------------------- ### Create Config File Example Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/config.md Example of using the create_config_file function to generate a YAML configuration file with a specified dotfiles path. ```rust use std::path::Path; use rotz::config::create_config_file; create_config_file( Some(Path::new("/home/user/.dotfiles")), Path::new("/home/user/.config/rotz/config.yaml") )?; ``` -------------------------------- ### Installs Section: Dependency Patterns Source: https://github.com/volllly/rotz/blob/main/_autodocs/dotfiles-format.md Demonstrates the use of glob patterns for specifying dependencies in the installs section. ```yaml installs: cmd: "npm install -g eslint prettier" depends: - lang/node - lang/* ``` -------------------------------- ### Platform-Specific Configuration Example Source: https://github.com/volllly/rotz/blob/main/_autodocs/configuration.md Demonstrates how to set different configurations for global, Windows, Linux, and macOS environments within a single config file. ```yaml global: shell_command: "bash -c {{ quote "" cmd }}" variables: theme: light windows: link_type: hard variables: theme: dark linux: link_type: symbolic darwin: shell_command: "zsh -c {{ quote "" cmd }}" ``` -------------------------------- ### Dry-run install command Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/commands.md Use the `--dry-run` option with the `install` command to see which applications would be installed and in what order, without actually performing any installations. This helps in planning and verification. ```bash rotz install --dry-run ``` -------------------------------- ### Repository Configuration File Example (YAML) Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/config.md Example of a repository-specific configuration file in YAML format. This file can override global settings and provide OS-specific configurations. It must use the top-level `global` key. ```yaml # ~/.dotfiles/config.yaml global: variables: theme: light windows: link_type: hard linux: shell_command: "bash -c {{ quote \"\" cmd }}" ``` -------------------------------- ### CLI Argument Priority Example Source: https://github.com/volllly/rotz/blob/main/_autodocs/configuration.md Demonstrates the priority order of configuration sources, with CLI arguments having the highest precedence. Shows examples of using CLI, environment variables, and config files. ```bash # All of these would use different dotfiles paths: # 1. CLI argument (highest priority) rotz -d /cli/path link # 2. Environment variable ROTZ_DOTFILES=/env/path rotz link # 3. User config # Assumes ~/.config/rotz/config.yaml has: dotfiles: /user/path rotz link # 4. Default (lowest priority) # No config, no env, no CLI = ~/.dotfiles rotz link ``` -------------------------------- ### Install Rotz using Installer Script Source: https://github.com/volllly/rotz/blob/main/README.md Download and execute the Rotz installer script for Linux and macOS. This is a convenient way to install Rotz. ```sh curl -fsSL volllly.github.io/rotz/install.sh | sh ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/volllly/rotz/blob/main/docs/README.md Installs project dependencies using Yarn. This is the first step before running any other commands. ```bash yarn ``` -------------------------------- ### Configuration Merging Example Source: https://github.com/volllly/rotz/blob/main/_autodocs/configuration.md Demonstrates how Rotz merges configuration from multiple sources, starting with defaults and layering user config, repository config, environment variables, and CLI arguments. Shows variable merging specifically. ```yaml # ~/.config/rotz/config.yaml (user config) variables: editor: nvim shell: zsh ``` -------------------------------- ### Cross-Platform Dotfile Configuration Source: https://github.com/volllly/rotz/blob/main/_autodocs/README.md Configures platform-specific installations using OS selectors (windows, linux, darwin). This allows for tailored setups on different operating systems. ```yaml global: links: common: ~/.config/app windows: installs: cmd: "choco install app" linux: installs: cmd: "apt install app" darwin: installs: cmd: "brew install app" ``` -------------------------------- ### Minimal Single File Configuration Source: https://github.com/volllly/rotz/blob/main/_autodocs/dotfiles-format.md A basic dotfile example linking a single configuration file. ```yaml # ~/.dotfiles/git/dot.yaml links: .gitconfig: ~/.gitconfig ``` -------------------------------- ### Install Rotz via Scoop Source: https://github.com/volllly/rotz/blob/main/README.md Install Rotz on Windows using Scoop. First, add the Rotz scoop bucket, then install the package. ```pwsh scoop bucket add volllly https://github.com/volllly/scoop-bucket scoop install volllly/rotz ``` -------------------------------- ### Custom Dotfiles Location Workflow: Initialize and Use Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/commands.md Demonstrates initializing a dotfiles repository in a custom location and then using that custom location for subsequent commands like 'link' and 'install'. ```bash # 1. Initialize custom location rotz -d ~/my-dotfiles init # 2. Use custom location for all commands rotz -d ~/my-dotfiles link rotz -d ~/my-dotfiles install ``` -------------------------------- ### Dry-run Initialization Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/commands.md Simulates the initialization of a dotfiles repository without creating files or directories. Useful for previewing setup. ```bash rotz init --dry-run https://github.com/user/dotfiles.git ``` -------------------------------- ### Installs Struct Definition Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/dot.md Defines the structure for installation commands, including the command string and a set of dependencies. ```rust pub struct Installs { pub cmd: String, pub depends: HashSet, } ``` -------------------------------- ### YAML Configuration Example Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/config.md Example of a Rotz configuration file in YAML format, specifying dotfiles path, link type, shell command, and variables. ```yaml # ~/.config/rotz/config.yaml dotfiles: /home/user/.dotfiles link_type: symbolic shell_command: "bash -c {{ quote \"\" cmd }}" variables: username: john editor: nvim ``` -------------------------------- ### Install Rotz with All Formats and Profiling Features Source: https://github.com/volllly/rotz/blob/main/_autodocs/features.md Install Rotz with all supported formats and the profiling feature enabled. This provides maximum flexibility and debugging capabilities. ```bash cargo install rotz --features all-formats,profiling ``` -------------------------------- ### User Configuration Example Source: https://github.com/volllly/rotz/blob/main/_autodocs/QUICK-REFERENCE.md Example of the user-level Rotz configuration file (`~/.config/rotz/config.yaml`). Defines dotfiles path, link type, and custom variables. ```yaml dotfiles: ~/.dotfiles link_type: symbolic shell_command: "bash -c {{ quote \"\" cmd }}" variables: editor: nvim shell: zsh ``` -------------------------------- ### User Configuration File Example (YAML) Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/config.md Example of a user-specific configuration file in YAML format. This file is typically located in `~/.config/rotz/config.yaml` and defines base settings like dotfiles path, link type, and variables. ```yaml # ~/.config/rotz/config.yaml dotfiles: /home/user/.dotfiles link_type: symbolic variables: theme: dark ``` -------------------------------- ### Install Rotz using Scoop Source: https://github.com/volllly/rotz/blob/main/_autodocs/README.md Install Rotz on Windows systems using the Scoop package manager. This is the recommended installation method for Windows users. ```bash scoop install volllly/rotz ``` -------------------------------- ### TOML Configuration Example Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/config.md Example of a Rotz configuration file in TOML format, specifying dotfiles path, link type, shell command, and variables. ```toml # ~/.config/rotz/config.toml dotfiles = "/home/user/.dotfiles" link_type = "symbolic" shell_command = "bash -c {{ quote \"\" cmd }}" [variables] username = "john" editor = "nvim" ``` -------------------------------- ### InstallRaw Struct for Install Command Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/cli.md Defines the arguments structure for the 'install' command, including glob patterns for dotfiles and flags to control dependency installation and error handling. ```rust pub struct InstallRaw { pub dots: Dots, pub continue_on_error: bool, pub skip_dependencies: bool, pub skip_installation_dependencies: bool, pub skip_all_dependencies: bool, } ``` -------------------------------- ### Install Scoop using a Direct Command Source: https://github.com/volllly/rotz/blob/main/docs/docs/configuration/dot.yaml.mdx Provides a direct command to download and install Scoop, bypassing explicit dependencies. ```yaml installs: iex (new-object net.webclient).downloadstring('https://get.scoop.sh') ``` -------------------------------- ### Example: Writing State Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/state.md Shows how to update the state with new linked files and then persist these changes to disk. Requires reading the state first. ```rust let mut state = State::read()?; state.linked = new_linked; state.write()?; ``` -------------------------------- ### Repository Configuration Example Source: https://github.com/volllly/rotz/blob/main/_autodocs/QUICK-REFERENCE.md Example of a repository-specific Rotz configuration file (`~/.dotfiles/config.yaml`). Overrides global settings for specific environments like 'windows' or 'linux'. ```yaml global: variables: theme: light windows: link_type: hard linux: link_type: symbolic darwin: link_type: symbolic ``` -------------------------------- ### LinkRaw Struct Initialization Example Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/cli.md Provides an example of how to manually construct a LinkRaw struct, setting the dots to a specific glob pattern and enabling the force flag. ```rust // rotz link /zsh --force let link = LinkRaw { dots: Dots { dots: vec!["/zsh".to_string()] }, force: true, link_type: None, }; ``` -------------------------------- ### Install Rotz via Homebrew Source: https://github.com/volllly/rotz/blob/main/README.md Install Rotz on Linux and macOS using Homebrew. Ensure Homebrew is installed first. ```sh brew install volllly/tap/rotz ``` -------------------------------- ### Install Node.js with Scoop Dependencies Source: https://github.com/volllly/rotz/blob/main/docs/docs/configuration/dot.yaml.mdx Defines the command to install Node.js using Scoop and lists 'scoop' as a dependency. ```yaml installs: cmd: scoop install nodejs depends: - scoop ``` -------------------------------- ### Dot File Links Section Example (YAML) Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/dot.md Illustrates the 'links' section in a dotfile's YAML configuration, showing how to map source paths to one or more target paths. ```yaml links: source/path: - ~/target/path1 - ~/target/path2 # Or shorthand for single target: links: source/path: ~/target/path ``` -------------------------------- ### Default Dotfiles Configuration Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/dot.md Example of a default dotfiles configuration file specifying links and dependencies. ```yaml links: files: ~/.config/appname installs: depends: - base ``` -------------------------------- ### Install skipping dependencies Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/commands.md Use the `--skip-dependencies` flag to install applications without their associated dependencies. This is useful when dependencies are already met or not required. ```bash rotz install --skip-dependencies ``` -------------------------------- ### Advanced OS Specific Installation Configuration Source: https://github.com/volllly/rotz/blob/main/docs/docs/configuration/os-specific-configuration.mdx Configure package installations based on specific Linux distributions. Ubuntu uses 'apt', while Arch Linux uses 'pacman'. ```toml installs: sudo apt install -y {{ name }} ``` ```toml installs: sudo pacman -S --noconfirm {{ name }} ``` -------------------------------- ### Install specific dot skipping all dependencies Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/commands.md Install a particular dot and its associated applications while completely ignoring all dependency requirements using the `--skip-all-dependencies` flag. ```bash rotz install /nvim --skip-all-dependencies ``` -------------------------------- ### Install Rotz using PowerShell Script Source: https://github.com/volllly/rotz/blob/main/README.md Download and execute the Rotz installer script for Windows using PowerShell. This method is for Windows users. ```pwsh irm volllly.github.io/rotz/install.ps1 | iex ``` -------------------------------- ### Dot File Dependencies Section Example (YAML) Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/dot.md Demonstrates the 'depends' section in a dotfile's YAML configuration, listing other dots that must be processed first. ```yaml depends: - other-dot - parent/** ``` -------------------------------- ### Install Rotz with YAML and Profiling Features Source: https://github.com/volllly/rotz/blob/main/_autodocs/features.md Install Rotz with both YAML and profiling features enabled. This combination is useful for debugging and performance analysis. ```bash cargo install rotz --features yaml,profiling ``` -------------------------------- ### Show Help Message for Another Specific Command Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/commands.md Displays the help message for a specific command, such as 'install'. ```bash rotz install --help ``` -------------------------------- ### OS Specific Defaults Configuration Source: https://github.com/volllly/rotz/blob/main/docs/docs/configuration/os-specific-configuration.mdx Configure default installations differently for Windows and macOS. Windows uses 'scoop', while macOS uses 'brew'. ```toml installs: cmd: "scoop install {{ name }}" depends: - "scoop" - "extras" ``` ```toml installs: cmd: "brew install {{ name }}" depends: - "brew" ``` -------------------------------- ### Links Section: Path Mapping Examples Source: https://github.com/volllly/rotz/blob/main/_autodocs/dotfiles-format.md Illustrates how source paths within the dot directory map to filesystem targets, including nested files. ```yaml links: init.lua: ~/.config/nvim/init.lua # File at nvim/init.lua lua/config.lua: ~/.config/nvim/lua/config.lua # File at nvim/lua/config.lua .zshrc: ~/.zshrc # File at zsh/.zshrc ``` -------------------------------- ### Install Rotz with Default Dependencies Source: https://github.com/volllly/rotz/blob/main/_autodocs/features.md Install Rotz using the versions specified in the `Cargo.lock` file. This ensures reproducible builds with tested dependency versions. ```bash cargo install rotz # Uses versions from Cargo.lock ``` -------------------------------- ### Conditional Package Installation Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/templating.md An example of a Python package installation command that uses a conditional (`config.variables.dev_mode`) to switch between installing a local development version or a specific package name. ```yaml # ~/.dotfiles/python/dot.yaml installs: cmd: > pip install --user --upgrade --quiet {{#if config.variables.dev_mode}} -e . {{else}} mypackage {{/if}} ``` -------------------------------- ### LinkType Parsing Example Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/config.md Demonstrates how to create a LinkType variant from a string or by direct instantiation. ```rust use rotz::config::LinkType; use std::str::FromStr; let link_type = LinkType::from_str("symbolic")?; // or let link_type = LinkType::Symbolic; ``` -------------------------------- ### Complete Rotz Configuration Example Source: https://github.com/volllly/rotz/blob/main/_autodocs/configuration.md A comprehensive configuration file including dotfiles path, link type, shell command, and various variables like editor, shell, theme, and language. ```yaml # ~/.config/rotz/config.yaml dotfiles: ~/.dotfiles link_type: symbolic shell_command: "bash -c {{ quote "" cmd }}" variables: editor: nvim shell: zsh theme: dark language: en_US ``` -------------------------------- ### Install with Specific Formats Only Source: https://github.com/volllly/rotz/blob/main/_autodocs/features.md Install Rotz with a custom selection of file formats, disabling default features. Useful for minimizing binary size. ```bash # YAML and TOML only (no JSON support) cargo install rotz --no-default-features --features yaml,toml ``` ```bash # Only TOML cargo install rotz --no-default-features --features toml ``` ```bash # All formats (same as default) cargo install rotz --features all-formats ``` -------------------------------- ### Enable YAML Configuration Files Source: https://github.com/volllly/rotz/blob/main/_autodocs/features.md Install Rotz with support for YAML configuration files. Uses `serde_yaml` and Figment's YAML provider. Enabled by default. ```bash cargo install rotz --features yaml ``` -------------------------------- ### Template Variables Example Source: https://github.com/volllly/rotz/blob/main/_autodocs/QUICK-REFERENCE.md Example of template variables available within Rotz configurations, including system information, directories, environment variables, OS, and custom variables. ```yaml # System information whoami: username: john realname: John Doe hostname: myhost platform: linux distro: ubuntu arch: x86_64 # Directories dirs: user: home: /home/john config: /home/john/.config download: /home/john/Downloads base: cache: /home/john/.cache config: /home/john/.config # Environment env: HOME: /home/john EDITOR: nvim # ... all environment variables # OS os: linux # global, windows, linux, darwin # Custom config: variables: editor: nvim theme: dark ``` -------------------------------- ### Nested Dots Configuration Source: https://github.com/volllly/rotz/blob/main/_autodocs/dotfiles-format.md Example showing how dotfiles can inherit dependencies from parent dots, indicated by comments. ```yaml # ~/.dotfiles/lang/defaults.yaml installs: depends: - base # ~/.dotfiles/lang/rust/dot.yaml # Inherits: installs.depends = [base] installs: cmd: "rustup-init" # ~/.dotfiles/lang/node/dot.yaml # Inherits: installs.depends = [base] installs: cmd: "nvm install 20" ``` -------------------------------- ### Minimal Rotz Configuration Source: https://github.com/volllly/rotz/blob/main/_autodocs/configuration.md A basic configuration file example specifying only the dotfiles directory. This is the simplest valid configuration. ```yaml # ~/.config/rotz/config.yaml dotfiles: ~/.dotfiles ``` -------------------------------- ### Example: Reading State Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/state.md Demonstrates how to read the persisted state and access the number of linked files. Ensure the 'rotz::state::State' is in scope. ```rust use rotz::state::State; let state = State::read()?; println!("Linked files: {}", state.linked.0.len()); ``` -------------------------------- ### Enable TOML Configuration Files Source: https://github.com/volllly/rotz/blob/main/_autodocs/features.md Install Rotz with support for TOML configuration files. Uses `serde_toml` and Figment's TOML provider. Enabled by default. ```bash cargo install rotz --features toml ``` -------------------------------- ### Development Workflow: Dry-run and Apply Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/commands.md A development workflow that emphasizes previewing changes with '--dry-run' before applying them with 'link' and 'install' commands. ```bash # Check what would change rotz link --dry-run # Verify installation order rotz install --dry-run # Actually apply changes rotz link rotz install ``` -------------------------------- ### Example: File Already Exists Error Handling Source: https://github.com/volllly/rotz/blob/main/_autodocs/errors.md Demonstrates handling the 'file already exists' error during `rotz link` and how to use the `--force` flag to resolve it. ```bash # File already exists $ rotz link Error: The file "/home/user/.config/nvim" already exists Try using the --force flag # Fix: $ rotz link --force # On Windows, need admin $ rotz link Error: Could not create link from "..." to "..." # Solution: Run PowerShell as Administrator ``` -------------------------------- ### Enable Performance Profiling with Tracy Source: https://github.com/volllly/rotz/blob/main/_autodocs/features.md Install Rotz with performance profiling capabilities using the Tracy profiler. Enables `tracing` and `tracing-tracy` for detailed instrumentation. ```bash cargo install rotz --features profiling ``` ```bash # Build with profiling car go build --features profiling ``` ```bash # Capture profile ./target/debug/rotz link ``` -------------------------------- ### Development vs Production Configuration Source: https://github.com/volllly/rotz/blob/main/_autodocs/configuration.md An example configuration differentiating between development and production environments using a 'environment' variable. This allows for distinct settings based on the deployment target. ```yaml # ~/.config/rotz/config.yaml dotfiles: ~/.dotfiles variables: environment: development # For production deployments: # ROTZ_VARIABLES_ENVIRONMENT=production rotz install ``` -------------------------------- ### Rotz CLI Parsing Example Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/cli.md Demonstrates how to parse command-line arguments into the Cli struct and match on the command variant to perform actions like linking or cloning dotfiles. ```rust use rotz::cli::Cli; use clap::Parser; let cli = Cli::parse(); match cli.command { cli::Command::Link { link } => { println!("Linking dotfiles..."); } cli::Command::Clone { repo } => { println!("Cloning from {}", repo) } _ => {} } ``` -------------------------------- ### Windows Shell Command Configuration Source: https://github.com/volllly/rotz/blob/main/docs/docs/configuration/config.yaml.mdx Specifies the shell command to use for the install command on Windows systems. This allows for custom execution environments. ```yaml shell_command: 'powershell -NoProfile -C {{ quote "" cmd }}' ``` -------------------------------- ### Enable JSON Configuration Files Source: https://github.com/volllly/rotz/blob/main/_autodocs/features.md Install Rotz with support for JSON configuration files. Uses `serde_json` and Figment's JSON provider. Enabled by default. ```bash cargo install rotz --features json ``` -------------------------------- ### Dry-Run Error Reporting Example Source: https://github.com/volllly/rotz/blob/main/_autodocs/errors.md Demonstrates how to perform a dry-run of a command to report errors without making changes. This is useful for previewing the impact of a command. ```bash rotz -r link # Dry-run: reports all errors without making changes ``` -------------------------------- ### Install Rotz via Cargo Source: https://github.com/volllly/rotz/blob/main/README.md Install Rotz using Cargo if Rust is installed. This method works across all platforms. ```bash cargo install rotz ``` -------------------------------- ### Creating and Configuring a Dot Instance Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/dot.md Demonstrates how to create a new Dot instance using its default implementation and populate its links and dependencies. ```rust use std::collections::{HashMap, HashSet}; use std::path::PathBuf; use rotz::dot::Dot; let mut dot = Dot::default(); // Add links mapping let mut links = HashMap::new(); links.insert( PathBuf::from("config/nvim"), { let mut set = HashSet::new(); set.insert(PathBuf::from("~/.config/nvim")); set } ); dot.links = Some(links); // Add dependencies let mut depends = HashSet::new(); depends.insert("base".to_string()); dot.depends = Some(depends); ``` -------------------------------- ### Initialize New Dotfiles Repository Source: https://github.com/volllly/rotz/blob/main/_autodocs/QUICK-REFERENCE.md Initialize a new Rotz repository. This can be done without a remote URL or by specifying one. ```bash rotz init rotz init https://github.com/user/dotfiles.git ``` -------------------------------- ### Example: Linked Structure Usage Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/state.md Demonstrates how to create a Linked structure and iterate through its contents to display dot names, target paths, and source paths. Ensure necessary imports like PathBuf and Linked are present. ```rust use std::path::PathBuf; use rotz::state::Linked; let state = Linked({ let mut outer = std::collections::HashMap::new(); let mut inner = std::collections::HashMap::new(); inner.insert( PathBuf::from("/home/user/.config/nvim"), PathBuf::from("/home/user/.dotfiles/nvim/init.lua") ); outer.insert("/nvim".to_string(), inner); outer }); // Access linked files for (dot_name, links) in &state.0 { for (target, source) in links { println!("{}: {} -> {}", dot_name, target.display(), source.display()); } } ``` -------------------------------- ### Install Command Errors Source: https://github.com/volllly/rotz/blob/main/_autodocs/errors.md Errors that can occur during the `rotz install` operation, including cyclic dependencies, missing dependencies, and execution failures. ```rust pub enum Error { CyclicDependency { name: String, through: String }, CyclicInstallDependency { name: String, through: String }, DependencyNotFound(String, String), InstallExecute(String, helpers::RunError), RenderingTemplate(String, Box), ParsingInstallCommand(String, shellwords::MismatchedQuotes), CouldNotSpawn(String), ParseGlob(String, Box), } ``` -------------------------------- ### Initialize Local Repository Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/commands.md Initializes a new local dotfiles repository without specifying a remote URL. ```bash rotz init ``` -------------------------------- ### Custom File Format Install Source: https://github.com/volllly/rotz/blob/main/_autodocs/QUICK-REFERENCE.md Install Rotz with custom features enabled, such as YAML and TOML support. Adjust features as needed. ```bash cargo install rotz --no-default-features --features yaml,toml ``` -------------------------------- ### Install Command CLI Flags Source: https://github.com/volllly/rotz/blob/main/_autodocs/QUICK-REFERENCE.md Specific command-line flags for the `rotz install` command, related to error handling and dependency skipping. ```bash # Install command flags -c, --continue-on-error Continue on errors -d, --skip-dependencies Skip dependencies -i, --skip-installation-dependencies -a, --skip-all-dependencies Skip all dependencies ``` -------------------------------- ### Initialize Repository with Remote URL Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/commands.md Initializes a new dotfiles repository and sets a remote Git URL as the origin. ```bash rotz init https://github.com/user/dotfiles.git ``` -------------------------------- ### Basic Dot Configuration with Links Source: https://github.com/volllly/rotz/blob/main/_autodocs/dotfiles-format.md A minimal dot configuration file defining symlinks for Neovim. ```yaml # ~/.dotfiles/nvim/dot.yaml links: init.lua: - ~/.config/nvim/init.lua ``` -------------------------------- ### Initialize Repository at Custom Location Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/commands.md Initializes a dotfiles repository in a custom directory and sets a remote Git URL. ```bash rotz -d ~/my-dotfiles init git@github.com:user/dotfiles.git ``` -------------------------------- ### Install Rotz with JSON feature via Cargo Source: https://github.com/volllly/rotz/blob/main/README.md Install Rotz with JSON file support only, disabling default features. Use this if you only need JSON configuration. ```sh cargo install rotz --no-default-features --features json ``` -------------------------------- ### Install Rotz with TOML feature via Cargo Source: https://github.com/volllly/rotz/blob/main/README.md Install Rotz with TOML file support only, disabling default features. Use this if you only need TOML configuration. ```sh cargo install rotz --no-default-features --features toml ``` -------------------------------- ### Create Templating Engine Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/templating.md Initializes a new templating engine with configuration and CLI arguments. ```rust use rotz::cli::Cli; use rotz::config::Config; use rotz::templating::Engine; use clap::Parser; let cli = Cli::parse(); let config = Config::default(); let engine = Engine::new(&config, &cli); ``` -------------------------------- ### Linux musl Static Binary Installation Source: https://github.com/volllly/rotz/blob/main/_autodocs/features.md Install Rotz for the Linux musl target, resulting in a static binary. Requires adding the target and includes special OpenSSL configuration. ```bash rustup target add x86_64-unknown-linux-musl cargo install rotz --target x86_64-unknown-linux-musl ``` -------------------------------- ### Build Static Website Source: https://github.com/volllly/rotz/blob/main/docs/README.md Generates the static content for the website into the 'build' directory, ready for deployment. ```bash yarn build ``` -------------------------------- ### Conditional OS Check with Handlebars Helpers Source: https://github.com/volllly/rotz/blob/main/docs/docs/configuration/templating.md Shows how to use built-in Handlebars helpers like #windows, #linx, and #darwin as shorthands for checking the current operating system, simplifying conditional logic. ```yaml {{ #windows }}{{ else }}{{ /windows }} ``` -------------------------------- ### Dot Struct Source: https://github.com/volllly/rotz/blob/main/_autodocs/types.md Core structure representing a dot configuration, including links, installs, and dependencies. ```rust pub struct Dot { pub links: Option> >, pub installs: Option, pub depends: Option>, } ``` -------------------------------- ### MultipleErrors Example Usage Source: https://github.com/volllly/rotz/blob/main/_autodocs/types.md Illustrates how to create a `MultipleErrors` instance from a vector of `ParseError` and return it as an error. ```rust let errors: Vec = vec![/* ... */]; let multi_error = MultipleErrors::from(errors); return Err(multi_error)?; ``` -------------------------------- ### Verify Config is Loaded Source: https://github.com/volllly/rotz/blob/main/_autodocs/QUICK-REFERENCE.md Check if your configuration is loaded correctly by using '--dry-run' along with the '--config' flag to specify a configuration file. ```bash rotz --config ~/.config/rotz/config.yaml link --dry-run ``` -------------------------------- ### Force Reinstall Applications Source: https://github.com/volllly/rotz/blob/main/_autodocs/QUICK-REFERENCE.md Forcefully reinstall applications, potentially overwriting existing installations or resolving issues. ```bash rotz install --force ``` -------------------------------- ### Generate Shell Completions Source: https://github.com/volllly/rotz/blob/main/_autodocs/QUICK-REFERENCE.md Generate shell completion scripts for bash. The output needs to be piped to an installation path. ```bash rotz completions bash | install-path ``` -------------------------------- ### Accessing Operating System Information Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/templating.md Shows how to use the `os` variable to apply configurations specific to the operating system (Global, Windows, Linux, Darwin). ```yaml global: links: common: ~/.config/app windows: links: windows_specific: ~/AppData/Roaming/app linux: links: linux_specific: ~/.config/app-linux ``` -------------------------------- ### Dry-Run Testing Source: https://github.com/volllly/rotz/blob/main/_autodocs/dotfiles-format.md Use the `--dry-run` flag with `rotz link` and `rotz install` commands to test configurations before applying them. ```bash rotz link --dry-run rotz install --dry-run ``` -------------------------------- ### Create Dot Directories Source: https://github.com/volllly/rotz/blob/main/_autodocs/README.md Creates the necessary directory structure within your dotfiles repository. Organize your configurations into subdirectories for clarity. ```bash mkdir -p ~/.dotfiles/{nvim,zsh,git} ``` -------------------------------- ### Generate Fish Shell Completion Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/commands.md Generates shell completion scripts for the Fish shell. Output can be redirected to a file for installation. ```bash rotz completions fish > ~/.config/fish/completions/rotz.fish ``` -------------------------------- ### Generate Zsh Shell Completion Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/commands.md Generates shell completion scripts for the Zsh shell. Output can be redirected to a file for installation. ```bash rotz completions zsh > ~/.config/zsh/completion/_rotz ``` -------------------------------- ### Generate Bash Shell Completion Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/commands.md Generates shell completion scripts for the Bash shell. Output can be redirected to a file for installation. ```bash rotz completions bash > ~/.local/share/bash-completion/completions/rotz ``` -------------------------------- ### Dot Struct Definition Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/dot.md Defines the core structure for a single dot configuration, including optional links, installations, and dependencies. ```rust pub struct Dot { pub links: Option>>, pub installs: Option, pub depends: Option>, } ``` -------------------------------- ### Enable All File Formats Source: https://github.com/volllly/rotz/blob/main/_autodocs/features.md Install Rotz with support for all three file formats (YAML, TOML, JSON). This is the default behavior. ```bash cargo install rotz --features all-formats ``` ```bash cargo install rotz --features yaml,toml,json ``` -------------------------------- ### Handling Templating Errors Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/templating.md Provides an example of how to match and handle different `Error` variants that can occur during template rendering and evaluation. ```rust match engine.render(template, ¶ms) { Ok(rendered) => println!("{}", rendered), Err(Error::RenderingTemplate(e)) => eprintln!("Template error: {}", e), Err(e) => eprintln!("Other error: {}", e), } ``` -------------------------------- ### Engine::new Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/templating.md Creates a new templating engine instance. It requires configuration and CLI arguments to initialize. ```APIDOC ## Engine::new ### Description Creates a new templating engine instance. It requires configuration and CLI arguments to initialize. ### Signature ```rust pub fn new<'a>(config: &'a Config, cli: &'a Cli) -> Engine<'a> ``` ### Parameters #### Path Parameters - **config** (`&'a Config`) - Required - Configuration containing custom variables. - **cli** (`&'a Cli`) - Required - CLI arguments structure. ### Returns - **Engine<'a>** - Initialized templating engine. ### Example ```rust use rotz::cli::Cli; use rotz::config::Config; use rotz::templating::Engine; use clap::Parser; let cli = Cli::parse(); let config = Config::default(); let engine = Engine::new(&config, &cli); ``` ``` -------------------------------- ### File Format Detection Example Source: https://github.com/volllly/rotz/blob/main/_autodocs/features.md Rotz detects configuration file formats by their file extension, provided the corresponding feature is enabled. ```yaml # .yaml or .yml → YAML (if yaml feature enabled) # .toml → TOML (if toml feature enabled) ``` -------------------------------- ### Templating in Dotfiles Configuration Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/dot.md Demonstrates Handlebars templating for dynamic configuration based on environment variables and user information. ```yaml # ~/.dotfiles/shell/dot.yaml links: {{#if env.SHELL}} .shellrc: ~/{{env.USER}}/.shellrc {{/if}} installs: cmd: "curl https://example.com/{{whoami.username}}/install.sh | bash" ``` -------------------------------- ### MacOS Shell Command Configuration Source: https://github.com/volllly/rotz/blob/main/docs/docs/configuration/config.yaml.mdx Specifies the shell command to use for the install command on macOS systems. This allows for custom execution environments. ```yaml shell_command: 'zsh -c {{ quote "" cmd }}' ``` -------------------------------- ### Show Available Completions Source: https://github.com/volllly/rotz/blob/main/_autodocs/QUICK-REFERENCE.md Display help for generating shell completions for Rotz. ```bash rotz completions --help ``` -------------------------------- ### Linux Shell Command Configuration Source: https://github.com/volllly/rotz/blob/main/docs/docs/configuration/config.yaml.mdx Specifies the shell command to use for the install command on Linux systems. This allows for custom execution environments. ```yaml shell_command: 'bash -c {{ quote "" cmd }}' ``` -------------------------------- ### Link all dotfiles Source: https://github.com/volllly/rotz/blob/main/_autodocs/api-reference/commands.md Use the `link` command without arguments to link all dotfiles defined in the configuration. ```bash rotz link ```