Skip to content

Commit

Permalink
chore(cli): notify user when reading from stdin (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tieske authored Nov 29, 2023
1 parent 55d17a6 commit 4181f77
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/file/readfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (

"dario.cat/mergo"
"github.com/kong/go-database-reconciler/pkg/utils"
"golang.org/x/term"
"sigs.k8s.io/yaml"
)

Expand Down Expand Up @@ -67,6 +68,9 @@ func getContent(filenames []string, mockEnvVars bool) (*Content, error) {
func getReaders(fileOrDir string) (map[string]io.Reader, error) {
// special case where `-` means stdin
if fileOrDir == "-" {
if term.IsTerminal(int(os.Stdin.Fd())) && term.IsTerminal(int(os.Stderr.Fd())) {
fmt.Fprintf(os.Stderr, "reading input from stdin...\n")
}
return map[string]io.Reader{"STDIN": os.Stdin}, nil
}

Expand Down

0 comments on commit 4181f77

Please sign in to comment.