Skip to content

Commit

Permalink
Add IsStdin() to ConfigFile
Browse files Browse the repository at this point in the history
Signed-off-by: Suleiman Dibirov <[email protected]>
  • Loading branch information
idsulik committed Oct 30, 2024
1 parent 56ad854 commit b377c30
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cli/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ func (o *ProjectOptions) ReadConfigFiles(ctx context.Context, workingDir string,
for i, c := range config.ConfigFiles {
var err error
var b []byte
if c.Filename == "-" {
if c.IsStdin() {
b, err = io.ReadAll(os.Stdin)
if err != nil {
return nil, err
Expand Down
4 changes: 4 additions & 0 deletions types/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ type ConfigFile struct {
Config map[string]interface{}
}

func (cf ConfigFile) IsStdin() bool {
return cf.Filename == "-"
}

func ToConfigFiles(path []string) (f []ConfigFile) {
for _, p := range path {
f = append(f, ConfigFile{Filename: p})
Expand Down

0 comments on commit b377c30

Please sign in to comment.