Skip to content

Commit 0fb0a07

Browse files
[collect] accept stdin (#1657)
1 parent 0d21eed commit 0fb0a07

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cmd/collect/cli/run.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package cli
22

33
import (
44
"fmt"
5+
"io"
56
"io/ioutil"
67
"net/http"
78
"os"
@@ -49,6 +50,13 @@ func runCollect(v *viper.Viper, arg string) error {
4950
}
5051

5152
collectorContent = spec
53+
} else if arg == "-" {
54+
b, err := io.ReadAll(os.Stdin)
55+
if err != nil {
56+
return err
57+
}
58+
59+
collectorContent = b
5260
} else if _, err = os.Stat(arg); err == nil {
5361
b, err := os.ReadFile(arg)
5462
if err != nil {

0 commit comments

Comments
 (0)