Crates.io | dotctl |
lib.rs | dotctl |
version | 0.1.0 |
source | src |
created_at | 2024-01-23 23:12:40.875966 |
updated_at | 2024-01-23 23:12:40.875966 |
description | A CLI tool for managing dotfile setups and removals |
homepage | |
repository | |
max_upload_size | |
id | 1111308 |
size | 30,092 |
dotctl
is a CLI tool for managing active program configuration files (AKA "dotfiles"). It works alongside a dedicated directory that centralizes configuration location while allowing them to be linked appropriately
This tool aims to be agnostic of an individual "dotfile" repository. The storage and/or retrieval of the files is not handled by this tool. Whether you use git to manage a literal repository or you have a dedicated place on a cloud server for your "dotfiles", this tool can help with setting up these configurations.
As mentioned before, the layout and structure of the "dotfile" directory does not matter. The only assumption for now is that there is only a single repository housing the "dotfiles". This is intended because the tool should be able to integrate into existing setups without heavily modifying it. There may be some initial work to setup to get things working smoothly, but hopefully such work focused around the dotctl
application and not anything that already exists.
dotctl
configCurrently, the only configuration format supported is YAML, but more formats may come later on. The configuration for dotctl
consists of two parts: an options sections and a list of configurations to work with. If a configuration is not part of that list, dotctl
won't know about it.
This section assigns values to certain things that dotctl
may utilize. Currently, the only thing here is the location of the "dotfile" repository that this configuration is part of.
options:
repository: "~/.dotfiles"
The value here should be the full path for the directory that houses the "dotfiles". It should be absolute, but support for the ~
shorthand is included for convenience.
Application configurations are objects in a list that dotctl
will be able to work with. Each configuration needs to specify some information to determine
The instruction to setup a configuration are specified as a list of "links" to create. Links will be created sequentially until the setup process is complete. Safety is determined by the current OS name and the user assigned status of the specific configuration.
configuratoins:
- name: "bash" # This is the name specified on the command line. Should be unique, but not enforced.
status: Ready | Unused # Ready would indicate configuration is ok to use, while unused would indicate the configuration has been archived
os: linux # Operating system configuration is allowed to be installed on. Cross platform configuration should make separate entries
links: # The links to create with this configuration
source: "config.sh" # Path to *real* file. Can be specified relative to the repository option or as an absolute path
target: "~/.bashrc" # Path to place the symlink/copy. Should be absolute with `~` shorthand supported
mode: copy # The linking method to use. Can be copy, hard, or soft
# Copy: will create a copy of source and place it at target
# Soft: will create a soft link (or symlink) at target pointing to source
# Hard: will create a hard link at target pointing to source
# More links to follow if needed
# More configurations to follow if needed
The configuration is designed to specify how to navigate a current "dotfile" repository rather than force a layout or structure onto the user. It will hopefully extend to be able to work with more complicated application configurations
A full example of the configuration would look like. Note that names for individual links are optional.
options:
repository: ~/.dotfiles
configurations:
- name: bash
status: Ready
os: linux
links:
- name: init
source: bash/init.sh
target: ~/.bashrc
mode: Soft
- name: aliases
source: bash/aliases.sh
target: ~/.aliases
mode: Hard
- name: functions
source: bash/functions.sh
target: ~/.functions
mode: Hard
- name: bash
status: Unused
os: macos
links:
- name: init
source: bash/init.sh
target: ~/.bashrc
mode: Soft
- name: aliases
source: bash/aliases.sh
target: ~/.aliases
mode: Hard
- name: functions
source: bash/functions.sh
target: ~/.functions
mode: Hard
- name: ssh
status: Ready
os: macos
links:
- name: config
source: ssh/config
target: ~/.ssh/config
mode: Copy
- name: vim
status: Unused
os: macos
links:
- name: config
source: vim/config.vim
target: ~/.vimrc
mode: Soft
- name: nvim
status: Ready
os: macos
links:
- name: init
source: nvim/init.lua
target: ~/.config/nvim/init.lua
mode: Copy
- name: lua dir
source: nvim/lua/
target: ~/.config/nvim/lua/
mode: Copy
Setting up dotctl
should be a pretty straightforward process
dotctl
binary$PATH
so it can be executed from the command lineuse
directive$ dotctl use <PATH-TO-CONFIG-FILE>
~/.dotctl
for future useTo setup an application configuration:
$ dotctl setup <CONFIG-NAME>
To tear down an application configuration:
$ dotctl teardown <CONFIG-NAME>
nvim
or ssh
)