Crates.io | link_o_matic |
lib.rs | link_o_matic |
version | 0.4.2 |
source | src |
created_at | 2024-06-28 00:02:10.117258 |
updated_at | 2024-07-02 22:14:04.593532 |
description | A dotfile symlink manager with a convention over configuration philosophy |
homepage | |
repository | https://github.com/mong8se/link_o_matic |
max_upload_size | |
id | 1286304 |
size | 27,820 |
NOTE THIS IS BETA AND ONLY USED BY ME SO MAYBE DON'T USE THE DELETE FUNCTIONS UNTIL YOU ARE SURE I KNOW WHAT I AM DOING -- But I've been using it without accidentally deleting files so far.
Expects an environment variable LINKOMATIC_ROOT which points to where dotfiles are checked out. Doesn't have to be exported, just need to set it when you run link_o_matic
Inside your LINKOMATIC_ROOT you'll make a directory called home
which will be the files/dirs you'll want linked without the
leading .
in the names
Examples:
home/thing
will get linked to ~/.thing
home/config/other_thing
will get linked to ~/.config/other_thing
Expects an environment variable LINKOMATIC_HOSTNAME which is whatever string you want to represent the host you are on. Can be the same as HOSTNAME or different if you want to obfuscate your host names in your git repo.
Any files that begin with an underscore will only be symlinked IF:
_${LINKOMATIC_HOSTNAME}
_machine
and the rest
_bob.nvim.lua
will get linked as _machine.nvim.lua
only on host bob_mac
_linux
and your OS is mac or linux
_platform
_mac.fish
will get linked as _platform.fish
only on a macThis way your config files can reference your _machine
and _platform
files and not have to know the actual names.
install cleanup sync autocleanup implode
Starts in LINKOMATIC_ROOT/home
If it is a dir, it is recursed.
If it is a file, a symlink is made to it.
If it is a symlink, a symlink is made to its target.
Its name will have a .
prepended
Looks for links in ~ that link to something in LINKOMATIC_ROOT/home
Look in the root of ~, or recursively through any ~/dir that has a
matching LINKOMATIC_ROOT/home/dir to avoid scanning through the entire
home directory. So if you remove a top level directory you'll leave
orphaned links at this point, unless you remove them from the repo first
and cleanup before removing the top level directory.
TODO: is there a better way?
If it's a broken or invalid link, prompts to delete.
First install
then cleanup
.
Same as cleanup
but doesn't prompt.
Looks for links in ~ that link to something in LINKOMATIC_ROOT/home
Prompts to delete.
If you create a symlink inside LINKOMATIC_ROOT/home
that is a valid relative path
to a file inside LINKOMATIC_ROOT
, when the link is created it will point
directly to the target of the symlink, not the intermediary symlink.
For example start in your dot files:
cd ~/$LINKOMATIC_ROOT
This step isn't strictly necessary but will allow tab completion of your target
cd home
Now make a relative link to your target file (you'd link to home/vimrc
if
you skipped above step)
ln -s ../config/nvim/init.vim vimrc
Now you will have a symlink in LINKOMATIC_ROOT/home/vimrc
that points to
LINKOMATIC_ROOT/config/nvim/init.vim
but relatively.
When you run install your ~/.vimrc
will point to your
LINKOMATIC_ROOT/config/nvim/init.vim
... not to the symlink LINKOMATIC_ROOT/home/vimrc