From b5e683dfc9af717f52d0c893d86853930d220e7a Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Mon, 4 Apr 2022 17:43:17 -0400 Subject: [PATCH] main: compare two files with two -f flags Fixes: #159 ```shell vbatts@fogel:~/src/github.com/vbatts/go-mtree$ ./gomtree -c -f foo vbatts@fogel:~/src/github.com/vbatts/go-mtree$ ./gomtree -c -f bar -K sha256 vbatts@fogel:~/src/github.com/vbatts/go-mtree$ ./gomtree -f foo -f bar "foo": unexpected path ".": keyword "time": expected 1649109728.228935367; got 1649109734.412959677 FATA[0000] manifest validation failed vbatts@fogel:~/src/github.com/vbatts/go-mtree$ echo $? 1 ``` Signed-off-by: Vincent Batts --- cmd/gomtree/main.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmd/gomtree/main.go b/cmd/gomtree/main.go index cb2f96b..54cfb20 100644 --- a/cmd/gomtree/main.go +++ b/cmd/gomtree/main.go @@ -294,6 +294,17 @@ func mainApp(c *cli.Context) error { if err != nil { return err } + } else if len(c.StringSlice("file")) > 1 { + // load this second hierarchy file provided + fh, err := os.Open(c.StringSlice("file")[1]) + if err != nil { + return err + } + stateDh, err = mtree.ParseSpec(fh) + fh.Close() + if err != nil { + return err + } } else { // with a root directory stateDh, err = mtree.Walk(rootPath, excludes, currentKeywords, nil)