photoprism/internal/commands/show_config.go
Michael Mayer 4a4c322779 Cleanup: Refactor deleting related sidecar files #2521
Signed-off-by: Michael Mayer <michael@photoprism.app>
2022-07-21 20:23:00 +02:00

40 lines
892 B
Go

package commands
import (
"fmt"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
"github.com/photoprism/photoprism/internal/config"
"github.com/photoprism/photoprism/internal/service"
"github.com/photoprism/photoprism/pkg/report"
)
// ShowConfigCommand configures the command name, flags, and action.
var ShowConfigCommand = cli.Command{
Name: "config",
Usage: "Displays global config options and their current values",
Flags: report.CliFlags,
Action: showConfigAction,
}
// showConfigAction shows global config option names and values.
func showConfigAction(ctx *cli.Context) error {
conf := config.NewConfig(ctx)
conf.SetLogLevel(logrus.FatalLevel)
service.SetConfig(conf)
if err := conf.Init(); err != nil {
log.Debug(err)
}
rows, cols := conf.Report()
result, err := report.Render(rows, cols, report.CliFormat(ctx))
fmt.Println(result)
return err
}