diff --git a/cmd/pkger/cmds/pack.go b/cmd/pkger/cmds/pack.go index 04a845b..8ef6880 100644 --- a/cmd/pkger/cmds/pack.go +++ b/cmd/pkger/cmds/pack.go @@ -90,7 +90,7 @@ func New() (*packCmd, error) { c := &packCmd{} c.subs = []command{ - &readCmd{}, &serveCmd{}, &statCmd{}, &infoCmd{}, + &serveCmd{}, &statCmd{}, &infoCmd{}, } sort.Slice(c.subs, func(a, b int) bool { return c.subs[a].Name() <= c.subs[b].Name() diff --git a/cmd/pkger/cmds/read.go b/cmd/pkger/cmds/read.go deleted file mode 100644 index 46414d7..0000000 --- a/cmd/pkger/cmds/read.go +++ /dev/null @@ -1,63 +0,0 @@ -package cmds - -import ( - "encoding/json" - "flag" - "fmt" - "io" - "os" - - "github.com/markbates/pkger" -) - -type readCmd struct { - *flag.FlagSet - JSON bool -} - -func (s *readCmd) Name() string { - return s.Flags().Name() -} - -func (r *readCmd) Flags() *flag.FlagSet { - if r.FlagSet == nil { - r.FlagSet = flag.NewFlagSet("read", flag.ExitOnError) - r.FlagSet.BoolVar(&r.JSON, "json", false, "print as JSON") - } - return r.FlagSet -} - -func (r *readCmd) Exec(args []string) error { - if len(args) == 0 { - args = []string{"."} - } - for _, a := range args { - f, err := pkger.Open(a) - if err != nil { - return err - } - defer f.Close() - - fi, err := f.Stat() - if err != nil { - return err - } - - if fi.IsDir() && !r.JSON { - return fmt.Errorf("can not read a dir %s", a) - } - if r.JSON { - err = json.NewEncoder(os.Stdout).Encode(f) - if err != nil { - return err - } - continue - } - _, err = io.Copy(os.Stdout, f) - if err != nil { - return err - } - } - - return nil -} diff --git a/version.go b/version.go index eec2dbf..0dd1327 100644 --- a/version.go +++ b/version.go @@ -1,4 +1,4 @@ package pkger // Version of pkger -const Version = "v0.3.1" +const Version = "v0.3.2"