diff options
| author | Onur Gündüz <ogunduz@gmail.com> | 2026-09-29 16:54:27 +0200 |
|---|---|---|
| committer | Onur Gündüz <ogunduz@gmail.com> | 2026-09-29 16:54:27 +0200 |
| commit | 5a738121c04989e1bdcb728347f12e677adf3bd4 (patch) | |
| tree | e47c1e732bacac41b5b1ace02a39687a58567c34 | |
| parent | 5c51cd28a928c44232e625279691da17e55858de (diff) | |
| download | ele-5a738121c04989e1bdcb728347f12e677adf3bd4.tar.gz ele-5a738121c04989e1bdcb728347f12e677adf3bd4.zip | |
Rename crate and CLI to aif
| -rw-r--r-- | .github/workflows/release.yml | 20 | ||||
| -rw-r--r-- | Cargo.lock | 2 | ||||
| -rw-r--r-- | Cargo.toml | 8 | ||||
| -rw-r--r-- | LICENSE | 2 | ||||
| -rw-r--r-- | README.md | 14 | ||||
| -rw-r--r-- | scripts/release.py | 6 | ||||
| -rw-r--r-- | scripts/test_release.py | 2 | ||||
| -rw-r--r-- | src/compiled.rs | 2 | ||||
| -rw-r--r-- | src/eval.rs | 2 | ||||
| -rw-r--r-- | src/lib.rs | 4 | ||||
| -rw-r--r-- | src/main.rs | 4 | ||||
| -rw-r--r-- | tests/cli_tests.rs | 20 | ||||
| -rw-r--r-- | tests/compiled_tests.rs | 10 | ||||
| -rw-r--r-- | tests/eval_tests.rs | 2 | ||||
| -rw-r--r-- | tests/has_path_tests.rs | 2 | ||||
| -rw-r--r-- | tests/json_number_tests.rs | 2 | ||||
| -rw-r--r-- | tests/limit_tests.rs | 4 | ||||
| -rw-r--r-- | tests/parse_tests.rs | 2 |
18 files changed, 54 insertions, 54 deletions
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ffb6559..691e2f5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -118,15 +118,15 @@ jobs: - name: Build and check CLI run: | cargo build --release --locked --target "$TARGET" - binary="target/$TARGET/release/aip-filter" - test "$("$binary" --version)" = "aip-filter $VERSION" + binary="target/$TARGET/release/aif" + test "$("$binary" --version)" = "aif $VERSION" printf '{"n":1}\n{"n":2}\n' | "$binary" 'n > 1' > target/smoke.jsonl printf '{"n":2}\n' > target/expected.jsonl cmp target/expected.jsonl target/smoke.jsonl - name: Verify static Linux executable if: runner.os == 'Linux' run: | - readelf -l "target/$TARGET/release/aip-filter" > target/elf-headers + readelf -l "target/$TARGET/release/aif" > target/elf-headers if grep -q INTERP target/elf-headers; then echo 'The Linux executable requires a dynamic loader.' >&2 exit 1 @@ -134,14 +134,14 @@ jobs: - name: Archive CLI run: | mkdir -p target/release-dist - COPYFILE_DISABLE=1 tar -czf "target/release-dist/aip-filter-v$VERSION-$TARGET.tar.gz" \ - -C "target/$TARGET/release" aip-filter -C "$GITHUB_WORKSPACE" LICENSE README.md + COPYFILE_DISABLE=1 tar -czf "target/release-dist/aif-v$VERSION-$TARGET.tar.gz" \ + -C "target/$TARGET/release" aif -C "$GITHUB_WORKSPACE" LICENSE README.md - name: Verify library package if: runner.os == 'Linux' run: | cargo package --locked - cargo test --locked --manifest-path "target/package/aip_filter-$VERSION/Cargo.toml" - cp "target/package/aip_filter-$VERSION.crate" target/release-dist/ + cargo test --locked --manifest-path "target/package/aif-$VERSION/Cargo.toml" + cp "target/package/aif-$VERSION.crate" target/release-dist/ - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 with: name: release-assets-${{ matrix.target }} @@ -183,9 +183,9 @@ jobs: path: target/release-dist - name: Verify asset set and generate checksums run: | - test -f "target/release-dist/aip-filter-v$VERSION-x86_64-unknown-linux-musl.tar.gz" - test -f "target/release-dist/aip-filter-v$VERSION-aarch64-apple-darwin.tar.gz" - test -f "target/release-dist/aip_filter-$VERSION.crate" + test -f "target/release-dist/aif-v$VERSION-x86_64-unknown-linux-musl.tar.gz" + test -f "target/release-dist/aif-v$VERSION-aarch64-apple-darwin.tar.gz" + test -f "target/release-dist/aif-$VERSION.crate" test "$(find target/release-dist -maxdepth 1 -type f | wc -l)" -eq 3 cd target/release-dist sha256sum *.tar.gz *.crate > SHA256SUMS @@ -12,7 +12,7 @@ dependencies = [ ] [[package]] -name = "aip_filter" +name = "aif" version = "0.1.0" dependencies = [ "regex", @@ -1,12 +1,12 @@ [package] -name = "aip_filter" +name = "aif" version = "0.1.0" edition = "2024" rust-version = "1.88" license = "MIT" description = "AIP-160-style filtering for Rust values and newline-delimited JSON" -repository = "https://github.com/tetsuo/aip-filter" -documentation = "https://docs.rs/aip_filter" +repository = "https://github.com/tetsuo/aif" +documentation = "https://docs.rs/aif" readme = "README.md" keywords = ["aip-160", "filter", "json", "cli"] categories = ["command-line-utilities", "parser-implementations"] @@ -23,5 +23,5 @@ panic = "abort" strip = true [[bin]] -name = "aip-filter" +name = "aif" path = "src/main.rs" @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2026 aip-filter contributors +Copyright (c) 2026 aif contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -1,4 +1,4 @@ -# aip-filter +# aif Parses and evaluates an [AIP-160](https://google.aip.dev/160)-style filter language for JSON and Rust values. @@ -15,15 +15,15 @@ cargo install --path . --locked The CLI reads one JSON value per line from files or standard input and prints matching records without reformatting. ```text -aip-filter [-p|--print] [--max-record-bytes N] [--] <expr> [file...] +aif [-p|--print] [--max-record-bytes N] [--] <expr> [file...] ``` ```bash -echo '{"price":93,"status":"active"}' | aip-filter 'price > 10 AND status = active' +echo '{"price":93,"status":"active"}' | aif 'price > 10 AND status = active' -aip-filter '"timeout"' events.jsonl -aip-filter 'tags:beta' events.jsonl -aip-filter 'user.settings.theme = dark' events.jsonl +aif '"timeout"' events.jsonl +aif 'tags:beta' events.jsonl +aif 'user.settings.theme = dark' events.jsonl ``` * `--print` prints the parsed expression instead of filtering input. @@ -49,7 +49,7 @@ Function calls are not supported during evaluation. Compile an expression once and reuse the filter. `serde_json::Value` is supported directly; implement `Filterable` for other types. ```rust -use aip_filter::parse; +use aif::parse; use serde_json::json; let expr = parse("state = open AND priority > 3").unwrap().unwrap(); diff --git a/scripts/release.py b/scripts/release.py index 512feab..e607c79 100644 --- a/scripts/release.py +++ b/scripts/release.py @@ -50,8 +50,8 @@ def set_version(version): manifest = Path("Cargo.toml") text = manifest.read_text() package = tomllib.loads(text)["package"] - if package["name"] != "aip_filter": - raise ValueError("expected the aip_filter package") + if package["name"] != "aif": + raise ValueError("expected the aif package") current = package["version"] if version_tuple(current) > version_tuple(version): raise ValueError(f"manifest version {current} exceeds the planned release {version}") @@ -64,7 +64,7 @@ def set_version(version): if count != 1: raise ValueError("expected one explicit package version") expected_lock = copy.deepcopy(tomllib.loads(Path("Cargo.lock").read_text())) - packages = [p for p in expected_lock["package"] if p["name"] == "aip_filter" and "source" not in p] + packages = [p for p in expected_lock["package"] if p["name"] == "aif" and "source" not in p] if len(packages) != 1 or packages[0]["version"] != current: raise ValueError("manifest and lockfile versions must agree") packages[0]["version"] = version diff --git a/scripts/test_release.py b/scripts/test_release.py index 1986ad5..b3f1deb 100644 --- a/scripts/test_release.py +++ b/scripts/test_release.py @@ -48,7 +48,7 @@ class RepositoryTests(unittest.TestCase): release.run("git", "config", "commit.gpgsign", "false") Path(".gitignore").write_text("target/\n") Path("Cargo.toml").write_text( - '[package]\nname = "aip_filter"\nversion = "0.1.0"\nedition = "2024"\n' + '[package]\nname = "aif"\nversion = "0.1.0"\nedition = "2024"\n' ) Path("src").mkdir() Path("src/lib.rs").write_text("pub fn example() {}\n") diff --git a/src/compiled.rs b/src/compiled.rs index 2981f78..3bc238c 100644 --- a/src/compiled.rs +++ b/src/compiled.rs @@ -6,7 +6,7 @@ use std::borrow::Cow; /// A validated filter with reusable regexes, literals, and field paths. /// /// ``` -/// use aip_filter::parse; +/// use aif::parse; /// use serde_json::json; /// /// let expr = parse(r#"state =~ "^op" AND priority < 6"#).unwrap().unwrap(); diff --git a/src/eval.rs b/src/eval.rs index 46a599a..30fd19d 100644 --- a/src/eval.rs +++ b/src/eval.rs @@ -119,7 +119,7 @@ fn compare_integer_float(integer: i128, float: f64) -> Option<Ordering> { /// # Example /// /// ```rust -/// use aip_filter::{Value, Filterable}; +/// use aif::{Value, Filterable}; /// /// struct Issue { /// state: String, @@ -3,7 +3,7 @@ //! ## Example //! //! ```rust -//! use aip_filter::{parse, Value, Filterable}; +//! use aif::{parse, Value, Filterable}; //! //! let expr = parse("state = \"open\" AND priority > 3").unwrap().unwrap(); //! println!("{}", expr); @@ -14,7 +14,7 @@ //! Implement [`Filterable`] for your type, then call [`Expr::evaluate`]: //! //! ```rust -//! use aip_filter::{parse, Value, Filterable}; +//! use aif::{parse, Value, Filterable}; //! //! struct Issue { //! state: String, diff --git a/src/main.rs b/src/main.rs index d2fe848..f763794 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,4 @@ -use aip_filter::{CompiledFilter, parse}; +use aif::{CompiledFilter, parse}; use serde_json::Value as Json; use std::{ fs::File, @@ -116,7 +116,7 @@ fn main() { ); } "-V" | "--version" => { - return print_info(&program, concat!("aip-filter ", env!("CARGO_PKG_VERSION"))); + return print_info(&program, concat!("aif ", env!("CARGO_PKG_VERSION"))); } _ if arg.starts_with("--") => { eprintln!("{program}: unknown option: {arg}; use -- before a literal expression"); diff --git a/tests/cli_tests.rs b/tests/cli_tests.rs index c195c5c..76c9078 100644 --- a/tests/cli_tests.rs +++ b/tests/cli_tests.rs @@ -6,7 +6,7 @@ fn run(expr: &str, input: &str, args: &[&str]) -> Output { } fn run_bytes(expr: &str, input: &[u8], args: &[&str]) -> Output { - let mut child = Command::new(env!("CARGO_BIN_EXE_aip-filter")) + let mut child = Command::new(env!("CARGO_BIN_EXE_aif")) .args(args) .arg(expr) .stdin(Stdio::piped()) @@ -144,7 +144,7 @@ fn empty_filter_and_print_mode() { assert!(output.stdout.is_empty()); let path = format!("{}/README.md", env!("CARGO_MANIFEST_DIR")); - let output = Command::new(env!("CARGO_BIN_EXE_aip-filter")) + let output = Command::new(env!("CARGO_BIN_EXE_aif")) .args(["", &path]) .stdin(Stdio::null()) .output() @@ -156,7 +156,7 @@ fn empty_filter_and_print_mode() { #[test] fn information_flags_succeed_and_unknown_long_options_fail() { for flag in ["--help", "-h", "--version", "-V"] { - let output = Command::new(env!("CARGO_BIN_EXE_aip-filter")) + let output = Command::new(env!("CARGO_BIN_EXE_aif")) .arg(flag) .stdin(Stdio::null()) .output() @@ -169,11 +169,11 @@ fn information_flags_succeed_and_unknown_long_options_fail() { assert!(text.contains("--max-record-bytes")); assert!(text.contains("--version")); } else { - assert_eq!(text, format!("aip-filter {}\n", env!("CARGO_PKG_VERSION"))); + assert_eq!(text, format!("aif {}\n", env!("CARGO_PKG_VERSION"))); } } for flag in ["--verison", "--unknown", "--print=invalid"] { - let output = Command::new(env!("CARGO_BIN_EXE_aip-filter")) + let output = Command::new(env!("CARGO_BIN_EXE_aif")) .arg(flag) .stdin(Stdio::null()) .output() @@ -267,7 +267,7 @@ fn filtering_multiple_files_preserves_successful_output() { let second = dir.join("second.jsonl"); std::fs::write(&first, b"\"match first\"\n").unwrap(); std::fs::write(&second, b"invalid\n\"match second\"\n").unwrap(); - let output = Command::new(env!("CARGO_BIN_EXE_aip-filter")) + let output = Command::new(env!("CARGO_BIN_EXE_aif")) .arg("match") .arg(&first) .arg(&second) @@ -292,7 +292,7 @@ fn multiple_files_keep_record_boundaries_without_forcing_a_final_newline() { for ending in ["", "\n", "\r\n"] { std::fs::write(&first, format!("\"match first\"{ending}")).unwrap(); std::fs::write(&last, b"\"match last\"").unwrap(); - let output = Command::new(env!("CARGO_BIN_EXE_aip-filter")) + let output = Command::new(env!("CARGO_BIN_EXE_aif")) .arg("match") .args([&first, &middle, &last]) .output() @@ -311,7 +311,7 @@ fn multiple_files_keep_record_boundaries_without_forcing_a_final_newline() { } std::fs::write(&first, b"raw").unwrap(); std::fs::write(&last, b"bytes").unwrap(); - let output = Command::new(env!("CARGO_BIN_EXE_aip-filter")) + let output = Command::new(env!("CARGO_BIN_EXE_aif")) .arg("") .args([&first, &last]) .output() @@ -328,7 +328,7 @@ fn output_flush_errors_are_reported() { use std::os::unix::net::UnixStream; let (writer, reader) = UnixStream::pair().unwrap(); drop(reader); - let mut child = Command::new(env!("CARGO_BIN_EXE_aip-filter")) + let mut child = Command::new(env!("CARGO_BIN_EXE_aif")) .arg("foobar") .stdin(Stdio::piped()) .stdout(Stdio::from(OwnedFd::from(writer))) @@ -345,7 +345,7 @@ fn output_flush_errors_are_reported() { for flag in ["--help", "--version"] { let (writer, reader) = UnixStream::pair().unwrap(); drop(reader); - let output = Command::new(env!("CARGO_BIN_EXE_aip-filter")) + let output = Command::new(env!("CARGO_BIN_EXE_aif")) .arg(flag) .stdin(Stdio::null()) .stdout(Stdio::from(OwnedFd::from(writer))) diff --git a/tests/compiled_tests.rs b/tests/compiled_tests.rs index b90c810..56059c5 100644 --- a/tests/compiled_tests.rs +++ b/tests/compiled_tests.rs @@ -1,4 +1,4 @@ -use aip_filter::{Expr, Filterable, Value, parse}; +use aif::{Expr, Filterable, Value, parse}; use serde_json::json; use std::process::{Command, Stdio}; @@ -21,7 +21,7 @@ fn unsupported_functions_reject_the_entire_filter() { .contains("function calls are not supported") ); assert!(!expr.evaluate(&record), "{input}"); - let output = Command::new(env!("CARGO_BIN_EXE_aip-filter")) + let output = Command::new(env!("CARGO_BIN_EXE_aif")) .arg(input) .stdin(Stdio::null()) .output() @@ -32,7 +32,7 @@ fn unsupported_functions_reject_the_entire_filter() { String::from_utf8_lossy(&output.stderr).contains("function calls are not supported") ); } - let output = Command::new(env!("CARGO_BIN_EXE_aip-filter")) + let output = Command::new(env!("CARGO_BIN_EXE_aif")) .args(["--print", "fn(x)"]) .output() .unwrap(); @@ -131,9 +131,9 @@ fn regex_resources_and_manual_trees_are_bounded() { let mut expr = parse("value").unwrap().unwrap(); for _ in 0..150 { expr = Expr::Unary { - op: aip_filter::UnaryOp::Not, + op: aif::UnaryOp::Not, expr: Box::new(expr), - pos: aip_filter::Position { line: 1, col: 1 }, + pos: aif::Position { line: 1, col: 1 }, }; } assert!(expr.compile().unwrap_err().contains("expression limit")); diff --git a/tests/eval_tests.rs b/tests/eval_tests.rs index 885b497..ae3edec 100644 --- a/tests/eval_tests.rs +++ b/tests/eval_tests.rs @@ -1,4 +1,4 @@ -use aip_filter::{Filterable, Value, parse}; +use aif::{Filterable, Value, parse}; struct Record<'a> { value: Value<'a>, diff --git a/tests/has_path_tests.rs b/tests/has_path_tests.rs index 459eaba..281a8e6 100644 --- a/tests/has_path_tests.rs +++ b/tests/has_path_tests.rs @@ -1,4 +1,4 @@ -use aip_filter::{Filterable, Value, parse}; +use aif::{Filterable, Value, parse}; use serde_json::json; fn matches(record: &impl Filterable, text: &str) -> bool { diff --git a/tests/json_number_tests.rs b/tests/json_number_tests.rs index 97f63ca..0a0662d 100644 --- a/tests/json_number_tests.rs +++ b/tests/json_number_tests.rs @@ -1,4 +1,4 @@ -use aip_filter::{Filterable, Value, parse}; +use aif::{Filterable, Value, parse}; use serde_json::{Number, Value as Json}; #[test] diff --git a/tests/limit_tests.rs b/tests/limit_tests.rs index 31748fc..a54463b 100644 --- a/tests/limit_tests.rs +++ b/tests/limit_tests.rs @@ -1,4 +1,4 @@ -use aip_filter::parse; +use aif::parse; use std::process::Command; #[test] @@ -14,7 +14,7 @@ fn excessive_filters_report_errors_without_crashing() { "x".repeat(65537), ]; for filter in filters { - let output = Command::new(env!("CARGO_BIN_EXE_aip-filter")) + let output = Command::new(env!("CARGO_BIN_EXE_aif")) .args(["--print", &filter]) .output() .unwrap(); diff --git a/tests/parse_tests.rs b/tests/parse_tests.rs index 67398b5..40a3879 100644 --- a/tests/parse_tests.rs +++ b/tests/parse_tests.rs @@ -1,4 +1,4 @@ -use aip_filter::parse; +use aif::parse; use std::collections::HashSet; use std::fs; use std::path::Path; |
