godot
Still another dotfiles manager, this time in go
This project mostly functioned as a learning exercise for teaching myself Go. I had written a custom
dotfiles manager in Python, so rewriting in Go seemed feasible since I knew my personal requirements
, thus making it a "solved" problem for me.
Installation
Compiled binaries can be found on the releases page here
. Optionally, clone this repository and run go install
Setup
godot depends on 2 distinct configuration files.
~/.config/godot/config.json
This config contains only 2 values
Value |
Meaning |
Optional |
target |
This is the "name" of this computer, used to track what files it will recieve |
True, defaults to current hostname |
dotfiles_root |
The root of the repository godot should use to look for templates and manage its settings |
True, defaults to ~/dotfiles |
Example:
{
"target": "desktop",
"dotfiles_root": "/home/njohnson/my_dotfiles"
}
<dotfiles_root>/config.json
This is managed by godot, and contains what files are under its control, and what hosts should get
what files. While this file can be managed by hand, it's better to let godot do it.
Templating
The files stored in the dotfiles repository will be evaluated as go templates. Information about
Go's templating can be found here. Godot
defines supplements that with the following
Value |
Type |
Meaning |
Example Usage |
Target |
variable |
The name of the current target |
Export an environment variable with the current target name
export GODOT_TARGET="{{ .Target }}" |
Submodules |
variable |
A special directory in the dotfiles repo for using git submodules |
export PATH="{{ .Submodules }}/fzf/bin:${PATH}" |
Home |
variable |
Path to the current users home directory |
export PATH={{ .Home }}/bin:${PATH} |
oneOf |
function |
shorthand for evaulating if the current target is in a list |
{{ if oneOf . "work" "home" }}
export FOO="bar"
{{ end }} |
notOneOf |
function |
The inverse of oneOf , evaluates if the target is not one of the list |
|