Short, focused reference for the CLI utilities implemented in this repository.
- trim: Skip the first N
<tu>(translation unit) elements in a TMX file and write the remainder to a new file. - concat: Merge multiple TMX files by appending their contents sequentially (no XML validation or deduplication).
- Build release binary: cargo build --release
- Build on MacOS: TARGET_CC=x86_64-linux-musl-gcc cargo build --release --target=x86_64-unknown-linux-musl
- Run locally for testing: cargo run --
-
Trim
- Command: tmx-utils trim <input.tmx> <output.tmx>
- Behavior:
- Skips the first N
<tu>elements ininput.tmx. - Writes remaining XML to
output.tmx. - Carefully avoids writing stray whitespace left by skipped elements.
- Errors surfaced via anyhow (exit on non‑zero).
- Skips the first N
-
Concat
- Command: tmx-utils concat <output.tmx> <input1.tmx> <input2.tmx> ...
- Behavior:
- Appends the contents of each input file into
output.tmxin order. - No XML structure merging, validation, or deduplication performed.
- Appends the contents of each input file into
-
Concat directory:
- Command: tmx-utils concat-dir <output.tmx> <input_directory>
- Behavior:
- Reads all
.tmxfiles frominput_directory. - Appends their contents into
output.tmxin alphanumeric order.
- Reads all
-
Filter:
- Command: tmx-utils filter <input.tmx> <output.tmx> <skipAuthor: true|false> <skipDocument: true|false> <skipContext: true|false>
- Behavior:
- Retains only
<tuv>elements matching the specified set of options. - Writes filtered XML to
output.tmx.
- Retains only
- Trim first 100 units: cargo run -- trim big.tmx trimmed.tmx 100
- Concatenate files: cargo run -- concat merged.tmx part1.tmx part2.tmx part3.tmx