Repository navigation
Add --query (shorthand -q) flag to all atmos describe <subcommand> commands - #920
Conversation
# Conflicts: # cmd/terraform.go # go.mod # go.sum
|
💥 This pull request now has conflicts. Could you fix it Andriy Knysh (@aknysh)? 🙏 |
# Conflicts: # go.mod # go.sum
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
internal/exec/describe_stacks.go (1)
116-126: Consider using a more descriptive variable name than 'res'.While the logic is solid, consider renaming
resto something more descriptive likequeryResultorstacksMapResultto better convey its purpose.- var res any + var queryResult any if query != "" { - res, err = u.EvaluateYqExpression(atmosConfig, finalStacksMap, query) + queryResult, err = u.EvaluateYqExpression(atmosConfig, finalStacksMap, query) if err != nil { return err } } else { - res = finalStacksMap + queryResult = finalStacksMap } - err = printOrWriteToFile(format, file, res) + err = printOrWriteToFile(format, file, queryResult)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
go.mod(8 hunks)internal/exec/describe_stacks.go(3 hunks)internal/exec/utils.go(3 hunks)pkg/config/const.go(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- pkg/config/const.go
- go.mod
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Build (windows-latest, windows)
- GitHub Check: Summary
🔇 Additional comments (6)
internal/exec/describe_stacks.go (2)
58-58: LGTM! Flag retrieval changes are consistent.The changes maintain consistency in flag retrieval patterns across the function, with proper error handling.
Also applies to: 97-100
127-127: LGTM! Clean integration with existing output handling.The query evaluation is well-integrated into the existing flow, maintaining backward compatibility while adding the new query functionality.
internal/exec/utils.go (4)
53-53: LGTM! The query flag is correctly added to commonFlags.The placement ensures the flag will be properly handled and removed before passing arguments to underlying tools.
990-1001: LGTM! Query flag processing follows established patterns.The implementation correctly handles both flag formats and includes proper error handling.
245-245: LGTM! Query field is properly integrated.The field is correctly populated in the ConfigAndStacksInfo struct, maintaining consistency with other command-line arguments.
53-53: Verify query flag integration with describe commands.Let's ensure the query flag is properly integrated across all describe commands.
Run this script to verify the integration:
Also applies to: 245-245, 990-1001
✅ Verification successful
Query flag integration verified successfully across describe commands
The query flag is properly implemented and consistently integrated across all describe commands, with proper parsing and execution flow.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify query flag integration in describe commands # Test 1: Find all describe commands that should support the query flag echo "Checking describe commands for query flag support..." ast-grep --pattern 'func.*Cmd.*describe.*\(.*\).*{ $$$ }' # Test 2: Verify query flag processing in these commands echo "Checking query flag processing..." rg -A 5 'Query.*=.*argsAndFlagsInfo\.Query'Length of output: 585
Script:
#!/bin/bash # Find query flag definition and describe commands echo "=== Query flag definition ===" rg -A 3 'Query.*string.*[`"]query[`"]' echo -e "\n=== Describe command implementations ===" ast-grep --pattern 'func.*describe.*Command.*\(.*\).*{ $$$ }' echo -e "\n=== Query value usage ===" rg -A 5 'configAndStacksInfo.*Query'Length of output: 664
Script:
#!/bin/bash # Broader search for query-related code echo "=== Query flag definitions (broader search) ===" rg -i "query.*flag" -A 3 echo -e "\n=== Describe command implementations (alternative pattern) ===" rg "func.*[Dd]escribe" -A 5 echo -e "\n=== Query parameter flow ===" rg -i "query" internal/exec/utils.go -A 3Length of output: 21277
|
These changes were released in v1.140.0. |
what
--query(shorthand-q) flag to allatmos describe <subcommand>commandswhy
atmos describe <subcommand>commands using yq expressionsyqorjqbinary was required to query/filter the results ofatmos describecommands. With theyqfunctionality now embedded in Atmos, installing theyqbinary is not requiredexamples
references
Summary by CodeRabbit
Release Notes for Atmos v1.140.0
New Features
--queryflag across multipledescribecommands to filter results using YQ expressions.Improvements
Dependency Updates
yq/v4and several indirect dependencies.Documentation
Chores