photoprism/internal/commands/show_formats.go
Michael Mayer 0096243240 Metadata: Report supported Exiftool, XMP, and Dublin Core tags #2252
Replaces the --no-wrap flag with --md in all "photoprism show ..."
subcommands, as this is easier to understand. See also #2247.
Unused code was opportunistically removed along the way.
2022-04-14 10:49:56 +02:00

35 lines
788 B
Go

package commands
import (
"fmt"
"github.com/urfave/cli"
"github.com/photoprism/photoprism/pkg/fs"
"github.com/photoprism/photoprism/pkg/report"
)
var ShowFormatsCommand = cli.Command{
Name: "formats",
Usage: "Lists supported media and sidecar file formats",
Flags: []cli.Flag{
cli.BoolFlag{
Name: "compact, c",
Usage: "hide format descriptions to make the output more compact",
},
cli.BoolFlag{
Name: "md, m",
Usage: "renders valid Markdown",
},
},
Action: showFormatsAction,
}
// showFormatsAction lists supported media and sidecar file formats.
func showFormatsAction(ctx *cli.Context) error {
rows, cols := fs.Extensions.Formats(true).Report(!ctx.Bool("compact"), true, true)
fmt.Println(report.Table(rows, cols, ctx.Bool("md")))
return nil
}