package gallery import ( "errors" "flag" finstr "git.gutmet.org/finstr.git/initer" goutil "git.gutmet.org/goutil.git/misc" ) func New(fl finstr.IniterFlags) error { fl.Dir = "photos" + fl.Dir fl.Markdown = true return finstr.Init(fl) } type galleryFlags struct { artsy bool name string } func NewCommand() (goutil.CommandFlagsInit, goutil.CommandFunc) { f := galleryFlags{} flagsInit := func(s *flag.FlagSet) { s.StringVar(&f.name, "name", "", "name to use for gallery and folder (mandatory)") s.BoolVar(&f.artsy, "artsy", false, "mark gallery to generate thumbnails with original ratio instead of square") } return flagsInit, func([]string) error { if f.name == "" { return errors.New("need gallery name as argument") } fl := finstr.IniterFlags{} fl.Dir = f.name fl.Artsy = f.artsy return New(fl) } }