LEPTRIS

CLI — leptris

A command-line XML tool that respects your pipe. Built by default with the C library (LEPTRIS_BUILD_CLI=ON), it speaks the same public API — nothing private.

Commands

parse — inspect a document
leptris parse document.xml
leptris parse document.xml --format json | head -3
leptris parse - < small.xml     # reads stdin
xpath — query a document
leptris xpath document.xml "//record[@id='1042']"
leptris xpath --count document.xml 'count(//item)'
format — pretty-print
leptris format --indent 4 < ugly.xml > pretty.xml
leptris format messy.xml --indent 2
version
leptris version

Contract

  • MECE output modes — XML, JSON, or text; one mode per invocation, no mixing.
  • Files or stdin — every reading subcommand accepts a path or -.
  • Exit codes — 0 on success, 1 on parse error or invalid usage. Pipe-friendly by design.
  • Layer contract — the CLI never touches XML structures directly; everything goes through the public API in src/include/. No internal includes under cli/.

Man pages and completions

Full man pages ship with the project — leptris(1),leptris-parse(1), leptris-xpath(1),leptris-format(1) — indocs/man of the leptris-ruby repository. Shell completions forbashand zshlive alongside them. Build man pages from source with-DLEPTRIS_BUILD_MAN_PAGES=ON.

Where next

This is the curated guide. The repositories are canonical: when this page and the repo disagree, the repo wins. Full documentation lives with the source.