-
Notifications
You must be signed in to change notification settings - Fork 280
feat(cargo-shuttle): add --quiet
flag for local runs
#2104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Add -q/--quiet flag to suppress non-error output. Closes shuttle-hq#1602
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Summary
This PR adds a --quiet
flag (-q/--quiet
) to the cargo shuttle run
command, implementing functionality to suppress non-error output during local development runs. The implementation follows a clean three-part approach:
-
Argument Definition: A new
quiet
boolean field is added to theRunArgs
struct inargs.rs
, following the established clap attribute pattern with both short (-q
) and long (--quiet
) forms. -
Output Suppression: The main functionality in
lib.rs
wraps build status messages and service startup messages in conditional checks based onrun_args.quiet
. When the flag is enabled, these informational messages are suppressed while error output remains visible. -
Logging Configuration: An intelligent logging override sets
RUST_LOG="info,shuttle=error"
when quiet mode is active and no customRUST_LOG
is already set. This ensures that shuttle-specific logs are reduced to errors only while preserving info-level logs from other components.
The change integrates seamlessly with the existing CLI infrastructure and follows the established patterns in the codebase. The integration test was updated to explicitly set quiet: false
to maintain existing test behavior, ensuring verbose output remains available for debugging test failures.
Important Files Changed
Files Modified
Filename | Score | Overview |
---|---|---|
cargo-shuttle/src/args.rs | 5/5 | Added quiet boolean field to RunArgs struct with proper clap attributes |
cargo-shuttle/src/lib.rs | 5/5 | Implemented conditional output suppression and intelligent RUST_LOG override for quiet mode |
cargo-shuttle/tests/integration/run.rs | 5/5 | Updated test to explicitly set quiet: false to maintain existing test behavior |
Confidence score: 4/5
- This PR is safe to merge with minimal risk as it adds optional functionality without breaking existing behavior
- Score reflects well-structured implementation following established patterns, but lacks comprehensive testing of the new quiet functionality
- Pay close attention to
cargo-shuttle/src/lib.rs
to ensure the logging override logic works correctly in different environments
Sequence Diagram
sequenceDiagram
participant User
participant CLI as "cargo-shuttle CLI"
participant Shuttle as "Shuttle::local_run"
participant Builder as "build_workspace"
participant Runtime as "Runtime Process"
User->>CLI: "cargo shuttle run --quiet"
CLI->>CLI: "Parse args with quiet=true"
CLI->>Shuttle: "local_run(run_args, debug)"
alt if not bacon mode
Shuttle->>Shuttle: "pre_local_run(run_args)"
alt if not quiet
Shuttle->>User: "Building {project_directory}"
end
Shuttle->>Builder: "build_workspace(project_directory, release, tx)"
Builder->>Shuttle: "BuiltService"
Shuttle->>Shuttle: "find_available_port(run_args)"
alt if not quiet
Shuttle->>User: "Starting {service} on http://{ip}:{port}"
end
alt if quiet and no RUST_LOG set
Shuttle->>Runtime: "Set RUST_LOG=info,shuttle=error"
end
Shuttle->>Runtime: "spawn runtime process"
Runtime->>User: "Application logs (if any errors)"
else bacon mode
Shuttle->>User: "Starting {project} in watch mode using bacon"
Shuttle->>Runtime: "run_bacon(project_directory)"
end
3 files reviewed, no comments
Thanks for the PR! There are some conflicts with the main branch now. After that is resolved, we also want to pass the |
Description of change
Add
-q/--quiet
flag tocargo shuttle run
to suppress non-error output.Closes #1602
How has this been tested? (if applicable)
Verified flag appears in help output and tested flag parsing and behavior logic.