mirror of
https://github.com/vbatts/tar-split.git
synced 2024-12-23 22:06:31 +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:
parent
e2a62d6b0d
commit
354fd6cf34
2 changed files with 12 additions and 1 deletions
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
|
@ -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",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue