Skip to content

Commit 9b760e6

Browse files
Prepare 0.6.0 release (#26)
## Summary - add agent-friendly key/value filter support and structured CLI execution options - add parser and end-to-end CLI coverage for argument handling, exit codes, and output contracts - bump Rust and NuGet package versions to 0.6.0 ## Validation - cargo fmt --all --check - cargo clippy --workspace --all-targets - cargo test --workspace
1 parent 20ad8e4 commit 9b760e6

14 files changed

Lines changed: 1531 additions & 104 deletions

File tree

Cargo.lock

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,26 @@ cirup --help
3131

3232
## Global options
3333

34-
- `-v`, `-vv`, ...: increase log verbosity.
34+
- `--output-format <jsonl|json|table>`: control stdout format. Default is `jsonl`.
35+
- `--dry-run`: compute results without writing output files. If a command normally writes to a file, the result is rendered to stdout instead.
36+
- `--check`: imply `--dry-run` and exit with code `2` when the command would produce changes.
37+
- `--summary`: print a structured execution summary instead of full result rows. Combine it with `--dry-run` for inspect-only workflows.
38+
- `--count-only`: print only the number of matching results to stdout.
39+
- `--key-filter <pattern>`: keep only results whose key matches a simple regex-style pattern. Repeatable. Supported syntax: literals, `^`, `$`, `.`, and `.*`.
40+
- `--value-filter <pattern>`: keep only results whose value matches the same simple regex-style syntax. Repeatable.
41+
- `--limit <n>`: keep only the first `n` matching results.
42+
- `--quiet`: only print errors to stderr.
43+
- `--log-level <error|warn|info|debug|trace>`: set stderr verbosity explicitly.
44+
- `-v`, `-vv`, ...: increase log verbosity starting from the default `warn` level.
3545
- `-C`, `--show-changes`: for `file-diff`, include keys that exist in both files but have different values.
3646
- `--touch`: force writing output files even when generated bytes are identical.
3747
- `--output-encoding <utf8-no-bom|utf8-bom|utf8>`: control output file encoding. `utf8` behaves like `utf8-no-bom`.
3848

39-
By default, cirup avoids rewriting output files when content has not changed.
49+
By default, cirup writes JSONL to stdout, logs at `warn` level, and avoids rewriting output files when content has not changed.
50+
51+
`--summary` emits compact metadata such as counts, write intent, and whether output would be truncated. `--check` is intended for automation and returns exit code `2` when a command would produce changes.
52+
53+
`--key-filter` and `--value-filter` are intentionally limited to a SQL-translatable subset. Unsupported syntax such as `|`, `()`, `[]`, `{m,n}`, `+`, and lookarounds is rejected instead of being interpreted as full regex.
4054

4155
## Common operations
4256

@@ -46,12 +60,24 @@ By default, cirup avoids rewriting output files when content has not changed.
4660
cirup file-print input.resx
4761
```
4862

63+
Show a human-readable table instead:
64+
65+
```bash
66+
cirup --output-format table file-print input.resx
67+
```
68+
4969
Write the printed content to a file:
5070

5171
```bash
5272
cirup file-print input.resx output.json
5373
```
5474

75+
Preview the same operation without writing the output file:
76+
77+
```bash
78+
cirup --dry-run file-print input.resx output.json
79+
```
80+
5581
### Convert between formats
5682

5783
```bash
@@ -81,6 +107,18 @@ Show keys present in `file1` but missing in `file2`:
81107
cirup file-diff file1.resx file2.resx
82108
```
83109

110+
Count missing keys without writing the full result set:
111+
112+
```bash
113+
cirup --count-only file-diff file1.resx file2.resx
114+
```
115+
116+
Ask only whether differences exist:
117+
118+
```bash
119+
cirup --check file-diff file1.resx file2.resx
120+
```
121+
84122
Write diff to file:
85123

86124
```bash
@@ -125,6 +163,30 @@ Show keys that are in `new`, not in `old`, and also present in `base`:
125163
cirup diff-with-base old.resx new.resx base.resx
126164
```
127165

166+
Limit stdout to a subset of keys:
167+
168+
```bash
169+
cirup --key-filter ^lbl --limit 25 diff-with-base old.resx new.resx base.resx
170+
```
171+
172+
Match keys containing a simple wildcard sequence:
173+
174+
```bash
175+
cirup --key-filter 'User.*Name' file-print input.resx
176+
```
177+
178+
Filter by translated value content:
179+
180+
```bash
181+
cirup --value-filter '^Hello' file-print input.resx
182+
```
183+
184+
Emit a structured summary for an in-place sort without modifying the file:
185+
186+
```bash
187+
cirup --dry-run --summary file-sort strings.json
188+
```
189+
128190
## Output file touch behavior
129191

130192
- Default: if output bytes are unchanged, cirup does **not** rewrite the file.

cirup_cli/Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cirup_cli"
3-
version = "0.5.0"
3+
version = "0.6.0"
44
authors = ["Marc-André Moreau <marcandre.moreau@gmail.com>"]
55
edition = "2024"
66

@@ -16,6 +16,10 @@ env_logger = "0.11"
1616
[build-dependencies]
1717
embed-resource = "3.0.6"
1818

19+
[dev-dependencies]
20+
serde_json = "1.0"
21+
tempfile = "3.20"
22+
1923
[target.'cfg(all(target_os = "windows", target_arch = "aarch64"))'.dependencies.cirup_core]
2024
path = "../cirup_core"
2125
default-features = false

0 commit comments

Comments
 (0)