Poljot is a shell configuration manager that proposes organizing related settings around use cases. It keeps configuration in one tree and emits the output needed by a requested target.
Use cases are an organizational approach, not a requirement. A configuration
can group settings by any logic and target .profile, .bashrc, or any
other file that consumes the generated output. The implementation is
deliberately small: it provides targeted sections and text output. Every
*.conf file can group related settings for one or more targets.
Poljot is a small tool with a deliberately focused implementation. It reads target sections and writes their contents to standard output. Further additions can focus on automated tests and distributable packages without changing this core behavior. When the output is used as shell code, review configuration files before enabling them in a shell startup file.
Add one sourcing line to each startup file that should receive configuration.
For .profile, use the POSIX-compatible form:
# ~/.profile
eval "$(poljot .profile)"For Bash .bashrc, use process substitution:
# ~/.bashrc
. <(poljot .bashrc)Target names are written after the poljot: prefix. They can refer to any
target that consumes generated output:
eval "$(poljot target-name)"The process-substitution form requires Bash or another compatible shell.
See Shell Compatibility for distribution-specific shell and
process-substitution details.
A configuration file can group related startup instructions:
[poljot:.profile]
export EDITOR=vi
export PAGER=less
export PATH="$HOME/bin:$PATH"
[poljot:.bashrc]
alias ll='ls -alF'
alias gs='git status'
. /etc/bash_completion
. "$HOME/.config/my-shell/aliases.sh"The target section is copied as-is. This is the place for shell syntax, including comments, variable expansion, source commands, conditionals, aliases, and functions.
poljot TARGET reads these files in order:
${HOME}/.config/poljot/poljot.conf- Every matching
${HOME}/.config/poljot/conf.d/*.conffile, in lexical filename order
Neither configuration source is required.
For each file, Poljot selects sections whose target exactly matches TARGET.
The supported section form is:
[poljot:TARGET]- Prints each following line unchanged until another section starts.
Sections for other targets are ignored. The generated output can be consumed by the target file or process that requested it.
The main configuration file and additional configuration files can be organized like this:
~/.config/poljot/poljot.conf
~/.config/poljot/conf.d/20-sdkman.conf
~/.config/poljot/conf.d/60-environment.conf
~/.config/poljot/conf.d/70-aliases.conf
All additional configuration files are processed after poljot.conf and
sorted by their filenames. If multiple matching sections emit the same setting,
the resulting shell code follows that order, so later commands can override
earlier ones.
Poljot is distributed as a single POSIX shell script. Place poljot on your
PATH and make sure it is executable. For a user-local installation, run:
$ install -m 0755 poljot "$HOME/.local/bin/poljot"For a system-wide installation, install it into /usr/local/bin as root:
# install -m 0755 poljot /usr/local/bin/poljotThe destination directory must already exist and be included in PATH.
No installer or package release is provided yet.
Runtime dependencies are:
- a POSIX-compatible
sh
The Bash process-substitution integration requires Bash or another compatible
shell. The command-substitution and eval integration works with POSIX
shells and does not require Bash.
The poljot program is written for a POSIX-compatible sh. The
distribution default for /bin/sh determines whether the process-substitution
example is available:
| Distribution family | Typical /bin/sh |
Version family | Process substitution |
|---|---|---|---|
| Debian, Ubuntu, Linux Mint | dash |
0.5.x |
Not supported by default |
| Fedora | bash |
5.x |
Supported |
| RHEL and CentOS Stream | bash |
4.x or 5.x |
Supported |
| Arch Linux | bash |
5.x |
Supported |
| openSUSE | bash |
5.x |
Supported |
| Alpine Linux | BusyBox ash |
1.3x |
Not supported by default |
The exact shell version depends on the distribution release and installed
packages. POSIX does not define process substitution. Use the
command-substitution and eval form above when /bin/sh is dash,
BusyBox ash, or another shell without process substitution. Both forms
execute the generated code in the current shell, which allows variables,
aliases, and functions to persist in the startup shell.
The active sh implementation can be inspected with:
$ readlink -f /bin/sh
/usr/bin/dashProcess-substitution support can be tested with:
$ /bin/sh -c 'cat <(printf x)' >/dev/null 2>&1 && echo supported || echo unsupportedSet POLJOT_DEBUG=1 to include the source configuration filename in the
generated output:
$ POLJOT_DEBUG=1 poljot .bashrcThe command writes generated output to standard output. Usage errors, such as omitting the target, are written to standard error.
Missing or unreadable configuration files and sections for other targets are silently ignored. Debug mode shows readable configuration files being processed, but it does not validate section syntax or report skipped entries.
Poljot is distributed under the MIT License. See LICENSE.