Crates.io | confmg |
lib.rs | confmg |
version | 2.0.0 |
source | src |
created_at | 2023-09-10 13:08:25.697657 |
updated_at | 2024-03-07 14:24:23.145752 |
description | Tool for managing personal config files on different platforms. |
homepage | |
repository | https://github.com/pablo-ng/confmg |
max_upload_size | |
id | 968802 |
size | 34,613 |
Confmg allows you to have all your config files stored in a folder that is synced to a remote server (e.g. GitHub, Cloud Storage, ...) and selectively copy them to the right place on different platforms.
For example, you can have your .gitconfig
file saved in the folder ~/.confmg
, which is under a private repository on GitHub. The same folder contains a confmg.json
file that includes an entry with the label "git" and the respective file location (usually ~/.gitconfig
). Then, with only one command you can copy this .gitconfig
file into it's right location. Other config files can have different locations depending on the platform but always the same content (e.g. VSCode configuration is under ~/.config/Code/User/settings.json
on Linux and ~/AppData/Roaming/Code/User/settings.json
on Windows).
If you have the Rust toolchain installed you can simply run cargo install confmg
. Otherwise you can download a binary from the Releases section.
The configuration for confmg is written in a JSON file. The default path is ~/.confmg/confmg.json
, but it can be overwritten with the -c, --config-file
argument or the CONFMG_CONFIG
environment variable. The config file should be written in the following structure:
{
"<Label for this config>": {
"source": "<Path to the source config file relative to this file (usually located in the same folder)>",
"targets": {
"windows": "<Path to the target config file on Windows (optional)>",
"linux": "<Path to the target config file on Linux (optional)>",
"macos": "<Path to the target config file on MacOS (optional)>"
}
}
}
Here is an example confmg config file:
{
"git": {
"source": ".gitconfig",
"targets": {
"linux": "~/.gitconfig",
"macos": "~/.gitconfig",
"windows": "~/.gitconfig"
}
},
"bashrc": {
"source": ".bashrc",
"targets": {
"linux": "~/.bashrc",
"macos": "~/.bashrc"
}
},
"vscode_settings": {
"source": "vscode/settings.json",
"targets": {
"linux": "~/.config/Code/User/settings.json",
"macos": "~/Library/Application Support/Code/User/settings.json",
"windows": "~/AppData/Roaming/Code/User/settings.json"
}
}
}
confmg apply-source
. All config files then get copied to their right destination.confmg diff <LABEL>
to see the changes and confmg apply-target <LABEL>
to overwrite the file in the confmg folder with the changed one.confmg edit-config
to open the confmg config file in your default editor.confmg edit-source <LABEL>
or confmg edit-target <LABEL>
to open the source or target file for a particular config in your default editor.confmg --help
for full documentation.