CLI: Improve parameter aliases, order, and descriptions #2195

Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
Michael Mayer 2022-04-07 11:56:44 +02:00
parent b9ab3befe5
commit 67fdecfbef
3 changed files with 42 additions and 44 deletions

View file

@ -46,19 +46,17 @@ func configAction(ctx *cli.Context) error {
// Other paths.
fmt.Printf("%-25s %s\n", "storage-path", conf.StoragePath())
fmt.Printf("%-25s %s\n", "import-path", conf.ImportPath())
fmt.Printf("%-25s %s\n", "cache-path", conf.CachePath())
fmt.Printf("%-25s %s\n", "sidecar-path", conf.SidecarPath())
fmt.Printf("%-25s %s\n", "cache-path", conf.CachePath())
fmt.Printf("%-25s %s\n", "albums-path", conf.AlbumsPath())
fmt.Printf("%-25s %s\n", "temp-path", conf.TempPath())
fmt.Printf("%-25s %s\n", "backup-path", conf.BackupPath())
fmt.Printf("%-25s %s\n", "import-path", conf.ImportPath())
fmt.Printf("%-25s %s\n", "assets-path", conf.AssetsPath())
// Assets.
fmt.Printf("%-25s %s\n", "static-path", conf.StaticPath())
fmt.Printf("%-25s %s\n", "build-path", conf.BuildPath())
fmt.Printf("%-25s %s\n", "img-path", conf.ImgPath())
fmt.Printf("%-25s %s\n", "templates-path", conf.TemplatesPath())
fmt.Printf("%-25s %s\n", "temp-path", conf.TempPath())
// Workers.
fmt.Printf("%-25s %d\n", "workers", conf.Workers())
@ -151,8 +149,8 @@ func configAction(ctx *cli.Context) error {
// Thumbnails.
fmt.Printf("%-25s %s\n", "download-token", conf.DownloadToken())
fmt.Printf("%-25s %s\n", "preview-token", conf.PreviewToken())
fmt.Printf("%-25s %s\n", "thumb-filter", conf.ThumbFilter())
fmt.Printf("%-25s %s\n", "thumb-color", conf.ThumbColor())
fmt.Printf("%-25s %s\n", "thumb-filter", conf.ThumbFilter())
fmt.Printf("%-25s %t\n", "thumb-uncached", conf.ThumbUncached())
fmt.Printf("%-25s %d\n", "thumb-size", conf.ThumbSizePrecached())
fmt.Printf("%-25s %d\n", "thumb-size-uncached", conf.ThumbSizeUncached())

View file

@ -99,40 +99,40 @@ var GlobalFlags = []cli.Flag{
EnvVar: "PHOTOPRISM_RESOLUTION_LIMIT",
},
cli.StringFlag{
Name: "storage-path",
Usage: "writable storage `PATH` for cache, database, and sidecar files",
Name: "storage-path, s",
Usage: "writable storage `PATH` for sidecar, cache, and database files",
EnvVar: "PHOTOPRISM_STORAGE_PATH",
},
cli.StringFlag{
Name: "import-path",
Usage: "base `PATH` from which files can be imported to originals (optional)",
EnvVar: "PHOTOPRISM_IMPORT_PATH",
},
cli.StringFlag{
Name: "cache-path",
Usage: "custom cache `PATH` for sessions and thumbnail files (optional)",
EnvVar: "PHOTOPRISM_CACHE_PATH",
},
cli.StringFlag{
Name: "sidecar-path",
Usage: "custom relative or absolute sidecar `PATH` (optional)",
EnvVar: "PHOTOPRISM_SIDECAR_PATH",
},
cli.StringFlag{
Name: "temp-path",
Usage: "custom temporary file `PATH` (optional)",
EnvVar: "PHOTOPRISM_TEMP_PATH",
Name: "cache-path",
Usage: "custom cache `PATH` for sessions and thumbnail files (optional)",
EnvVar: "PHOTOPRISM_CACHE_PATH",
},
cli.StringFlag{
Name: "backup-path",
Usage: "custom backup `PATH` for index backup files (optional)",
EnvVar: "PHOTOPRISM_BACKUP_PATH",
},
cli.StringFlag{
Name: "import-path",
Usage: "base `PATH` from which files can be imported to originals (optional)",
EnvVar: "PHOTOPRISM_IMPORT_PATH",
},
cli.StringFlag{
Name: "assets-path",
Usage: "assets `PATH` containing static resources like icons, models, and translations",
EnvVar: "PHOTOPRISM_ASSETS_PATH",
},
cli.StringFlag{
Name: "temp-path",
Usage: "temporary file `PATH` (optional)",
EnvVar: "PHOTOPRISM_TEMP_PATH",
},
cli.IntFlag{
Name: "workers, w",
Usage: "maximum `NUMBER` of indexing workers, default depends on the number of physical cores",
@ -243,7 +243,7 @@ var GlobalFlags = []cli.Flag{
EnvVar: "PHOTOPRISM_DETECT_NSFW",
},
cli.BoolFlag{
Name: "upload-nsfw",
Name: "upload-nsfw, n",
Usage: "allow uploads that may be offensive",
EnvVar: "PHOTOPRISM_UPLOAD_NSFW",
},
@ -254,7 +254,7 @@ var GlobalFlags = []cli.Flag{
EnvVar: "PHOTOPRISM_DEFAULT_THEME",
},
cli.StringFlag{
Name: "default-locale",
Name: "default-locale, lang",
Usage: "standard user interface language `CODE`",
Value: i18n.Default.Locale(),
EnvVar: "PHOTOPRISM_DEFAULT_LOCALE",
@ -282,7 +282,7 @@ var GlobalFlags = []cli.Flag{
EnvVar: "PHOTOPRISM_CDN_URL",
},
cli.StringFlag{
Name: "site-url",
Name: "site-url, url",
Usage: "public site `URL`",
Value: "http://localhost:2342/",
EnvVar: "PHOTOPRISM_SITE_URL",
@ -327,18 +327,18 @@ var GlobalFlags = []cli.Flag{
EnvVar: "PHOTOPRISM_IMPRINT_URL",
},
cli.IntFlag{
Name: "http-port",
Name: "http-port, port",
Value: 2342,
Usage: "http server port `NUMBER`",
EnvVar: "PHOTOPRISM_HTTP_PORT",
},
cli.StringFlag{
Name: "http-host",
Name: "http-host, ip",
Usage: "http server `IP` address",
EnvVar: "PHOTOPRISM_HTTP_HOST",
},
cli.StringFlag{
Name: "http-mode, m",
Name: "http-mode, mode",
Usage: "http server `MODE` (debug, release, or test)",
EnvVar: "PHOTOPRISM_HTTP_MODE",
},
@ -445,13 +445,13 @@ var GlobalFlags = []cli.Flag{
EnvVar: "PHOTOPRISM_FFMPEG_BIN",
},
cli.StringFlag{
Name: "ffmpeg-encoder",
Name: "ffmpeg-encoder, vc",
Usage: "FFmpeg AVC encoder `NAME`",
Value: "libx264",
EnvVar: "PHOTOPRISM_FFMPEG_ENCODER",
},
cli.IntFlag{
Name: "ffmpeg-bitrate",
Name: "ffmpeg-bitrate, vb",
Usage: "maximum FFmpeg encoding `BITRATE` (Mbit/s)",
Value: 50,
EnvVar: "PHOTOPRISM_FFMPEG_BITRATE",
@ -472,43 +472,43 @@ var GlobalFlags = []cli.Flag{
Usage: "`SECRET` thumbnail and video streaming URL token (default: random)",
EnvVar: "PHOTOPRISM_PREVIEW_TOKEN",
},
cli.StringFlag{
Name: "thumb-filter",
Usage: "image downscaling `FILTER` (best to worst: blackman, lanczos, cubic, linear)",
Value: "lanczos",
EnvVar: "PHOTOPRISM_THUMB_FILTER",
},
cli.StringFlag{
Name: "thumb-color",
Usage: "standard color `PROFILE` for thumbnails (leave blank to disable)",
Value: "sRGB",
EnvVar: "PHOTOPRISM_THUMB_COLOR",
},
cli.StringFlag{
Name: "thumb-filter, filter",
Usage: "image downscaling filter `NAME` (best to worst: blackman, lanczos, cubic, linear)",
Value: "lanczos",
EnvVar: "PHOTOPRISM_THUMB_FILTER",
},
cli.BoolFlag{
Name: "thumb-uncached, u",
Name: "thumb-uncached, x",
Usage: "enable on-demand creation of missing thumbnails (high memory and cpu usage)",
EnvVar: "PHOTOPRISM_THUMB_UNCACHED",
},
cli.IntFlag{
Name: "thumb-size, s",
Name: "thumb-size, ts",
Usage: "maximum size of thumbnails created during indexing in `PIXELS` (720-7680)",
Value: 2048,
EnvVar: "PHOTOPRISM_THUMB_SIZE",
},
cli.IntFlag{
Name: "thumb-size-uncached, x",
Name: "thumb-size-uncached, tx",
Usage: "maximum size of missing thumbnails created on demand in `PIXELS` (720-7680)",
Value: 7680,
EnvVar: "PHOTOPRISM_THUMB_SIZE_UNCACHED",
},
cli.IntFlag{
Name: "jpeg-size",
Name: "jpeg-size, js",
Usage: "maximum size of created JPEG sidecar files in `PIXELS` (720-30000)",
Value: 7680,
EnvVar: "PHOTOPRISM_JPEG_SIZE",
},
cli.StringFlag{
Name: "jpeg-quality, q",
Name: "jpeg-quality, jq",
Usage: "`QUALITY` of created JPEG sidecars and thumbnails (25-100, best, high, default, low, worst)",
Value: thumb.JpegQuality.String(),
EnvVar: "PHOTOPRISM_JPEG_QUALITY",

View file

@ -57,12 +57,12 @@ type Options struct {
OriginalsLimit int `yaml:"OriginalsLimit" json:"OriginalsLimit" flag:"originals-limit"`
ResolutionLimit int `yaml:"ResolutionLimit" json:"ResolutionLimit" flag:"resolution-limit"`
StoragePath string `yaml:"StoragePath" json:"-" flag:"storage-path"`
ImportPath string `yaml:"ImportPath" json:"-" flag:"import-path"`
CachePath string `yaml:"CachePath" json:"-" flag:"cache-path"`
SidecarPath string `yaml:"SidecarPath" json:"-" flag:"sidecar-path"`
TempPath string `yaml:"TempPath" json:"-" flag:"temp-path"`
CachePath string `yaml:"CachePath" json:"-" flag:"cache-path"`
BackupPath string `yaml:"BackupPath" json:"-" flag:"backup-path"`
ImportPath string `yaml:"ImportPath" json:"-" flag:"import-path"`
AssetsPath string `yaml:"AssetsPath" json:"-" flag:"assets-path"`
TempPath string `yaml:"TempPath" json:"-" flag:"temp-path"`
Workers int `yaml:"Workers" json:"Workers" flag:"workers"`
WakeupInterval time.Duration `yaml:"WakeupInterval" json:"WakeupInterval" flag:"wakeup-interval"`
AutoIndex int `yaml:"AutoIndex" json:"AutoIndex" flag:"auto-index"`
@ -126,8 +126,8 @@ type Options struct {
DetachServer bool `yaml:"DetachServer" json:"-" flag:"detach-server"`
DownloadToken string `yaml:"DownloadToken" json:"-" flag:"download-token"`
PreviewToken string `yaml:"PreviewToken" json:"-" flag:"preview-token"`
ThumbFilter string `yaml:"ThumbFilter" json:"ThumbFilter" flag:"thumb-filter"`
ThumbColor string `yaml:"ThumbColor" json:"ThumbColor" flag:"thumb-color"`
ThumbFilter string `yaml:"ThumbFilter" json:"ThumbFilter" flag:"thumb-filter"`
ThumbUncached bool `yaml:"ThumbUncached" json:"ThumbUncached" flag:"thumb-uncached"`
ThumbSize int `yaml:"ThumbSize" json:"ThumbSize" flag:"thumb-size"`
ThumbSizeUncached int `yaml:"ThumbSizeUncached" json:"ThumbSizeUncached" flag:"thumb-size-uncached"`