### Install Standalone Configuration with Sudo Source: https://github.com/anishathalye/dotbot/wiki/Tips-and-Tricks Example of installing a configuration with elevated privileges by appending '-sudo'. Other configurations are installed without sudo. ```bash ./install-standalone some-config-sudo some-other-config ``` -------------------------------- ### Install Dotfiles from Repository Source: https://github.com/anishathalye/dotbot/blob/master/README.md Commands to clone a dotfiles repository and install them on a new machine. This involves cloning the repository, changing into the directory, and running the install script. ```bash git clone ~/.dotfiles cd ~/.dotfiles ./install ``` -------------------------------- ### Dotbot Full Configuration Example Source: https://github.com/anishathalye/dotbot/blob/master/README.md A complete example of a Dotbot configuration file in YAML format. This file specifies default linking behavior, cleans directories, creates symbolic links, creates directories, and updates submodules. ```yaml - defaults: link: relink: true - clean: ['~'] - link: ~/.tmux.conf: tmux.conf ~/.vim: vim ~/.vimrc: vimrc - create: - ~/downloads - ~/.vim/undo-history - shell: - [git submodule update --init --recursive, Installing submodules] ``` -------------------------------- ### Install Dotbot using uv Source: https://github.com/anishathalye/dotbot/blob/master/README.md Install Dotbot as a command-line program using the `uv` package manager. This is an alternative to bundling Dotbot as a submodule. ```bash uv tool install dotbot ``` -------------------------------- ### Install Standalone Configuration Command Source: https://github.com/anishathalye/dotbot/wiki/Tips-and-Tricks Command to install single configurations directly. ```bash ./install-standalone ``` -------------------------------- ### Install Dotbot using PowerShell Source: https://github.com/anishathalye/dotbot/blob/master/README.md Use the provided PowerShell script for installation on Windows systems. Ensure Python 3.8+ is installed and symbolic link creation is permitted. ```powershell cp dotbot/tools/install.ps1 . ``` -------------------------------- ### Install Profile Command Source: https://github.com/anishathalye/dotbot/wiki/Tips-and-Tricks Command to install a dotfiles profile along with specified configurations. ```bash ./install-profile [] ``` -------------------------------- ### Standalone Configuration Installation Script Source: https://github.com/anishathalye/dotbot/wiki/Tips-and-Tricks Use this bash script to install individual configurations without a profile. Configurations ending with '-sudo' will be executed with elevated privileges. ```bash #!/usr/bin/env bash set -e BASE_CONFIG="base" CONFIG_SUFFIX=".yaml" META_DIR="meta" CONFIG_DIR="configs" PROFILES_DIR="profiles" DOTBOT_DIR="dotbot" DOTBOT_BIN="bin/dotbot" BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd "${BASE_DIR}" git submodule update --init --recursive --remote for config in ${@}; do # create temporary file configFile="$(mktemp)" suffix="-sudo" echo -e "$(<"${BASE_DIR}/${META_DIR}/${BASE_CONFIG}${CONFIG_SUFFIX}")\n$(<"${BASE_DIR}/${META_DIR}/${CONFIG_DIR}/${config%"$suffix"}${CONFIG_SUFFIX}")" > "$configFile" cmd=("${BASE_DIR}/${META_DIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" -d "${BASE_DIR}" -c "$configFile") if [[ $config == *"sudo"* ]]; then cmd=(sudo "${cmd[@]}") fi "${cmd[@]}" rm -f "$configFile" done cd "${BASE_DIR}" ``` -------------------------------- ### Create Dotbot Configuration File Source: https://github.com/anishathalye/dotbot/blob/master/README.md Create an empty YAML configuration file for Dotbot. This file will define the installation process. ```bash touch install.conf.yaml ``` -------------------------------- ### Bash Script for Profile-Based Dotbot Installation Source: https://github.com/anishathalye/dotbot/wiki/Tips-and-Tricks This script automates the installation of Dotbot configurations based on specified profiles. It dynamically constructs configuration files by merging a base configuration with profile-specific ones and handles sudo execution when required. Ensure the dotbot submodule is correctly located. ```bash #!/usr/bin/env bash set -e BASE_CONFIG="base" CONFIG_SUFFIX=".yaml" META_DIR="meta" CONFIG_DIR="configs" PROFILES_DIR="profiles" DOTBOT_DIR="dotbot" DOTBOT_BIN="bin/dotbot" BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd "${BASE_DIR}" git -C "${BASE_DIR}" submodule sync --quiet --recursive git submodule update --init --recursive "${BASE_DIR}" while IFS= read -r config; do CONFIGS+=" ${config}" done < "${META_DIR}/${PROFILES_DIR}/$1" shift for config in ${CONFIGS} ${@}; do echo -e "\nConfigure $config" # create temporary file configFile="$(mktemp)" suffix="-sudo" echo -e "$(<"${BASE_DIR}/${META_DIR}/${BASE_CONFIG}${CONFIG_SUFFIX}")\n$(<"${BASE_DIR}/${META_DIR}/${CONFIG_DIR}/${config%"$suffix"}${CONFIG_SUFFIX}")" > "$configFile" cmd=("${BASE_DIR}/${META_DIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" -d "${BASE_DIR}" -c "$configFile") if [[ $config == *"sudo"* ]]; then cmd=(sudo "${cmd[@]}") fi "${cmd[@]}" rm -f "$configFile" done cd "${BASE_DIR}" ``` -------------------------------- ### Update Existing Dotfiles Installation Source: https://github.com/anishathalye/dotbot/blob/master/README.md Commands to update an existing Dotbot installation. This involves navigating to the dotfiles directory, pulling the latest changes, and re-running the install script. ```bash cd ~/.dotfiles git pull ./install ``` -------------------------------- ### Configure Links with Explicit Targets Source: https://github.com/anishathalye/dotbot/blob/master/README.md This example demonstrates configuring symbolic links where the target file or directory within your dotfiles is explicitly specified. Options like 'glob', 'relink', 'exclude', and 'create' can be used to customize link behavior. ```yaml - link: ~/bin/ack: ack ~/.vim: vim ~/.vimrc: relink: true path: vimrc ~/.zshrc: force: true path: zshrc ~/.config/: glob: true path: config/* relink: true exclude: [ config/Code ] ~/.config/Code/User/: create: true glob: true path: config/Code/User/* relink: true ``` -------------------------------- ### Configure SSH LocalCommand for Dotfiles Update Source: https://github.com/anishathalye/dotbot/wiki/Tips-and-Tricks Configure your local ~/.ssh/config to automatically update or install dotfiles on a remote machine upon connection. This uses a chained SSH command to execute git pull and install scripts. ```bash Host some.remote.host.example.com PermitLocalCommand yes # Unfortunately ssh does not support line breaks in config files LocalCommand ssh -o PermitLocalCommand=no %n "which git >/dev/null && ([[ -d ~/dotfiles ]] && (echo "Updating dotfiles on %h ..." && cd ~/dotfiles && git pull -q && ./install >/dev/null) || (echo "Installing dotfiles on %h ..." && git clone -q https://github.com/MYNAMESPACE/dotfiles && ./dotfiles/install >/dev/null))" ``` -------------------------------- ### Breakdown of SSH LocalCommand for Dotfiles Source: https://github.com/anishathalye/dotbot/wiki/Tips-and-Tricks A detailed breakdown of the Bash command used within SSH's LocalCommand for managing dotfiles. It checks for git, updates existing dotfiles, or clones and installs new ones. ```bash LocalCommand ssh -o PermitLocalCommand=no %n "which git >/dev/null && ([[ -d ~/dotfiles ]] && \ (echo "Updating dotfiles on %h ..." && cd ~/dotfiles && git pull -q && ./install >/dev/null) || \ (echo "Installing dotfiles on %h ..." && git clone -q https://github.com/MYNAMESPACE/dotfiles && ./dotfiles/install >/dev/null))" ``` -------------------------------- ### Suppress Color Output in Dotbot Source: https://github.com/anishathalye/dotbot/wiki/Troubleshooting Pass the --no-color flag to the dotbot install command to disable colorized output in the terminal. Use this if the default colors are difficult to read. ```bash dotbot --no-color ``` -------------------------------- ### Load Plugins via Command Line (Bash) Source: https://github.com/anishathalye/dotbot/blob/master/README.md Use the `--plugin` option multiple times to load plugins. Paths are interpreted relative to the working directory. ```bash dotbot --plugin dotbot-plugins/dotbot-brew/ --plugin dotbot-plugins/custom_plugin.py ... ``` -------------------------------- ### Create Directories Source: https://github.com/anishathalye/dotbot/blob/master/README.md Specify directories to be created. Extended syntax allows for optional file mode configuration. ```yaml - create: - ~/downloads - ~/.vim/undo-history - create: ~/.ssh: mode: 0700 ~/projects: ``` -------------------------------- ### Load Plugins via Configuration (YAML) Source: https://github.com/anishathalye/dotbot/blob/master/README.md Specify plugins in your configuration file as an array of files or directories. Paths are interpreted relative to the base directory. ```yaml - plugins: - dotbot-plugins/dotbot-brew/ - dotbot-plugins/custom_plugin.py ``` -------------------------------- ### Build Project Artifacts with Hatch Source: https://github.com/anishathalye/dotbot/blob/master/DEVELOPMENT.md Create build artifacts, including source distributions (sdist) and built distributions (wheel), using Hatch. ```bash hatch build ``` -------------------------------- ### Publish Project to PyPI with Hatch Source: https://github.com/anishathalye/dotbot/blob/master/DEVELOPMENT.md Publish the project's build artifacts to the Python Package Index (PyPI) using the Hatch package manager. ```bash hatch publish ``` -------------------------------- ### Run Tests with Hatch Source: https://github.com/anishathalye/dotbot/blob/master/DEVELOPMENT.md Execute the project's test suite using the Hatch package manager. Supports options for coverage and matrix testing. ```bash hatch test ``` -------------------------------- ### Custom Plugin Implementation Source: https://github.com/anishathalye/dotbot/blob/master/README.md Illustrates the structure for custom plugins, extending Dotbot's functionality. Plugins must implement `can_handle` and `handle` methods and can declare dry-run support. ```python class CustomPlugin(dotbot.Plugin): def can_handle(self, directive): # Return True if the plugin can handle the directive pass def handle(self): # Implement plugin logic # Return True on success, False on failure pass # Optional: Declare support for dry-run supports_dry_run = True ``` -------------------------------- ### Run Tests in Docker Container Source: https://github.com/anishathalye/dotbot/blob/master/DEVELOPMENT.md Launch an isolated Docker container for development and testing. Mounts the current directory and sets the working directory. ```bash docker run -it --rm -v "${PWD}:/dotbot" -w /dotbot python:3.13-bookworm /bin/bash ``` -------------------------------- ### Run Single Test with Hatch Source: https://github.com/anishathalye/dotbot/blob/master/DEVELOPMENT.md Execute a specific test case within the project's test suite by appending the test path and name to the 'hatch test' command. ```bash hatch test tests/test_shell.py::test_shell_can_override_defaults ``` -------------------------------- ### Configure Links with Extended Options Source: https://github.com/anishathalye/dotbot/blob/master/README.md Use this configuration to define symbolic links with advanced options such as creating parent directories, relinking, forcing overwrites, and using glob patterns for multiple files. Ensure targets are relative to the base directory. ```yaml - link: ~/.config/terminator: create: true path: config/terminator ~/.vim: vim ~/.vimrc: relink: true path: vimrc ~/.zshrc: force: true path: zshrc ~/.hammerspoon: if: '[ `uname` = Darwin ]' path: hammerspoon ~/.config/: glob: true path: dotconf/config/** ~/: glob: true path: dotconf/* prefix: '.' ``` -------------------------------- ### Dry Run Command (Bash) Source: https://github.com/anishathalye/dotbot/blob/master/README.md Use the `--dry-run` argument to see what Dotbot would do without making changes. Useful for testing configurations. Plugins not supporting dry-run will be skipped. ```bash ./install --dry-run ``` -------------------------------- ### Set Default Options Source: https://github.com/anishathalye/dotbot/blob/master/README.md Configure default options for subsequent commands. This is useful for avoiding repetitive settings, especially with the 'link' command. ```yaml - defaults: link: create: true relink: true ``` -------------------------------- ### Enable Native Winsymlinks in Git Bash Source: https://github.com/anishathalye/dotbot/wiki/Troubleshooting Set the MSYS environment variable to enable native symbolic link creation in Git Bash on Windows. This is necessary for 'ln -s' to create links instead of copying files. Run Git Bash as administrator. ```bash export MSYS=winsymlinks:nativestrict ./install ``` -------------------------------- ### Execute Shell Commands Source: https://github.com/anishathalye/dotbot/blob/master/README.md Define shell commands to be executed. Supports simple string commands, arrays with descriptions, and extended syntax for fine-grained control over input/output and quiet execution. ```yaml - shell: - chsh -s $(which zsh) - [chsh -s $(which zsh), Making zsh the default shell] - command: read var && echo Your variable is $var stdin: true stdout: true description: Reading and printing variable quiet: true - command: read fail stderr: true ``` -------------------------------- ### Run Type Checking with Hatch Source: https://github.com/anishathalye/dotbot/blob/master/DEVELOPMENT.md Perform static type checking on the project using mypy via the Hatch environment. Ensure code adheres to type hints. ```bash hatch run types:check ``` -------------------------------- ### Check Formatting with Ruff Source: https://github.com/anishathalye/dotbot/blob/master/DEVELOPMENT.md Check code formatting and linting without applying any modifications. Use this to verify code style compliance. ```bash hatch fmt --check ``` -------------------------------- ### Except Specific Directives (Bash) Source: https://github.com/anishathalye/dotbot/blob/master/README.md Use the `--except` argument followed by a list of directives to run all sections of the config file except the listed ones. ```bash ./install --except shell ``` -------------------------------- ### Format Code with Ruff Source: https://github.com/anishathalye/dotbot/blob/master/DEVELOPMENT.md Automatically format and lint the project's code using Ruff. This command applies safe fixes to maintain code style. ```bash hatch fmt ``` -------------------------------- ### Configure Links with Implicit Targets Source: https://github.com/anishathalye/dotbot/blob/master/README.md This configuration uses implicit targets for symbolic links, where Dotbot automatically uses the basename of the link name as the target path. This simplifies configuration when the target name matches the desired link name. ```yaml - link: ~/bin/ack: ~/.vim: ~/.vimrc: relink: true ~/.zshrc: force: true ~/.config/: glob: true path: config/* relink: true exclude: [ config/Code ] ~/.config/Code/User/: create: true glob: true path: config/Code/User/* relink: true ``` -------------------------------- ### Only Run Specific Directives (Bash) Source: https://github.com/anishathalye/dotbot/blob/master/README.md Use the `--only` argument followed by a list of directives to run only those sections of the config file. ```bash ./install --only link ``` -------------------------------- ### Add Dotbot as Git Submodule Source: https://github.com/anishathalye/dotbot/blob/master/README.md Integrate Dotbot into your dotfiles repository using Git submodules. This ensures a specific version of Dotbot is used. ```bash cd ~/.dotfiles # replace with the path to your dotfiles git init # initialize repository if needed git submodule add https://github.com/anishathalye/dotbot git config -f .gitmodules submodule.dotbot.ignore dirty # ignore dirty commits in the submodule cp dotbot/tools/git-submodule/install . ``` -------------------------------- ### Clean Dead Symbolic Links Source: https://github.com/anishathalye/dotbot/blob/master/README.md Specify directories to check for dead symbolic links. Dead links within the dotfiles directory are removed by default. Extended syntax allows for forcing removal of all dead links and recursive cleaning. ```yaml - clean: ['~'] ``` ```yaml - clean: ~/: force: true ~/.config: recursive: true ``` -------------------------------- ### PowerShell Uninstall Script for Dotbot Symlinks Source: https://github.com/anishathalye/dotbot/wiki/Tips-and-Tricks An equivalent PowerShell script for uninstalling Dotbot symlinks. It reads the install.conf.yaml and removes symbolic links, requiring the powershell-yaml module. ```powershell $CONFIG = "install.conf.yaml" $confObj = ConvertFrom-Yaml ([string](Get-Content $CONFIG -Raw)) foreach ($target in ($confObj | Where-Object Keys -eq link).Values.Keys) { if ((Get-Item $target -Force -ErrorAction SilentlyContinue).LinkType -eq "SymbolicLink") { Write-Host "Removing $target" -ForegroundColor Red Remove-Item $target } } ``` -------------------------------- ### Add Dotbot as Mercurial Subrepo Source: https://github.com/anishathalye/dotbot/blob/master/README.md Integrate Dotbot into your dotfiles repository using Mercurial subrepos. This method is specific to Mercurial version control. ```bash cd ~/.dotfiles # replace with the path to your dotfiles hg init # initialize repository if needed echo "dotbot = [git]https://github.com/anishathalye/dotbot" > .hgsub hg add .hgsub git clone https://github.com/anishathalye/dotbot cp dotbot/tools/hg-subrepo/install . ``` -------------------------------- ### Python Uninstall Script for Dotbot Symlinks Source: https://github.com/anishathalye/dotbot/wiki/Tips-and-Tricks A Python script to remove symlinks created by Dotbot. It parses the install.conf.yaml file to identify and delete the symlinks, requiring the PyYAML library. ```python #!/usr/bin/env python from __future__ import print_function import yaml import os CONFIG="install.conf.yaml" stream = open(CONFIG, "r") conf = yaml.load(stream, yaml.FullLoader) for section in conf: if 'link' in section: for target in section['link']: realpath = os.path.expanduser(target) if os.path.islink(realpath): print("Removing ", realpath) os.unlink(realpath) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.