Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sanity/multiconf
Easily generate different versions of config files
https://github.com/sanity/multiconf
Last synced: about 1 month ago
JSON representation
Easily generate different versions of config files
- Host: GitHub
- URL: https://github.com/sanity/multiconf
- Owner: sanity
- License: gpl-3.0
- Created: 2022-02-12T12:23:16.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-02-16T22:57:16.000Z (over 2 years ago)
- Last Synced: 2024-09-14T09:35:05.286Z (2 months ago)
- Language: Rust
- Homepage: https://crates.io/crates/multiconf
- Size: 44.9 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MultiConf
A command line tool for easily generating multiple versions of a configuration file
from a single template.## Why?
I'm a big fan of the [i3 window manager](https://i3wm.org/), and I use it on several
linux desktops and laptops. While I mostly want the same i3 configuration across
all of these computers, some require different variations.I created multiconf to make it easy to generate multiple variations of a config file.
## How to install
1. Install cargo (the Rust package manager):
```bash
$ curl https://sh.rustup.rs -sSf | sh
```
2. Install multiconf:
```bash
$ cargo install multiconf
```## How to use
Create a file called `base.txt`:
```
global config 1
global config 2
dog$>>canine config 1
cat$>>feline config 1
global config 3
```Then create `dog.txt` from `base.txt`:
```bash
$ multiconf --choice dog --input base.txt --output dog.txt
```This will contain:
```
global config 1
global config 2
canine config 1
global config 3
```If you want dog.txt to be automatically updated every time base.txt changes, use:
```bash
$ multiconf --choice dog --input base.txt --output dog.txt --watch
```## Example with i3 config file
Here is the line I use in my i3 config so I can have different versions depending on the hostname of the computer:
```bash
exec --no-startup-id multiconf \
--choice `hostname` \
--input ~/Dropbox/code/linux-cfg/i3/config \
--output ~/.config/i3/config \
--watch
```Here are some example lines from my i3 config, which I share between machines
using Dropbox:```
# This font is widely installed, provides lots of unicode glyphs, right-to-left
# text rendering and scalability on retina/hidpi displays (thanks to pango).
technic$>>font pango:DejaVu Sans Mono 12
pocket$>>font pango:DejaVu Sans Mono 16
framework$>>font pango:DejaVu Sans Mono 15
````technic`, `pocket`, and `framework` are the hostnames of my three linux computers.
## Command line parameters
```
multiconf [version]
Easily generate different versions of config filesUSAGE:
multiconf [OPTIONS] --choiceOPTIONS:
-c, --choice The selected
-h, --help Print help information
-i, --input The input file, or stdin if not specified
-o, --output The output file, or stdout if not specified
-s, --separator Separates choice from the line chosen [default: $>>]
-V, --version Print version information
-w, --watch Watch the input file for changes and update the output file when
it does
```