Simple dotfile pre-processor with a per-file configuration

Overview

ix

(eeks) Simple dotfile pre-processor with a per-file configuration



Summary (TL;DR)

  • ix.py is all you need
  • config is an ini file.
  • files to be processed must contain #: ix-config within the first 20 lines.
  • more options can be specified per file after the #: ix-config.
  • variables to be processed are defined as follows #{{ section.variable }}.
  • default config directory ~/.config/ix/ixrc (overwrite with -c)
  • default parse directory ~/dots (overwrite with -d)
  • full docs here



The Long Version

What?

pre-processor: a program that processes its input data to produce output that is used as input to another program.

This is a tool that allows you to define placeholders within your files (such as ${{ colors.background }}) and then have them replaced with a value you've defined somewhere else whenever you please. Allowing you to stay worryless about where that value might be stored since you know it can only be stored in one place: ixrc.




Why?

I've always had a lot of environment variables scattered all around the place. It's hard to keep track of everything in this way.

ix is an attempt at simplifying all of that by providing a single, central file that contains every single variable you might think of, or would need: colors, paths, editor, etc. All defined and controlled by you.

Aside from that, it also provides some nifty addons on top of the normal "find and replace" behaviour to allow you to customise exactly what happens to each file it reads, giving you even more control and structure.




How does it work?

There's a total of 2 pieces to the puzzle:

  1. The configuration that contains everything. By default ix will look for it in ~/.config/ix/ixrc but can be easily overwritten with the -c flag.
  2. The actual preprocessor script, the python file.

When you run the script, it'll assume everything you want to parse is in ~/dots, which is probably wrong so you'll want to overwrite that. You can do that with the -d flag and specifying a new path.

ix will recursively read through the given directory and find any files that contain the ix declaration (which looks like this #: ix-config). Basically a comment followed by a colon. This //: works too, and this /*:, even this --:. If it doesn't work, then it can be added.

Note that the definition needs to be within the first 20 lines of the file otherwise ix will ignore that file.

The lines after the definition can contain more information about how ix should handle this specific file. These are the simple addons I mentioned earlier. For example:

#: ix-config
#: to: /etc/whatever/

...
Check the full list of available options in the documentation section

Here we tell ix to store the file inside /etc/whatever after it's been parsed, under the same name as the original file. Notice that the information related to ix is directly after the definition. This matters.


Concrete example

Assume we have a configuration that looks like this:

[colors]
blue = blue
red = green

We might then have a bash script that executes something and we want those colors to be given as parameters. Something like this:

#!/usr/bin/env bash
# magic.sh


#: ix-config
#: to: $HOME/.config/executable/executablerc

# ...

executable --color #{{ colors.blue }} # and so on...
# ...

Now when we run ix, it'll see that the magic.sh file is something that needs parsing, it'll make sure to replace everything within the #{{ }} characters with the value defined in the configuration, giving us the following file:

#!/usr/bin/env bash
# magic.sh

# ...

executable --color blue # and so on...
#...

Notice that it got rid of the ix definitions as well.


You might also like...
A minimal configuration for a dockerized kafka project.

Docker Kafka Quickstart A minimal configuration for a dockerized kafka project. Usage: Run this command to build kafka and zookeeper containers, and c

 Shai-Hulud - A qtile configuration for the (spice) masses
Shai-Hulud - A qtile configuration for the (spice) masses

Shai-Hulud - A qtile configuration for the (spice) masses Installation Notes These dotfiles are set up to use GNU stow for installation. To install, f

Lightweight library for accessing data and configuration

accsr This lightweight library contains utilities for managing, loading, uploading, opening and generally wrangling data and configurations. It was ba

An AddOn storing wireguard configuration

Wireguard Database Connector Overview Development Status: 0.1.7 (alpha) First of all, I'd like to thank Jared McKnight for wireguard who inspired me t

A Python3 script to decode an encoded VBScript file, often seen with a .vbe file extension

vbe-decoder.py Decode one or multiple encoded VBScript files, often seen with a .vbe file extension. Usage usage: vbe-decoder.py [-h] [-o output] file

This app converts an pdf file into the audio file.

PDF-to-Audio This app takes an pdf as an input and convert it into audio, and the library text-to-speech starts speaking the preffered page given in t

Fetch data from an excel file and create HTML file

excel-to-html Problem Statement! - Fetch data from excel file and create html file Excel.xlsx file contain the information.in multiple rows that is ne

JD-backup is an advanced Python script, that will extract all links from a jDownloader 2 file list and export them to a text file.

JD-backup is an advanced Python script, that will extract all links from a jDownloader 2 file list and export them to a text file.

An example file showing a simple endpoints like a login/logout function and maybe some others.

Flask API Example An example project showing a simple endpoints like a login/logout function and maybe some others. How to use: Open up your IDE (or u

Releases(v1.0)
Owner
Poly
​ ​​/​​​/ ​/ ​ / |​ ​ /​​​/​​​/ ​ |
Poly
Bad Apple printed out on the console with Python!

bad-apple Bad Apple printed out on the console with Python! Preface A word of disclaimer, while the final code is somewhat original, this project is a

CalvinLoke 186 Dec 01, 2022
Python AVL Protocols Server for Codec 8 and Codec 8 Extended Protocols

pycodecs Package provides python AVL Protocols Server for Codec 8 and Codec 8 Extended Protocols This package will parse the AVL Data and log it in hu

Vardharajulu K N 2 Jun 21, 2022
Unofficial Valorant documentation and tools for third party developers

Valorant Third Party Toolkit This repository contains unofficial Valorant documentation and tools for third party developers. Our goal is to centraliz

Noah Kim 20 Dec 21, 2022
Simple tooling for marking deprecated functions or classes and re-routing to the new successors' instance.

pyDeprecate Simple tooling for marking deprecated functions or classes and re-routing to the new successors' instance

Jirka Borovec 45 Nov 24, 2022
IDA Pro plugin that shows the comments in a database

ShowComments A Simple IDA Pro plugin that shows the comments in a database Installation Copy the file showcomments.py to the plugins folder under IDA

Fernando Mercês 32 Dec 10, 2022
YourCity is a platform to match people to their prefect city.

YourCity YourCity is a city matching App that matches users to their ideal city. It is a fullstack React App made with a Redux state manager and a bac

Nico G Pierson 6 Sep 25, 2021
Myrepo - A tool to create your own Arch Linux repository

myrepo A (experimental) tool to create your own Arch Linux repository Example We

Anton Hvornum 5 Feb 19, 2022
Addon for Blender 2.8+ that automatically creates NLA tracks for all animations. Useful for GLTF export.

PushDownAll An addon for Blender 2.8+ that runs Push Down on all animations, creating NLA tracks for each. This is useful if you have an object with m

Cory Petkovsek 16 Oct 06, 2022
Users can read others' travel journeys in addition to being able to upload and delete posts detailing their own experiences

Users can read others' travel journeys in addition to being able to upload and delete posts detailing their own experiences! Posts are organized by country and destination within that country.

Christopher Zeas 1 Feb 03, 2022
🍬️🦇️ Open source Trick or Treat! 🦇️🍬️

Open Source Halloween! What's an easy way to have fun, and celebrate an open source Halloween? Open source trick or treating, of course! The repositor

Research Software Engineers 3 Oct 18, 2021
Includes Chapters for Python Crash Course session.

python-crash-course Includes Chapters for Python Crash Course session. What will you learn: Python Essentials Creating Server Writing REST API Writing

Vineet Rao 3 Feb 17, 2021
The best way to learn Python is by practicing examples. The repository contains examples of basic concepts of Python. You are advised to take the references from these examples and try them on your own.

90_Python_Exercises_and_Challenges The best way to learn Python is by practicing examples. This repository contains the examples on basic and advance

Milaan Parmar / Милан пармар / _米兰 帕尔马 205 Jan 06, 2023
A dead-simple service that notifies you when something goes down.

Totmannschalter Totmannschalter (German for dead man's switch) is a simple service that notifies you when it has not received any message from a servi

1 Dec 20, 2021
Tools for teachers and students using nng (Natural Number Game)

nngtools Usage Place your nngsave.json to the directory in which you want to extract the level files. Place nngmap.json on the same directory. Run nng

Thanos Tsouanas 1 Dec 12, 2021
Python program that generates random user from API

RandomUserPy Author kirito sate #modules used requests, json, tkinter, PIL, urllib, io, install requests and PIL modules from pypi pip install Pillow

kiritosate 1 Jan 05, 2022
Tools for collecting social media data around focal events

Social Media Focal Events The focalevents codebase provides tools for organizing data collected around focal events on social media. It is often diffi

Ryan Gallagher 80 Nov 28, 2022
Strawberry Benchmark With Python

Strawberry benchmarks these benchmarks have been made to compare the performance of dataloaders and joined database queries. How to use You can run th

Doctor 4 Feb 23, 2022
A smart personal companion and health assistant.

Steps to Install : Clone the repository Go to ResQ-Sources Execute ResQ-Lite.py --: Manual Controls : DanceRobot.py --: You can call functions like fo

Tuhinadri Banerjee 1 May 25, 2022
a pull switch (or BYO button) that gets you out of video calls, quick

zoomout a pull switch (or BYO button) that gets you out of video calls, quick. As seen on Twitter System compatibility Tested on macOS Catalina (10.15

Brian Moore 422 Dec 30, 2022
A python script based on OpenCV-Python, you can automatically hang up the Destiny 2 Throne to get the Dawning Essence.

A python script based on OpenCV-Python, you can automatically hang up the Destiny 2 Throne to get the Dawning Essence.

1 Dec 19, 2021