Skip to content

Commit 8d176cf

Browse files
idsulikglours
authored andcommitted
Add IsStdin() to ConfigFile
Signed-off-by: Suleiman Dibirov <[email protected]>
1 parent 0d824bf commit 8d176cf

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

cli/options.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ func (o *ProjectOptions) ReadConfigFiles(ctx context.Context, workingDir string,
414414
for i, c := range config.ConfigFiles {
415415
var err error
416416
var b []byte
417-
if c.Filename == "-" {
417+
if c.IsStdin() {
418418
b, err = io.ReadAll(os.Stdin)
419419
if err != nil {
420420
return nil, err

types/config.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ type ConfigFile struct {
6767
Config map[string]interface{}
6868
}
6969

70+
func (cf ConfigFile) IsStdin() bool {
71+
return cf.Filename == "-"
72+
}
73+
7074
func ToConfigFiles(path []string) (f []ConfigFile) {
7175
for _, p := range path {
7276
f = append(f, ConfigFile{Filename: p})

0 commit comments

Comments
 (0)