diff --git a/Makefile b/Makefile index ac31e47..418cc95 100644 --- a/Makefile +++ b/Makefile @@ -2,11 +2,10 @@ BUILD := gomtree BUILDPATH := github.com/vbatts/go-mtree/cmd/gomtree CWD := $(shell pwd) -SOURCE_FILES := $(shell find . -type f -name "*.go") +SOURCE_FILES = $(shell find . -type f -name "*.go") CLEAN_FILES := *~ TAGS := ARCHES := linux,386 linux,amd64 linux,arm linux,arm64 linux,mips64 linux,riscv64 openbsd,amd64 windows,amd64 windows,arm64 darwin,amd64 darwin,arm64 -GO_VER := go1.14 default: build validation diff --git a/cmd/gomtree/cmd/reformat.go b/cmd/gomtree/cmd/reformat.go new file mode 100644 index 0000000..d0956d8 --- /dev/null +++ b/cmd/gomtree/cmd/reformat.go @@ -0,0 +1,21 @@ +package cmd + +import ( + cli "github.com/urfave/cli/v2" +) + +func NewMtree2JsonCommand() *cli.Command { + return &cli.Command{ + Name: "mtree2json,", + Usage: "represent an mtree as JSON format", + Aliases: []string{"m2j"}, + Action: validateAction, + Flags: []cli.Flag{ + &cli.StringSliceFlag{ + Name: "file", + Aliases: []string{"f"}, + Usage: "Directory hierarchy spec to validate", + }, + }, + } +} diff --git a/cmd/gomtree/main.go b/cmd/gomtree/main.go index 90fff23..840f551 100644 --- a/cmd/gomtree/main.go +++ b/cmd/gomtree/main.go @@ -42,6 +42,7 @@ to support xattrs and interacting with tar archives.` } app.Commands = []*cli.Command{ cmd.NewValidateCommand(), + cmd.NewMtree2JsonCommand(), } // Unfortunately urfave/cli is not at good at using DefaultCommand