Skip to content

Commit 4f4d23d

Browse files
committed
feat(cli): integrate jmespath-extensions for enhanced query capabilities
Add 150+ extended JMESPath functions for more powerful query and transformation capabilities when using the -q/--query flag. New function categories: - String: upper(), lower(), trim(), split(), replace() - Type: type_of(), is_empty(), to_number(), to_string(), default() - Math: round(), min(), max() - Utility: if(), coalesce(), unique() - DateTime: now(), format_date() - Validation: is_ipv4(), is_ipv6(), is_email(), is_url() - Encoding: base64_encode(), base64_decode() Changes: - Add jmespath_extensions dependency with selective features - Update output.rs to use extended runtime with OnceLock - Add compile_jmespath() helper for consistent usage - Update cloud/utils.rs and enterprise/utils.rs to use extended runtime - Add comprehensive tests for extension functions - Update documentation with examples of new functions Closes #481
1 parent 1ac0730 commit 4f4d23d

File tree

7 files changed

+423
-14
lines changed

7 files changed

+423
-14
lines changed

Cargo.lock

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

crates/redisctl/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ thiserror = { workspace = true }
5151
serde_yaml = { workspace = true }
5252
comfy-table = { workspace = true }
5353
jmespath = { workspace = true }
54+
jmespath_extensions = { version = "0.3", features = ["string", "array", "object", "math", "type", "utility", "datetime", "encoding", "validation"] }
5455
config = { workspace = true }
5556

5657
# Keyring for Files.com API key storage (separate from profile credentials)

crates/redisctl/src/commands/cloud/utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,9 @@ pub fn provider_short_name(provider: &str) -> &str {
193193
}
194194
}
195195

196-
/// Apply JMESPath query to JSON data
196+
/// Apply JMESPath query to JSON data (using extended runtime with 150+ functions)
197197
pub fn apply_jmespath(data: &Value, query: &str) -> CliResult<Value> {
198-
let expr = jmespath::compile(query)
198+
let expr = crate::output::compile_jmespath(query)
199199
.with_context(|| format!("Invalid JMESPath expression: {}", query))?;
200200

201201
let result = expr

0 commit comments

Comments
 (0)