Config: Update CLI "photoprism show" sub-command names

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer 2023-01-25 11:41:39 +01:00
parent 8e73e5cebe
commit 2cab5f7534
7 changed files with 44 additions and 48 deletions

View file

@ -10,10 +10,10 @@ var ShowCommand = cli.Command{
Usage: "Shows supported formats, features, and config options",
Subcommands: []cli.Command{
ShowConfigCommand,
ShowFlagsCommand,
ShowOptionsCommand,
ShowFiltersCommand,
ShowFormatsCommand,
ShowTagsCommand,
ShowConfigOptionsCommand,
ShowConfigYamlCommand,
ShowSearchFiltersCommand,
ShowFileFormatsCommand,
ShowMetadataCommand,
},
}

View file

@ -10,13 +10,12 @@ import (
"github.com/photoprism/photoprism/pkg/report"
)
// ShowFlagsCommand configures the command name, flags, and action.
var ShowFlagsCommand = cli.Command{
Name: "flags",
Aliases: []string{"env", "vars"},
// ShowConfigOptionsCommand configures the command name, flags, and action.
var ShowConfigOptionsCommand = cli.Command{
Name: "config-options",
Usage: "Displays supported environment variables and CLI flags",
Flags: report.CliFlags,
Action: showFlagsAction,
Action: showConfigOptionsAction,
}
var faceFlagsInfo = `!!! info ""
@ -24,8 +23,8 @@ var faceFlagsInfo = `!!! info ""
We recommend that only advanced users change these parameters:`
// showFlagsAction displays supported environment variables and CLI flags.
func showFlagsAction(ctx *cli.Context) error {
// showConfigOptionsAction displays supported environment variables and CLI flags.
func showConfigOptionsAction(ctx *cli.Context) error {
conf := config.NewConfig(ctx)
conf.SetLogLevel(logrus.FatalLevel)

View file

@ -10,16 +10,16 @@ import (
"github.com/photoprism/photoprism/pkg/report"
)
// ShowOptionsCommand configures the command name, flags, and action.
var ShowOptionsCommand = cli.Command{
Name: "options",
// ShowConfigYamlCommand configures the command name, flags, and action.
var ShowConfigYamlCommand = cli.Command{
Name: "config-yaml",
Usage: "Displays supported YAML config options and CLI flags",
Flags: report.CliFlags,
Action: showOptionsAction,
Action: showConfigYamlAction,
}
// showOptionsAction displays supported YAML config options and CLI flag.
func showOptionsAction(ctx *cli.Context) error {
// showConfigYamlAction displays supported YAML config options and CLI flag.
func showConfigYamlAction(ctx *cli.Context) error {
conf := config.NewConfig(ctx)
conf.SetLogLevel(logrus.TraceLevel)

View file

@ -10,20 +10,19 @@ import (
"github.com/photoprism/photoprism/pkg/report"
)
// ShowFormatsCommand configures the command name, flags, and action.
var ShowFormatsCommand = cli.Command{
Name: "formats",
Aliases: []string{"filetypes"},
// ShowFileFormatsCommand configures the command name, flags, and action.
var ShowFileFormatsCommand = cli.Command{
Name: "file-formats",
Usage: "Displays supported media and sidecar file formats",
Flags: append(report.CliFlags, cli.BoolFlag{
Name: "short, s",
Usage: "hide format descriptions",
}),
Action: showFormatsAction,
Action: showFileFormatsAction,
}
// showFormatsAction lists supported media and sidecar file formats.
func showFormatsAction(ctx *cli.Context) error {
// showFileFormatsAction lists supported media and sidecar file formats.
func showFileFormatsAction(ctx *cli.Context) error {
rows, cols := media.Report(fs.Extensions.Types(true), !ctx.Bool("short"), true, true)
result, err := report.RenderFormat(rows, cols, report.CliFormat(ctx))

View file

@ -10,20 +10,19 @@ import (
"github.com/photoprism/photoprism/pkg/report"
)
// ShowTagsCommand configures the command name, flags, and action.
var ShowTagsCommand = cli.Command{
Name: "tags",
Aliases: []string{"metadata"},
// ShowMetadataCommand configures the command name, flags, and action.
var ShowMetadataCommand = cli.Command{
Name: "metadata",
Usage: "Displays supported metadata tags and standards",
Flags: append(report.CliFlags, cli.BoolFlag{
Name: "short, s",
Usage: "hide links to documentation",
}),
Action: showTagsAction,
Action: showMetadataAction,
}
// showTagsAction reports supported Exif and XMP metadata tags.
func showTagsAction(ctx *cli.Context) error {
// showMetadataAction reports supported Exif and XMP metadata tags.
func showMetadataAction(ctx *cli.Context) error {
rows, cols := meta.Report(&meta.Data{})
// Sort rows by type data type and name.

View file

@ -10,17 +10,16 @@ import (
"github.com/photoprism/photoprism/pkg/report"
)
// ShowFiltersCommand configures the command name, flags, and action.
var ShowFiltersCommand = cli.Command{
Name: "filters",
Aliases: []string{"search"},
// ShowSearchFiltersCommand configures the command name, flags, and action.
var ShowSearchFiltersCommand = cli.Command{
Name: "search-filters",
Usage: "Displays supported search filters with examples",
Flags: report.CliFlags,
Action: showFiltersAction,
Action: showSearchFiltersAction,
}
// showFiltersAction displays a search filter overview with examples.
func showFiltersAction(ctx *cli.Context) error {
// showSearchFiltersAction displays a search filter overview with examples.
func showSearchFiltersAction(ctx *cli.Context) error {
rows, cols := form.Report(&form.SearchPhotos{})
sort.Slice(rows, func(i, j int) bool {

View file

@ -38,7 +38,7 @@ func TestShowTagsCommand(t *testing.T) {
ctx := config.CliTestContext()
output := capture.Output(func() {
err = ShowTagsCommand.Run(ctx)
err = ShowMetadataCommand.Run(ctx)
})
if err != nil {
@ -59,7 +59,7 @@ func TestShowFiltersCommand(t *testing.T) {
ctx := config.CliTestContext()
output := capture.Output(func() {
err = ShowFiltersCommand.Run(ctx)
err = ShowSearchFiltersCommand.Run(ctx)
})
if err != nil {
@ -80,7 +80,7 @@ func TestShowFormatsCommand(t *testing.T) {
ctx := config.CliTestContext()
output := capture.Output(func() {
err = ShowFormatsCommand.Run(ctx)
err = ShowFileFormatsCommand.Run(ctx)
})
if err != nil {