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

Commit3514ca3

Browse files
chore: skip completion install prompts in non-interactive shells (#14391)
1 parente8c59a1 commit3514ca3

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

‎cli/completion.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package cli
33
import (
44
"fmt"
55

6+
"golang.org/x/xerrors"
7+
68
"github.com/coder/coder/v2/cli/cliui"
79
"github.com/coder/serpent"
810
"github.com/coder/serpent/completion"
@@ -45,7 +47,10 @@ func (*RootCmd) completion() *serpent.Command {
4547
iferr==nil {
4648
returninstallCompletion(inv,shell)
4749
}
48-
// Silently continue to the shell selection if detecting failed.
50+
if!isTTYOut(inv) {
51+
returnxerrors.New("could not detect the current shell, please specify one with --shell or run interactively")
52+
}
53+
// Silently continue to the shell selection if detecting failed in interactive mode
4954
choice,err:=cliui.Select(inv, cliui.SelectOptions{
5055
Message:"Select a shell to install completion for:",
5156
Options:shellOptions.Choices,
@@ -71,6 +76,9 @@ func installCompletion(inv *serpent.Invocation, shell completion.Shell) error {
7176
cliui.Error(inv.Stderr,fmt.Sprintf("Failed to determine completion path %v",err))
7277
returnshell.WriteCompletion(inv.Stdout)
7378
}
79+
if!isTTYOut(inv) {
80+
returnshell.WriteCompletion(inv.Stdout)
81+
}
7482
choice,err:=cliui.Select(inv, cliui.SelectOptions{
7583
Options: []string{
7684
"Confirm",

‎flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
name="coder-${osArch}";
118118
# Updated with ./scripts/update-flake.sh`.
119119
# This should be updated whenever go.mod changes!
120-
vendorHash="sha256-I2YMiYXq8XrJd6jw8JZnOL5wugPTLsip9JGELEy5Uao=";
120+
vendorHash="sha256-lkjb9a40kzi7c3JbVb+5wT1JYTaobLl4lIq11FIvxuQ=";
121121
proxyVendor=true;
122122
src=./.;
123123
nativeBuildInputs=withpkgs;[getoptopensslzstd];

‎go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ require go.uber.org/mock v0.4.0
197197

198198
require (
199199
github.com/cespare/xxhashv1.1.0
200-
github.com/coder/serpentv0.7.1-0.20240815055535-d46fb20fa158
200+
github.com/coder/serpentv0.7.1-0.20240822034013-1b2301f8c920
201201
github.com/emersion/go-saslv0.0.0-20200509203442-7bfe0ed36a21
202202
github.com/emersion/go-smtpv0.21.2
203203
github.com/gomarkdown/markdownv0.0.0-20231222211730-1d6d20845b47
@@ -283,7 +283,7 @@ require (
283283
github.com/docker/dockerv27.1.1+incompatible// indirect
284284
github.com/docker/go-connectionsv0.5.0// indirect
285285
github.com/docker/go-unitsv0.5.0// indirect
286-
github.com/dustin/go-humanizev1.0.1// indirect
286+
github.com/dustin/go-humanizev1.0.1
287287
github.com/ebitengine/puregov0.6.0-alpha.5// indirect
288288
github.com/elastic/go-windowsv1.0.0// indirect
289289
github.com/felixge/httpsnoopv1.0.4// indirect

‎go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,8 @@ github.com/coder/quartz v0.1.0 h1:cLL+0g5l7xTf6ordRnUMMiZtRE8Sq5LxpghS63vEXrQ=
222222
github.com/coder/quartzv0.1.0/go.mod h1:vsiCc+AHViMKH2CQpGIpFgdHIEQsxwm8yCscqKmzbRA=
223223
github.com/coder/retryv1.5.1 h1:iWu8YnD8YqHs3XwqrqsjoBTAVqT9ml6z9ViJ2wlMiqc=
224224
github.com/coder/retryv1.5.1/go.mod h1:blHMk9vs6LkoRT9ZHyuZo360cufXEhrxqvEzeMtRGoY=
225-
github.com/coder/serpentv0.7.1-0.20240815055535-d46fb20fa158 h1:Z+QHBAsvToUfV0UMDnUy8oqdPyrScn5WKV4mx4yNcXY=
226-
github.com/coder/serpentv0.7.1-0.20240815055535-d46fb20fa158/go.mod h1:cZFW6/fP+kE9nd/oRkEHJpG6sXCtQ+AX7WMMEHv0Y3Q=
225+
github.com/coder/serpentv0.7.1-0.20240822034013-1b2301f8c920 h1:RXtavW+kslsKgX2xlroVPqijgTaGHZkn9kvPEP4ALOU=
226+
github.com/coder/serpentv0.7.1-0.20240822034013-1b2301f8c920/go.mod h1:cZFW6/fP+kE9nd/oRkEHJpG6sXCtQ+AX7WMMEHv0Y3Q=
227227
github.com/coder/sshv0.0.0-20231128192721-70855dedb788 h1:YoUSJ19E8AtuUFVYBpXuOD6a/zVP3rcxezNsoDseTUw=
228228
github.com/coder/sshv0.0.0-20231128192721-70855dedb788/go.mod h1:aGQbuCLyhRLMzZF067xc84Lh7JDs1FKwCmF1Crl9dxQ=
229229
github.com/coder/tailscalev1.1.1-0.20240702054557-aa558fbe5374 h1:a5Eg7D5e2oAc0tN56ee4yxtiTo76ztpRlk6geljaZp8=

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp