Skip to content

Commit

Permalink
[collect] accept stdin (#1657)
Browse files Browse the repository at this point in the history
  • Loading branch information
hedge-sparrow authored Oct 22, 2024
1 parent 0d21eed commit 0fb0a07
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cmd/collect/cli/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cli

import (
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
Expand Down Expand Up @@ -49,6 +50,13 @@ func runCollect(v *viper.Viper, arg string) error {
}

collectorContent = spec
} else if arg == "-" {
b, err := io.ReadAll(os.Stdin)
if err != nil {
return err
}

collectorContent = b
} else if _, err = os.Stat(arg); err == nil {
b, err := os.ReadFile(arg)
if err != nil {
Expand Down

0 comments on commit 0fb0a07

Please sign in to comment.