1
0
Fork 1
mirror of https://github.com/vbatts/tar-split.git synced 2024-12-19 11:56:30 +00:00

cmd: add a disasm --no-stdout flag

Since sometimes you just need to > /dev/null

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2016-06-26 10:15:12 -04:00
parent e2a62d6b0d
commit 354fd6cf34
2 changed files with 12 additions and 1 deletions

View file

@ -3,6 +3,7 @@ package main
import ( import (
"compress/gzip" "compress/gzip"
"io" "io"
"io/ioutil"
"os" "os"
"github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
@ -48,7 +49,13 @@ func CommandDisasm(c *cli.Context) {
if err != nil { if err != nil {
logrus.Fatal(err) logrus.Fatal(err)
} }
i, err := io.Copy(os.Stdout, its) var out io.Writer
if c.Bool("no-stdout") {
out = ioutil.Discard
} else {
out = os.Stdout
}
i, err := io.Copy(out, its)
if err != nil { if err != nil {
logrus.Fatal(err) logrus.Fatal(err)
} }

View file

@ -42,6 +42,10 @@ func main() {
Value: "tar-data.json.gz", Value: "tar-data.json.gz",
Usage: "output of disassembled tar stream", Usage: "output of disassembled tar stream",
}, },
cli.BoolFlag{
Name: "no-stdout",
Usage: "do not throughput the stream to STDOUT",
},
}, },
}, },
{ {