2022-04-12 13:28:28 +02:00
|
|
|
package commands
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/urfave/cli"
|
2022-04-12 19:14:21 +02:00
|
|
|
|
|
|
|
"github.com/photoprism/photoprism/pkg/fs"
|
|
|
|
"github.com/photoprism/photoprism/pkg/report"
|
2022-04-12 13:28:28 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
var ShowFormatsCommand = cli.Command{
|
2022-04-12 19:14:21 +02:00
|
|
|
Name: "formats",
|
2022-04-13 09:48:51 +02:00
|
|
|
Usage: "Lists supported media and sidecar file formats",
|
2022-04-12 19:14:21 +02:00
|
|
|
Flags: []cli.Flag{
|
|
|
|
cli.BoolFlag{
|
|
|
|
Name: "compact, c",
|
|
|
|
Usage: "hide format descriptions to make the output more compact",
|
|
|
|
},
|
|
|
|
cli.BoolFlag{
|
2022-04-14 10:49:56 +02:00
|
|
|
Name: "md, m",
|
|
|
|
Usage: "renders valid Markdown",
|
2022-04-12 19:14:21 +02:00
|
|
|
},
|
|
|
|
},
|
2022-04-12 13:28:28 +02:00
|
|
|
Action: showFormatsAction,
|
|
|
|
}
|
|
|
|
|
|
|
|
// showFormatsAction lists supported media and sidecar file formats.
|
|
|
|
func showFormatsAction(ctx *cli.Context) error {
|
2022-04-14 10:49:56 +02:00
|
|
|
rows, cols := fs.Extensions.Formats(true).Report(!ctx.Bool("compact"), true, true)
|
2022-04-12 19:14:21 +02:00
|
|
|
|
2022-04-14 10:49:56 +02:00
|
|
|
fmt.Println(report.Table(rows, cols, ctx.Bool("md")))
|
2022-04-12 19:14:21 +02:00
|
|
|
|
2022-04-12 13:28:28 +02:00
|
|
|
return nil
|
|
|
|
}
|