CLI: Improve help for cp, mv, thumbs, status, and optimize commands

This commit is contained in:
Michael Mayer
2021-10-05 23:13:06 +02:00
parent a5c2794611
commit 28268369b5
7 changed files with 20 additions and 19 deletions

View File

@@ -55,6 +55,7 @@ func main() {
app.Commands = []cli.Command{ app.Commands = []cli.Command{
commands.StartCommand, commands.StartCommand,
commands.StopCommand, commands.StopCommand,
commands.StatusCommand,
commands.IndexCommand, commands.IndexCommand,
commands.ImportCommand, commands.ImportCommand,
commands.CopyCommand, commands.CopyCommand,
@@ -63,9 +64,9 @@ func main() {
commands.PasswdCommand, commands.PasswdCommand,
commands.PurgeCommand, commands.PurgeCommand,
commands.CleanUpCommand, commands.CleanUpCommand,
commands.OptimizeCommand,
commands.ConvertCommand, commands.ConvertCommand,
commands.ThumbsCommand, commands.ThumbsCommand,
commands.OptimizeCommand,
commands.MomentsCommand, commands.MomentsCommand,
commands.MigrateCommand, commands.MigrateCommand,
commands.BackupCommand, commands.BackupCommand,
@@ -73,7 +74,6 @@ func main() {
commands.ResetCommand, commands.ResetCommand,
commands.ConfigCommand, commands.ConfigCommand,
commands.VersionCommand, commands.VersionCommand,
commands.StatusCommand,
} }
if err := app.Run(os.Args); err != nil { if err := app.Run(os.Args); err != nil {

View File

@@ -16,8 +16,8 @@ import (
// ConvertCommand registers the convert cli command. // ConvertCommand registers the convert cli command.
var ConvertCommand = cli.Command{ var ConvertCommand = cli.Command{
Name: "convert", Name: "convert",
Usage: "Converts media files to JPEG and AVC as needed", Usage: "Converts media files in other formats to JPEG / AVC",
UsageText: `To limit scope, a PATH may be passed as first argument.`, ArgsUsage: "[path]",
Action: convertAction, Action: convertAction,
} }

View File

@@ -16,10 +16,11 @@ import (
// CopyCommand registers the copy cli command. // CopyCommand registers the copy cli command.
var CopyCommand = cli.Command{ var CopyCommand = cli.Command{
Name: "cp", Name: "cp",
Aliases: []string{"copy"}, Aliases: []string{"copy"},
Usage: "Copies media files to originals", Usage: "Copies media files to originals",
Action: copyAction, ArgsUsage: "[path]",
Action: copyAction,
} }
// copyAction copies photos to originals path. Default import path is used if no path argument provided // copyAction copies photos to originals path. Default import path is used if no path argument provided

View File

@@ -16,10 +16,11 @@ import (
// ImportCommand registers the import cli command. // ImportCommand registers the import cli command.
var ImportCommand = cli.Command{ var ImportCommand = cli.Command{
Name: "mv", Name: "mv",
Aliases: []string{"import"}, Aliases: []string{"import"},
Usage: "Moves media files to originals", Usage: "Moves media files to originals",
Action: importAction, ArgsUsage: "[path]",
Action: importAction,
} }
// importAction moves photos to originals path. Default import path is used if no path argument provided // importAction moves photos to originals path. Default import path is used if no path argument provided

View File

@@ -14,7 +14,7 @@ import (
// OptimizeCommand registers the index cli command. // OptimizeCommand registers the index cli command.
var OptimizeCommand = cli.Command{ var OptimizeCommand = cli.Command{
Name: "optimize", Name: "optimize",
Usage: "Verifies and optimizes metadata", Usage: "Performs index metadata maintenance",
Action: optimizeAction, Action: optimizeAction,
} }

View File

@@ -12,14 +12,14 @@ import (
"github.com/photoprism/photoprism/internal/config" "github.com/photoprism/photoprism/internal/config"
) )
// StatusCommand performs a server health check. // StatusCommand registers the status command.
var StatusCommand = cli.Command{ var StatusCommand = cli.Command{
Name: "status", Name: "status",
Usage: "Performs a server health check", Usage: "Checks if the web server is running",
Action: statusAction, Action: statusAction,
} }
// statusAction shows the server health status // statusAction checks if the web server is running.
func statusAction(ctx *cli.Context) error { func statusAction(ctx *cli.Context) error {
conf := config.NewConfig(ctx) conf := config.NewConfig(ctx)
client := &http.Client{Timeout: 10 * time.Second} client := &http.Client{Timeout: 10 * time.Second}

View File

@@ -12,9 +12,8 @@ import (
// ThumbsCommand registers the resample cli command. // ThumbsCommand registers the resample cli command.
var ThumbsCommand = cli.Command{ var ThumbsCommand = cli.Command{
Name: "thumbs", Name: "thumbs",
Aliases: []string{"resample"}, Usage: "Pre-renders thumbnail images based on config options",
Usage: "Pre-renders thumbnail images",
Flags: []cli.Flag{ Flags: []cli.Flag{
cli.BoolFlag{ cli.BoolFlag{
Name: "force, f", Name: "force, f",