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
python scripts and other files to generate induction encoder PCBs in Kicad

induction_encoder python scripts and other files to generate induction encoder PCBs in Kicad Targeting the Renesas IPS2200 encoder chips.

Taylor Alexander 8 Feb 16, 2022
Jogo em redes similar ao clássico pedra papel e tesoura

Batalha Tática Tecnologias de Redes de Computadores-A-N-JOGOS DIGITAIS Professor Fabio Henrique Cabrini Alunos: Eric Henrique de Oliveira Silva - RA 1

Eric Henrique de Oliveira Silva 1 Dec 01, 2021
Custom python interface to xstan (a modified (cmd)stan)

Custom python interface to xstan (a modified (cmd)stan) Use at your own risk, currently everything is very brittle and will probably be changed in the

2 Dec 16, 2021
An open-source Python project series where beginners can contribute and practice coding.

Python Mini Projects A collection of easy Python small projects to help you improve your programming skills. Table Of Contents Aim Of The Project Cont

Leah Nguyen 491 Jan 04, 2023
Auto check in via GitHub Actions

因为本人毕业离校,本项目交由在校的@hfut-xyc同学接手,请访问hfut-xyc/hfut_auto_check-in获得最新的脚本 本项目遵从GPLv2协定,Copyright (C) 2021, Fw[a]rd 免责声明 根据GPL协定,我、本项目的作者,不会对您使用这个脚本带来的任何后果

Fw[a]rd 3 Jun 27, 2021
Alfred 4 Workflow to search through your maintained/watched/starred GitHub repositories.

Alfred 4 Workflow to search through your maintained/watched/starred GitHub repositories. Setup This workflow requires a number of Python modules. Thes

Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs 1 Oct 14, 2022
Sathal's Python Projects Repository

Sathal's Python Projects Repository Purpose and Motivation I come from a mainly C Programming Language background and have previous classroom experien

Sam 1 Oct 20, 2021
Backups made easy, automated, monitored and SECURED with an audited encryption

Backup Controller Backups made easy, automated, monitored and SECURED with an audited encryption. Schedules backup tasks executed by Backup Maker, upl

RiotKit 1 Jan 30, 2022
poro is a LCU interface to change some lol's options.

poro is a LCU interface to change some lol's options. with this program you can: change your profile icon change your profiel background image ch

João Dematte 2 Jan 05, 2022
Open HW & SW for Scanning Electron Microscopes

OpenSEM Project Status: Preliminary The purpose of this project is to create a modern and open-source hardware and software platform for using vintage

Steven Lovegrove 7 Nov 01, 2022
Python solutions to Codeforces problems

CodeForces This repository is dedicated to my Python solutions for CodeForces problems. Feel free to copy, contribute and/or comment. If you find any

Shukur Sabzaliev 15 Dec 20, 2022
Model Quantization Benchmark

MQBench Update V0.0.2 Fix academic prepare setting. More deployable prepare process. Fix setup.py. Fix deploy on SNPE. Fix convert_deploy bug. Add Qua

500 Jan 06, 2023
flake8 plugin which checks that there is no use of sleep in the code.

flake8-sleep flake8 plugin which checks for use of sleep function. installation Using Pypi: pip install flake8-sleep flake8 codes Code Description SLP

1 Nov 26, 2021
An open letter in support of Richard Matthew Stallman being reinstated by the Free Software Foundation

An open letter in support of RMS. To sign, click here and name the file username.yaml (replace username with your name) with the following content

2.4k Jan 07, 2023
gwcheck is a tool to check .gnu.warning.* sections in ELF object files and display their content.

gwcheck Description gwcheck is a tool to check .gnu.warning.* sections in ELF object files and display their content. For an introduction to .gnu.warn

Frederic Cambus 11 Oct 28, 2022
Python / C++ based particle reaction-diffusion simulator

ReaDDy (Reaction Diffusion Dynamics) is an open source particle based reaction-diffusion simulator that can be configured and run via Python. Currentl

ReaDDy 46 Dec 09, 2022
Python Commodore BBS multi-client

python-cbm-bbs-petscii Python Commodore BBS multi-client This is intended for commodore 64, c128 and most commodore compatible machines (as the new Co

7 Sep 16, 2022
A water drinking notification every hour to keep you healthy while coding :)

Water_Notification A water drinking notification every hour to keep you healthy while coding. 💧 💧 Stay Hydrated Stay Healthy 💧 💧 Authors @CrazyCat

Arghya Banerjee 1 Dec 22, 2021
Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like.

Advent Of Code 2021 - Python English Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels th

Coral Izquierdo Muñiz 2 Jan 09, 2022
DRF magic links

drf-magic-links Installation pip install drf-magic-links Add URL patterns # urls.py

Dmitry Kalinin 1 Nov 07, 2021