Anish Athalye

New Dotbot Features

I’ve gotten a little bit of time to add a couple features to Dotbot recently.

The first is an extended configuration syntax for linking files that allows for automatic path creation and forcibly overwriting files. This was actually a feature proposed by a Dotbot user. It took me some time to get around to implementing it (due to being quite busy), but now it’s done!

The second is YAML support for configuration files! YAML is a superset of JSON, and it looks much cleaner (in my opinion). This is actually a feature that I’ve personally wanted for a while now, and now it’s finally supported. The original JSON syntax worked just fine, but the YAML looks so pretty!

This is what my old configuration file for my dotfiles looked like:

[
    {
        "clean": ["~"]
    },
    {
        "shell": [
            ["mkdir -p ~/.rtorrent/session ~/.rtorrent/watch ~/.rtorrent/downloads", "Creating rtorrent directories"]
        ]
    },
    {
        "link": {
            "~/.dotfiles": "",
            "~/.tmux.conf": "tmux.conf",
            "~/.screenrc": "screenrc",
            "~/.vimrc": "vimrc",
            "~/.vim": "vim/",
            "~/.zshrc": "zshrc",
            "~/.zsh": "zsh/",
            "~/.gitconfig": "gitconfig",
            "~/.gitignore_global": "gitignore_global",
            "~/.sbt/0.13/build.sbt": {
                "path": "sbt/0.13/build.sbt",
                "create": true
            },
            "~/.sbt/0.13/plugins/plugins.sbt": {
                "path": "sbt/0.13/plugins/plugins.sbt",
                "create": true
            },
            "~/.rtorrent.rc": "rtorrent.rc",
            "~/.axelrc": "axelrc"
        }
    },
    {
        "shell": [
            ["git update-submodules", "Installing/updating submodules"]
        ]
    }
]

And this is what the YAML equivalent looks like:

- clean: ['~']

- link:
    ~/.axelrc: axelrc
    ~/.dotfiles: ''
    ~/.gitconfig: gitconfig
    ~/.gitignore_global: gitignore_global
    ~/.rtorrent.rc: rtorrent.rc
    ~/.sbt/0.13/build.sbt:
      create: true
      path: sbt/0.13/build.sbt
    ~/.sbt/0.13/plugins/plugins.sbt:
      create: true
      path: sbt/0.13/plugins/plugins.sbt
    ~/.screenrc: screenrc
    ~/.tmux.conf: tmux.conf
    ~/.vim: vim/
    ~/.vimrc: vimrc
    ~/.zsh: zsh/
    ~/.zshrc: zshrc

- shell:
  - [mkdir -p ~/.rtorrent/session ~/.rtorrent/watch ~/.rtorrent/downloads,
      Creating rtorrent directories]
  - [git update-submodules, Installing/updating submodules]

It’s way more compact, and so it’s much easier to read.