confwhich/README.md

32 lines
1.5 KiB
Markdown
Raw Normal View History

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 `confwhich`process 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.
```bash
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`.