Skip to content

Commit 58a6752

Browse files
committed
fix(cli/templatepush): only implicitly read from stdin if the directory flag is unset
1 parent 6606d8b commit 58a6752

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

cli/templatepush.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,9 @@ func (pf *templateUploadFlags) stdin(inv *serpent.Invocation) (out bool) {
309309
inv.Logger.Info(inv.Context(), "uploading tar read from stdin")
310310
}
311311
}()
312-
// We let the directory override our isTTY check
313-
return pf.directory == "-" || (!isTTYIn(inv) && pf.directory == ".")
312+
// We read a tar from stdin if the directory is "-" or if we're not in a
313+
// TTY and the directory flag is unset.
314+
return pf.directory == "-" || (!isTTYIn(inv) && !inv.ParsedFlags().Lookup("directory").Changed)
314315
}
315316

316317
func (pf *templateUploadFlags) upload(inv *serpent.Invocation, client *codersdk.Client) (*codersdk.UploadResponse, error) {

0 commit comments

Comments
 (0)