Partoska Laboratory
$ bikiniv2.0.2

Bikini

A small INI query tool and C library for macOS, Linux, and Windows. Read, list, merge, set, and delete INI values from the command line, so your shell scripts no longer need sed or awk.

INI Query ToolC99 LibraryOpen Source (MIT)macOS · Linux · Windows
bikini — terminal

# Install with npm (or Homebrew, Scoop, packages).

$ npm install -g @partoska/bikini

# Read one value.

$ bikini server.port app.ini
8080

# List the keys of a section.

$ bikini -k server app.ini
host
port

# Change a value in the file.

$ bikini -w -s 9090 server.port app.ini

Why Bikini?

Small and Dependency-Free

One C99 tool and one C99 library that need nothing but the standard C library. Builds with GCC, Clang, or MSVC and runs from a Raspberry Pi to a Windows desktop.

Query What You Need

Ask for the whole document with ., one section with SECTION, or one raw value with SECTION.KEY. Put names that contain dots in quotes.

Lists for Shell Loops

The -k parameter lists the sections of a document or the keys of a section, one per line, ready for a for loop.

Repeated Sections and Keys

With the --multi parameter, a section or key may repeat, as in lists of process arguments. Address each repeat by its index, such as web[0].Arg[1], or all of them with [*].

Merge Layered Configs

Give several files and Bikini merges them in order. Later values replace earlier ones, so local overrides sit on top of shared defaults.

Set and Delete

Set keys with the -s parameter and delete keys or sections with the -d parameter. Print the result, or write it back to the file with the -w parameter.

Exit Codes for Scripts

0 found, 1 not found, 2 usage or input error. Errors go to standard error, so standard output holds only the answer.

Valid INI Output

Sections and documents print as normalized INI. Pipe one bikini into another, or save the output as a new file.

Your Delimiter

Output writes key = value by default. Pick another delimiter with the --delimiter parameter, such as = for key=value, to keep the style of the program that reads the file.

Ready for AI Agents

Bikini ships with an agent skill. Install it with one command, and AI coding agents such as Claude Code and Codex can read and edit your INI files with exact commands.

$ npx skills add partoska/bikini
Get the Bikini skill

One Tool, One Library

The bikini command is a thin layer over libbikini. Use the command in shell scripts and pipelines, or link the library into your own C program.

Command-Line Tool

Reads files or standard input, prints exactly what a query selects, and edits keys and sections. Made for shell scripts, Makefiles, and CI jobs.

$ bikini server.port app.ini

C Library

Reads and writes the common INI dialect and keeps sections and keys in file order. It never prints anything: errors are stored in the document with their line number.

#include <bikini.h>

Quick Start

Go from install to reading and changing a config file in five steps.

  1. Install bikini

    Install the CLI and check the version. Prefer Homebrew, Scoop, or a native package? See the install options.

    $ npm install -g @partoska/bikini
    $ bikini -V
  2. Create a config file

    Write a small INI file to try the queries on. Any existing .ini, .cfg, or .conf file with sections works too.

    $ printf '[server]\nhost = example.com\nport = 8080\n' > app.ini
  3. Read a value

    Print one raw value, then a whole section as INI text.

    $ bikini server.port app.ini
    $ bikini server app.ini
  4. List the names

    List the sections of the document with ., or the keys of one section.

    $ bikini -k . app.ini
    $ bikini -k server app.ini
  5. Change a value

    Set a new value and write it back to the file with the -w parameter, then read it again.

    $ bikini -w -s 9090 server.port app.ini
    $ bikini server.port app.ini

Examples

Print the whole document, one section, or one value. A whole section name wins over a split at the dot, and the key otherwise follows the last dot. Quote names when a key contains a dot, and add the -i parameter to ignore case.

app.ini
; Comments take a whole line and start with ; or #.[server]host = example.comport = 8080debug = true [database.primary]host = db.localmax-connections = 100 [logging]handler.file = /var/log/app.loglevel = info
$ bikini . app.ini
$ bikini server app.ini
$ bikini server.port app.ini
$ bikini database.primary.max-connections app.ini
$ bikini 'logging."handler.file"' app.ini
$ cat app.ini | bikini -i SERVER.HOST

More options are in the documentation.

Install

Pick the method that fits your system. Every option installs the same bikini tool.

$ brew install partoska/tap/bikini

For macOS and Linux on x64 and ARM64.

Commands use the latest version, 2.0.2. See the release page for all files and SHA256 checksums.

Add the AI Agent Skill

Let AI coding agents such as Claude Code and Codex run bikini for you. The installer adds the Bikini skill to the skills directory of your agent. In Claude, you can also upload bikini_2.0.2_skill.zip from the release page as a custom skill. Install bikini itself first.

$ npx skills add partoska/bikini

Reference

Run bikini [OPTIONS] [QUERY] [FILE...]. It reads every FILE in order, or standard input when there is none or the file is -. Run bikini -h for the built-in help.

Queries

.
The whole document, normalized (default).
SECTION
One section, as INI text.
SECTION.KEY
The raw value of a key.
"NAME"
A quoted section or key name, which may contain dots. Inside quotes, \" and \\ escape.
NAME[N], [*]
With --multi: repeat N of a name, counted from 0, or every repeat with [*]. Every name needs one, as in SECTION[N].KEY[M].

Exit status

0
Found, or the edit worked.
1
Not found, including a delete of something that is not there, or a --multi set of a value that does not exist.
2
Usage or input error, including INI syntax errors with their line on standard error.

Options

-k, --keys
List the sections of the document, or the keys of SECTION.
-s, --set VALUE
Set SECTION.KEY to the value and print the document. With --multi, only replace an existing value.
--add VALUE
With --multi: add the value after the last one of SECTION[N].KEY, or start a new section when N is one past the last.
-d, --delete
Delete SECTION or SECTION.KEY and print the document. With --multi, [*] deletes every repeat.
-w, --write
Write the edit back to FILE instead of printing it. Needs exactly one file.
-i, --ignore-case
Match sections and keys case-insensitively (ASCII).
--multi
Allow repeated sections and keys, and join several files as if they were one.
--delimiter TEXT
Write the text between key and value: = or : with optional blanks.
-h, --help
Show the help.
-V, --version
Show the version.

Library

bkInit, bkDestroy
Create and free a document. The flag BK_FICASE makes names case-insensitive and BK_FMULTI allows repeats.
bkLoad, bkSave
Load a document from a file, or save it to a file.
bkRead, bkWrite
Pull or push the text through your own callbacks: standard input, a socket, or memory.
bkParse
Parse INI text from a string.
bkGet, bkSet
Read or set the value of a key. Setting adds the section and the key when missing.
bkRemove
Delete a key. bkSectionRemove deletes a whole section.
bkSectionAt
Walk the sections in document order. bkSectionFind finds one by name.
bkKeyAt, bkValueAt
Walk the keys and values of a section in document order.
bkGetNth, bkAdd
With BK_FMULTI, read a repeat by its index or add another value. Every function ending in Nth takes such an index.
bkSetDelimiter
Choose what goes between key and value when the document is written.
bkError
Get the last error with its status, line, and message.

See bikini.h for the whole API. Include bikini.h and link with pkg-config --cflags --libs bikini.

Use Cases

Scripts and Operations

  • →Read settings from INI files in shell scripts, Makefiles, and CI jobs without sed or awk.
  • →Put local overrides on top of shared defaults and print the merged result.
  • →Update one key in a config file during deployment or provisioning.

Development

  • →Add INI configuration to a C or C++ program with one small, dependency-free library.
  • →Read configuration from memory, a socket, or standard input through stream callbacks.
  • →Let an AI coding assistant read and change config files with exact commands instead of text edits.

Technical Specifications

LanguageC99
LicenseMIT
Version2.0.2
PlatformmacOS 11+, Linux (x64, ARM64, ARMv6+), Windows (x64, ARM64)
DependenciesStandard C library
Build SystemCMake 3.20+ or Make

Read your config, not your regexes.

Install Bikini in one command and read your first INI value in seconds.

View the source on GitHub, get the package on npm, read the documentation, or add the AI agent skill.