config editor · bash + javascript · runs anywhere

confix

A small, dependency-free tool that edits configuration files in place with a tiny command grammar — update, add, comment, uncomment, or delete keys. Ships as a bash script and a zero-dependency JavaScript library + CLI (@budhash/confix), kept identical by a shared spec.

live

Runs confix's command logic client-side — a JavaScript port of the bash script, validated against its output. Nothing is sent anywhere.

configpaste your file
commandsone per line · key=val · >key · >key=val · <key · !key
output
tool
install

With Homebrew (macOS / Linux):

brew install budhash/tools/confix

Or grab the latest released script (branch-independent) and make it executable:

curl -kL https://github.com/budhash/confix/releases/latest/download/confix > confix
chmod +x confix
options
  • -finput file (or -f - / omit to read stdin)
  • -ooutput file; -o- prints to stdout, leaving the input untouched
  • -ddry run — print a unified diff, write nothing
  • -eread commands from a file (one per line)
  • -sseparator character (default =)
  • -ccomment character (default #)
example
# update a port, enable a flag, comment one out, add a timeout
confix -f app.properties "port=9090" ">debug=true" "<log.level" ">timeout=30"
commands

Each argument (or each line of a -e file) is one command; the first character selects the operation. Key/value split on the first =, independent of the file separator.

key=valueupdate an existing key (no-op if the key is absent)
>key=valueset the key, appending it to the file if absent
>keyuncomment an existing key
<keycomment out an existing key (the line is kept)
!keydelete the key's line entirely (active or commented)

More examples and the full reference are in the README.

javascript — @budhash/confix

The same behavior as a zero-dependency npm package: a library (Node and the browser) and a cross-platform CLI that mirrors the flags above. Both track the bash tool via a shared spec and conformance suite.

npm i @budhash/confix
// library — text in, text out
import { applyBlock } from "@budhash/confix";
applyBlock(text, "port=9090\n>debug=true\n!obsolete", { sep: "=" });
# CLI — same flags as the script, works on Windows too
npx @budhash/confix -f app.properties "port=9090" ">debug=true"