Add --all flag to index command #187

PR #211
This commit is contained in:
linosgian 2020-01-22 10:57:49 +02:00 committed by Michael Mayer
parent 549f985ee4
commit afa307a28f

View file

@ -11,13 +11,21 @@ import (
"github.com/urfave/cli"
)
// Re-indexes all photos in originals directory (photo library)
// indexes all photos in originals directory (photo library)
var IndexCommand = cli.Command{
Name: "index",
Usage: "Re-indexes all originals",
Usage: "indexes all originals",
Flags: indexFlags,
Action: indexAction,
}
var indexFlags = []cli.Flag{
cli.BoolFlag{
Name: "all, a",
Usage: "re-index all originals, including unchanged ones",
},
}
func indexAction(ctx *cli.Context) error {
start := time.Now()
@ -45,8 +53,12 @@ func indexAction(ctx *cli.Context) error {
ind := photoprism.NewIndex(conf, tf, nd)
opt := photoprism.IndexOptionsAll()
files := ind.Start(opt)
var files map[string]bool
if ctx.Bool("all") {
files = ind.Start(photoprism.IndexOptionsAll())
} else {
files = ind.Start(photoprism.IndexOptionsNone())
}
elapsed := time.Since(start)