A command line tool for easily generating multiple versions of a configuration file from a single template

Overview

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, 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):
$ curl https://sh.rustup.rs -sSf | sh
  1. Install multiconf:
$ 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:

$ 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:

$ 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:

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 files

USAGE:
    multiconf [OPTIONS] --choice 

OPTIONS:
    -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
You might also like...
Single File Assets is a file storage format for images

SFA (Rust) Single File Assets is a file storage format for images. The packed images are not guaranteed to be of same format because the format while

Application microframework with command-line option parsing, configuration, error handling, logging, and shell interactions
Application microframework with command-line option parsing, configuration, error handling, logging, and shell interactions

Abscissa is a microframework for building Rust applications (either CLI tools or network/web services), aiming to provide a large number of features w

Web-based tool that allows browsing and comparing symbol and type information of Microsoft Windows binaries across different versions of the OS.
Web-based tool that allows browsing and comparing symbol and type information of Microsoft Windows binaries across different versions of the OS.

WinDiff About WinDiff is an open-source web-based tool that allows browsing and comparing symbol and type information of Microsoft Windows binaries ac

A command line utility to easily make dank memes
A command line utility to easily make dank memes

meme-cli A command line utility to easily make dank memes. Yes, really. Installation cargo install meme-cli Alternatively, install from source using g

🧠 A command-line utility for switching git branches more easily. Switch branches interactively or use a fuzzy search to find that long-forgotten branch name.
🧠 A command-line utility for switching git branches more easily. Switch branches interactively or use a fuzzy search to find that long-forgotten branch name.

git-smart-checkout A git command extension for switching git branches more efficiently. About Interactively switch branches or fuzzy search for that f

CarLI is a framework for creating single-command and multi-command CLI applications in Rust

CarLI is a framework for creating single-command and multi-command CLI applications in Rust. The framework provides error and IO types better suited for the command line environment, especially in cases where unit testing is needed.

Command line tool to convert env variables beginning with user to a htpasswd file

envhtp This command line tool converts environment variables whose keys start with "user_" into htpasswd compatible username/password pairs. The goal

rpsc is a *nix command line tool to quickly search for file systems items matching varied criterions like permissions, extended attributes and much more.

rpsc rpsc is a *nix command line tool to quickly search for file systems items matching varied criterions like permissions, extended attributes and mu

Pink is a command-line tool inspired by the Unix man command.

Pink is a command-line tool inspired by the Unix man command. It displays custom-formatted text pages in the terminal using a subset of HTML-like tags.

Owner
Ian Clarke
Degree in CS & AI. Creator of freenetproject.org, kweb.io, 33mail.com.
Ian Clarke
Nvm - Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions

Node Version Manager Table of Contents Intro About Installing and Updating Install & Update Script Additional Notes Troubleshooting on Linux Troublesh

nvm.sh 63.8k Jan 7, 2023
A command-line tool aiming to upload the local image used in your markdown file to the GitHub repo and replace the local file path with the returned URL.

Pup A command line tool aiming to upload the local image used in your markdown file to the GitHub repo and replace the local file path with the return

SteveLau 11 Aug 17, 2022
RnR is a command-line tool to securely rename multiple files and directories that supports regular expressions

RnR is a command-line tool to securely rename multiple files and directories that supports regular expressions. Features Batch rename files and direct

Ismael González Valverde 219 Dec 31, 2022
CLI tool that make it easier to perform multiple lighthouse runs towards a single target and output the result in a plotable format.

Lighthouse Aggregator CLI tool that make it easier to perform multiple lighthouse runs towards a single target and output the result in a "plotable" f

Polestar 1 Jan 12, 2022
A command-line tool to easily kill processes running on a specified port.

killport killport is a command-line utility for killing processes listening on specific ports. It's designed to be simple, fast, and effective. The to

Francisco Jiménez Cabrera 6 Mar 29, 2023
tmplt is a command-line interface tool that allows you to quickly and easily set up project templates for various programming languages and frameworks

tmplt A User Friendly CLI Tool For Creating New Projects With Templates About tmplt is a command-line tool that lets users quickly create new projects

Humble Penguin 35 Apr 8, 2023
Small command-line tool to switch monitor inputs from command line

swmon Small command-line tool to switch monitor inputs from command line Installation git clone https://github.com/cr1901/swmon cargo install --path .

William D. Jones 5 Aug 20, 2022
Neovim Configuration Manager (Swap/Backup/Try Configurations Easily)

ncm-rs Neovim Configuration Manager (Swap/Backup/Try Configurations Easily) I created this package because I wanted to try out Lazyvim (which is why i

instance.id 4 Mar 5, 2023
A command line application which sets your wall paper with new image generating pollens once they arrive.

pollenwall Table of Contents pollenwall About Installation Binary releases Build from source Usage Command Line Arguments Running as a service MacOS L

Pollinations.AI 2 Jan 7, 2022