- Notifications
You must be signed in to change notification settings - Fork948
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 ourterms of service andprivacy 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
Adds a --quiet (-q) flag to suppress machine setup logs and connectionindicators when connecting to workspaces via SSH. This provides a cleanerSSH 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 variableCo-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 flagfor the SSH command.Co-authored-by: kylecarbs <7122116+kylecarbs@users.noreply.github.com>
Run markdownlint and markdown-table-formatter to fix formattingissues in the generated CLI documentation.Co-authored-by: kylecarbs <7122116+kylecarbs@users.noreply.github.com>
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.
Pull Request Overview
This PR adds a--quiet
flag to thecoder 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 andCODER_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" | ||
], |
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.
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 { |
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.
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.
ifagent.Status==codersdk.WorkspaceAgentConnected&&agent.LifecycleState== codersdk.WorkspaceAgentLifecycleReady { | |
ifisAgentReady(agent) { |
Copilot uses AI. Check for mistakes.
Adds a
--quiet
(-q
) flag to suppress machine setup logs and connection indicators when connecting to workspaces via SSH.Changes
Quiet
field toAgentOptions
struct incli/cliui/agent.go
Agent()
function to skip all logging when quiet mode is enabled--quiet
flag with-q
shorthand to SSH commandCODER_SSH_QUIET
environment variableUsage
Testing
coder ssh --help