Skip to content

feat: add --quiet flag to coder ssh command #18883

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

blink-so[bot]
Copy link
Contributor

@blink-so blink-so bot commented Jul 15, 2025

Adds a --quiet (-q) flag to suppress machine setup logs and connection indicators when connecting to workspaces via SSH.

Changes

  • Add Quiet field to AgentOptions struct in cli/cliui/agent.go
  • Modify Agent() function to skip all logging when quiet mode is enabled
  • Add --quiet flag with -q shorthand to SSH command
  • Support CODER_SSH_QUIET environment variable

Usage

coder ssh myworkspace --quiet
coder ssh myworkspace -q
CODER_SSH_QUIET=true coder ssh myworkspace

Testing

  • Existing tests pass
  • Flag appears correctly in coder ssh --help
  • Implementation tested with cliui agent tests

blink-so bot and others added 4 commits July 15, 2025 18:28
Adds a --quiet (-q) flag to suppress machine setup logs and connection
indicators when connecting to workspaces via SSH. This provides a cleaner
SSH experience for users who don't want to see the startup logs.

Changes:
- Add Quiet field to AgentOptions struct
- Modify Agent() function to skip logging in quiet mode
- Add --quiet flag with -q shorthand to SSH command
- Support CODER_SSH_QUIET environment variable

Co-authored-by: kylecarbs <7122116+kylecarbs@users.noreply.github.com>
Fix Go formatting for the quiet flag to match existing code style.

Co-authored-by: kylecarbs <7122116+kylecarbs@users.noreply.github.com>
Generate updated CLI documentation that includes the new --quiet flag
for the SSH command.

Co-authored-by: kylecarbs <7122116+kylecarbs@users.noreply.github.com>
Run markdownlint and markdown-table-formatter to fix formatting
issues in the generated CLI documentation.

Co-authored-by: kylecarbs <7122116+kylecarbs@users.noreply.github.com>
@matifali matifali requested a review from Copilot July 21, 2025 09:06
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a --quiet flag to the coder ssh command to suppress machine setup logs and connection indicators when connecting to workspaces via SSH.

  • Adds quiet mode support to the Agent function in cliui package
  • Implements --quiet flag with -q shorthand and CODER_SSH_QUIET environment variable in SSH command
  • Updates documentation to reflect the new flag functionality

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
cli/cliui/agent.go Adds Quiet field to AgentOptions struct and implements quiet mode logic to skip all logging
cli/ssh.go Adds --quiet flag, environment variable support, and passes quiet option to agent
docs/reference/cli/ssh.md Documents the new --quiet flag with usage information
docs/manifest.json Formatting changes to JSON structure (unrelated to quiet flag functionality)

}
"versions": [
"main"
],
Copy link
Preview

Copilot AI Jul 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The formatting changes in this file appear unrelated to the quiet flag feature. Consider separating formatting changes from functional changes in different commits or PRs.

Copilot uses AI. Check for mistakes.

@@ -103,6 +104,18 @@ func Agent(ctx context.Context, writer io.Writer, agentID uuid.UUID, opts AgentO
return errAgentShuttingDown
}

// In quiet mode, skip all logging and just wait for ready state
if opts.Quiet {
if agent.Status == codersdk.WorkspaceAgentConnected && agent.LifecycleState == codersdk.WorkspaceAgentLifecycleReady {
Copy link
Preview

Copilot AI Jul 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The quiet mode logic duplicates the ready state check that exists later in the function. Consider extracting this condition into a helper function or variable to avoid duplication.

Suggested change
if agent.Status == codersdk.WorkspaceAgentConnected && agent.LifecycleState == codersdk.WorkspaceAgentLifecycleReady {
if isAgentReady(agent) {

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants