From 21a2577f0184ab8d6ee153c1f8dae013f36750e5 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Fri, 20 Jan 2017 13:13:59 -0500 Subject: [PATCH] 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 --- cmd/gomtree/main.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cmd/gomtree/main.go b/cmd/gomtree/main.go index acca098..2f97690 100644 --- a/cmd/gomtree/main.go +++ b/cmd/gomtree/main.go @@ -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