Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Open
blink-so wants to merge4 commits intomain
base:main
Choose a base branch
Loading
fromfeat/ssh-quiet-flag
Open
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletionscli/cliui/agent.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,6 +25,7 @@ type AgentOptions struct {
Fetch func(ctx context.Context, agentID uuid.UUID) (codersdk.WorkspaceAgent, error)
FetchLogs func(ctx context.Context, agentID uuid.UUID, after int64, follow bool) (<-chan []codersdk.WorkspaceAgentLog, io.Closer, error)
Wait bool // If true, wait for the agent to be ready (startup script).
Quiet bool // If true, suppress startup logs and connection indicators.
DocsURL string
}

Expand DownExpand Up@@ -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 {
return nil
}
// Just fetch the next state without showing any output
if agent, err = fetch(); err != nil {
return xerrors.Errorf("fetch: %w", err)
}
continue
}

switch agent.Status {
case codersdk.WorkspaceAgentConnecting, codersdk.WorkspaceAgentTimeout:
// Since we were waiting for the agent to connect, also show
Expand Down
9 changes: 9 additions & 0 deletionscli/ssh.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -74,6 +74,7 @@ func (r *RootCmd) ssh() *serpent.Command {
wsPollInterval time.Duration
waitEnum string
noWait bool
quiet bool
logDirPath string
remoteForwards []string
env []string
Expand DownExpand Up@@ -288,6 +289,7 @@ func (r *RootCmd) ssh() *serpent.Command {
Fetch: client.WorkspaceAgent,
FetchLogs: client.WorkspaceAgentLogsAfter,
Wait: wait,
Quiet: quiet,
DocsURL: appearanceConfig.DocsURL,
})
if err != nil {
Expand DownExpand Up@@ -670,6 +672,13 @@ func (r *RootCmd) ssh() *serpent.Command {
Value: serpent.BoolOf(&noWait),
UseInstead: []serpent.Option{waitOption},
},
{
Flag: "quiet",
FlagShorthand: "q",
Env: "CODER_SSH_QUIET",
Description: "Suppress machine setup logs and connection indicators.",
Value: serpent.BoolOf(&quiet),
},
{
Flag: "log-dir",
Description: "Specify the directory containing SSH diagnostic log files.",
Expand Down
Loading
Loading

[8]ページ先頭

©2009-2025 Movatter.jp