Go to file
2024-05-14 10:58:06 +02:00
nix implement confwhich 2024-05-14 10:52:31 +02:00
src implement confwhich 2024-05-14 10:52:31 +02:00
.gitignore cleanup ide garbage 2024-05-14 10:58:06 +02:00
Cargo.lock implement confwhich 2024-05-14 10:52:31 +02:00
Cargo.toml implement confwhich 2024-05-14 10:52:31 +02:00
flake.lock implement confwhich 2024-05-14 10:52:31 +02:00
flake.nix implement confwhich 2024-05-14 10:52:31 +02:00
LICENSE implement confwhich 2024-05-14 10:52:31 +02:00
README.md implement confwhich 2024-05-14 10:52:31 +02:00
rust-toolchain.toml implement confwhich 2024-05-14 10:52:31 +02:00
treefmt.toml implement confwhich 2024-05-14 10:52:31 +02:00

What's this?

Confwhich is an attempt to make working with XDG_CONFIG_DIRS and XDG_CONFIG_HOME easier by providing some nice utility functions.

Useage

Usage: confwhich [OPTIONS] <SEARCH>

Arguments:
  <SEARCH>  The config prefix to search for

Options:
      --skip-home                    Skip directories in XDG_CONFIG_DIRS that start with the home directory
  -a, --all                          Print all matches in XDG_CONFIG_DIRS, not just the first
      --from-process <FROM_PROCESS>  Read the environment from a process by pid instead of regular environment [default: -1]
      --show-tilde                   Output a tilde for HOME directory
  -h, --help                         Print help
  -V, --version                      Print version

Confwhich allows reading XDG_CONFIG_DIRS and XDG_CONFIG_HOME from a running process by provided process id, assuming the confwhichprocess is elevated enough to read the environ file at /proc/<pid>/environ. Potential useage might be e.g. confwhich --show-tilde --from-process $(pgrep alacritty | head -n 1) alacritty which will return ~/.config/alacritty.toml on my system.

Installing

Any system that can build rust applications can have confwhich.

git clone https://git.grimmauld.de/Grimmauld/confwhich.git
cd confwhich
cargo build --release

Alternatively, this project supports nix tooling. The included flake provides a module installing confwhich to system packages, but also a default package for nix run git+https://git.grimmauld.de/Grimmauld/confwhich.