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...
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 .

Neovim Configuration Manager (Swap/Backup/Try Configurations Easily)
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

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

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

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

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

Rust API Server: A versatile template for building RESTful interfaces, designed for simplicity in setup and configuration using the Rust programming language.
Rust API Server: A versatile template for building RESTful interfaces, designed for simplicity in setup and configuration using the Rust programming language.

RUST API SERVER Introduction Welcome to the Rust API Server! This server provides a simple REST interface for your applications. This README will guid

Owner
Ian Clarke
Degree in CS & AI. Creator of freenetproject.org, kweb.io, 33mail.com.
Ian Clarke
JiaShiwen 12 Nov 5, 2022
Rust File Management CLI is a command-line tool written in Rust that provides essential file management functionalities. Whether you're working with files or directories, this tool simplifies common file operations with ease.

Rust FileOps Rust File Management CLI is a command-line tool written in Rust that provides essential file management functionalities. Whether you're w

Harikesh Ranjan Sinha 5 May 2, 2024
A CLI to easily switch between multiple Neovim configuration environments, written in Rust

Neovim Configuration Switcher Neovim Configuration Switcher (short nvims) is a CLI to easily switch between multiple Neovim configuration environments

Nhan Pham 3 Mar 30, 2024
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
KAIVM is a multiplatform Command Line Interface (CLI) designed to simplify the process of downloading, managing, configuring, and running different versions of Shinkai Node

KAIVM - Shinkai Version Manager KAIVM is a multiplatform Command Line Interface (CLI) designed to simplify the process of downloading, managing, confi

Alfredo Gallardo 7 May 1, 2024
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
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
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
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