gomtree: allow manifest to be provided on stdin

like `gomtree -c -p /tmp/dir1 -K sha1 | gomtree -p /tmp/dir2`

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2017-01-20 13:13:59 -05:00
parent b7967864aa
commit 21a2577f01
Signed by: vbatts
GPG key ID: 10937E57733F1362

View file

@ -257,6 +257,19 @@ func app() error {
return nil
}
// no spec manifest has been provided yet, so look for it on stdin
if specDh == nil {
// load the hierarchy
specDh, err = mtree.ParseSpec(os.Stdin)
if err != nil {
return err
}
// We can't check against more fields than in the specKeywords list, so
// currentKeywords can only have a subset of specKeywords.
specKeywords = specDh.UsedKeywords()
}
// This is a validation.
if specDh != nil && stateDh != nil {
var res []mtree.InodeDelta