Skip to content

auscyber/dotfile-sync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

c1eb20a · Jan 12, 2023
Jan 12, 2023
Dec 19, 2021
Dec 19, 2021
Aug 17, 2021
Dec 18, 2021
Dec 19, 2021
Jan 4, 2022
Dec 24, 2021
Dec 18, 2021
Jul 30, 2021
Jul 23, 2021
Dec 18, 2021
Dec 19, 2021
Dec 19, 2021
Mar 18, 2021
Dec 19, 2021

Repository files navigation

Dotfile Sync

For UNIX-based systems

Build Issues

Syncing dotfiles or other folders with symlinks can be a bit annoying to manage. Especially when you have multiple systems to setup.

You can create system dependent links to alleviate all your stress

Table of Contents

  1. Features
  2. Installation
  3. Configuration
  4. Usage

Features

  • Easy initalisation of configurations
    dots init
  • Addition of links
    dots add file1 file2
    dots add file1 --destination files/file2linked
    dots add file1 file2 --destination files
  • Manage globally
    dots manage dots manage --default
  • Only link on specific system
    dots --system laptop add file1laptop
    dots --system desktop add file1desktop file2desktop --destination files
  • Read from environment variables
    dots add $HOME/file1
  • Project-wide variables
    [variables]
    user = "auscyber"
    password = "1234"
    List example
  • Revert link
    dots revert file1

Installation

  1. Install rust-toolchain with if you don't already have it installed
    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  2. Clone the repository into a folder of your choice
    git clone https://github.com/auscyberman/dotfile-sync
  3. Run cargo build --release and add target/build/release/dots to your PATH

Now It's installed. Time to configure it

Configuration

Create base .links.toml file

  1. Move to folder where you want to initalise project
  2. Initalise Project dots init
  3. dots manage --default Note: default flag not required, just simplifies later tasks

Now you are all setup, just run dots add file1 file2 ... and dots sync to sync everything on another computer Note: adding files requires --project or --project-path flag to command if --default wasn't added to manage

Dotfile Sync uses TOML for configuration

  • To add a link to the project, add a new section
[[links]]

with these attributes
These first three are required

  • name: The user side name for the link
  • src: The relative location of the actual file in the project
  • destination: The location for the src to be linked to

These are not required

  • system: System to link on can be null
  • default_path: When source_map exists, the default path to link if the current system cannot be found in source_map
  • default_system: The same as above, however, the default system to search for in source_map
  • source_map: Map of systems to relative locations

Usage

Adding multiple files

To add the files file1 file2

dots add file1 file2

Set destination of files

To put the file file1 in project/files/file2

dots add file1 -d files/file2

Add file dependent on system

To only link file when the system is desktop
dots add file1 --system "desktop"

On another computer

To sync with no extra paremeters
curl -Ls https://git.io/JBB45 | sh -s
To add extra paremeters --system "desktop"
curl -Ls https://git.io/JBB45 | sh -s -- --system "desktop"