mirror of
https://github.com/celogeek/go-comic-converter.git
synced 2025-05-25 16:22:37 +02:00
reorg params and display relevant params only
This commit is contained in:
parent
a816350c97
commit
728129aba2
@ -110,7 +110,6 @@ func (c *Converter) InitParse() {
|
|||||||
c.AddIntParam(&c.Options.Brightness, "brightness", c.Options.Brightness, "Brightness readjustement: between -100 and 100, > 0 lighter, < 0 darker")
|
c.AddIntParam(&c.Options.Brightness, "brightness", c.Options.Brightness, "Brightness readjustement: between -100 and 100, > 0 lighter, < 0 darker")
|
||||||
c.AddIntParam(&c.Options.Contrast, "contrast", c.Options.Contrast, "Contrast readjustement: between -100 and 100, > 0 more contrast, < 0 less contrast")
|
c.AddIntParam(&c.Options.Contrast, "contrast", c.Options.Contrast, "Contrast readjustement: between -100 and 100, > 0 more contrast, < 0 less contrast")
|
||||||
c.AddBoolParam(&c.Options.AutoRotate, "autorotate", c.Options.AutoRotate, "Auto Rotate page when width > height")
|
c.AddBoolParam(&c.Options.AutoRotate, "autorotate", c.Options.AutoRotate, "Auto Rotate page when width > height")
|
||||||
c.AddBoolParam(&c.Options.Auto, "auto", false, "Activate all automatic options")
|
|
||||||
c.AddBoolParam(&c.Options.AutoSplitDoublePage, "autosplitdoublepage", c.Options.AutoSplitDoublePage, "Auto Split double page when width > height")
|
c.AddBoolParam(&c.Options.AutoSplitDoublePage, "autosplitdoublepage", c.Options.AutoSplitDoublePage, "Auto Split double page when width > height")
|
||||||
c.AddBoolParam(&c.Options.NoBlankImage, "noblankimage", c.Options.NoBlankImage, "Remove blank image")
|
c.AddBoolParam(&c.Options.NoBlankImage, "noblankimage", c.Options.NoBlankImage, "Remove blank image")
|
||||||
c.AddBoolParam(&c.Options.Manga, "manga", c.Options.Manga, "Manga mode (right to left)")
|
c.AddBoolParam(&c.Options.Manga, "manga", c.Options.Manga, "Manga mode (right to left)")
|
||||||
@ -128,8 +127,11 @@ func (c *Converter) InitParse() {
|
|||||||
c.AddBoolParam(&c.Options.Save, "save", false, "Save your parameters as default")
|
c.AddBoolParam(&c.Options.Save, "save", false, "Save your parameters as default")
|
||||||
c.AddBoolParam(&c.Options.Reset, "reset", false, "Reset your parameters to default")
|
c.AddBoolParam(&c.Options.Reset, "reset", false, "Reset your parameters to default")
|
||||||
|
|
||||||
|
c.AddSection("Shortcut")
|
||||||
|
c.AddBoolParam(&c.Options.Auto, "auto", false, "Activate all automatic options")
|
||||||
|
c.AddBoolParam(&c.Options.NoFilter, "nofilter", false, "Deactivate all filters")
|
||||||
|
|
||||||
c.AddSection("Other")
|
c.AddSection("Other")
|
||||||
c.AddBoolParam(&c.Options.NoFilter, "nofilter", false, "Disable all filter")
|
|
||||||
c.AddIntParam(&c.Options.Workers, "workers", runtime.NumCPU(), "Number of workers")
|
c.AddIntParam(&c.Options.Workers, "workers", runtime.NumCPU(), "Number of workers")
|
||||||
c.AddBoolParam(&c.Options.Dry, "dry", false, "Dry run to show all options")
|
c.AddBoolParam(&c.Options.Dry, "dry", false, "Dry run to show all options")
|
||||||
c.AddBoolParam(&c.Options.DryVerbose, "dry-verbose", false, "Display also sorted files after the TOC")
|
c.AddBoolParam(&c.Options.DryVerbose, "dry-verbose", false, "Display also sorted files after the TOC")
|
||||||
|
@ -31,7 +31,6 @@ type Options struct {
|
|||||||
CropRatioBottom int `yaml:"crop_ratio_bottom"`
|
CropRatioBottom int `yaml:"crop_ratio_bottom"`
|
||||||
Brightness int `yaml:"brightness"`
|
Brightness int `yaml:"brightness"`
|
||||||
Contrast int `yaml:"contrast"`
|
Contrast int `yaml:"contrast"`
|
||||||
Auto bool `yaml:"-"`
|
|
||||||
AutoRotate bool `yaml:"auto_rotate"`
|
AutoRotate bool `yaml:"auto_rotate"`
|
||||||
AutoSplitDoublePage bool `yaml:"auto_split_double_page"`
|
AutoSplitDoublePage bool `yaml:"auto_split_double_page"`
|
||||||
NoBlankImage bool `yaml:"no_blank_image"`
|
NoBlankImage bool `yaml:"no_blank_image"`
|
||||||
@ -50,9 +49,12 @@ type Options struct {
|
|||||||
Save bool `yaml:"-"`
|
Save bool `yaml:"-"`
|
||||||
Reset bool `yaml:"-"`
|
Reset bool `yaml:"-"`
|
||||||
|
|
||||||
|
// Shortcut
|
||||||
|
Auto bool `yaml:"-"`
|
||||||
|
NoFilter bool `yaml:"-"`
|
||||||
|
|
||||||
// Other
|
// Other
|
||||||
Workers int `yaml:"-"`
|
Workers int `yaml:"-"`
|
||||||
NoFilter bool `yaml:"-"`
|
|
||||||
Dry bool `yaml:"-"`
|
Dry bool `yaml:"-"`
|
||||||
DryVerbose bool `yaml:"-"`
|
DryVerbose bool `yaml:"-"`
|
||||||
Quiet bool `yaml:"-"`
|
Quiet bool `yaml:"-"`
|
||||||
@ -157,10 +159,6 @@ func (o *Options) ShowConfig() string {
|
|||||||
perfectHeight,
|
perfectHeight,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
limitmb := "nolimit"
|
|
||||||
if o.LimitMb > 0 {
|
|
||||||
limitmb = fmt.Sprintf("%d Mb", o.LimitMb)
|
|
||||||
}
|
|
||||||
|
|
||||||
sortpathmode := ""
|
sortpathmode := ""
|
||||||
switch o.SortPathMode {
|
switch o.SortPathMode {
|
||||||
@ -174,32 +172,35 @@ func (o *Options) ShowConfig() string {
|
|||||||
|
|
||||||
var b strings.Builder
|
var b strings.Builder
|
||||||
for _, v := range []struct {
|
for _, v := range []struct {
|
||||||
K string
|
Key string
|
||||||
V any
|
Value any
|
||||||
|
Condition bool
|
||||||
}{
|
}{
|
||||||
{"Profile", profileDesc},
|
{"Profile", profileDesc, true},
|
||||||
{"ViewRatio", fmt.Sprintf("1:%s", strings.TrimRight(fmt.Sprintf("%f", profiles.PerfectRatio), "0"))},
|
{"ViewRatio", fmt.Sprintf("1:%s", strings.TrimRight(fmt.Sprintf("%f", profiles.PerfectRatio), "0")), true},
|
||||||
{"View", viewDesc},
|
{"View", viewDesc, true},
|
||||||
{"Quality", o.Quality},
|
{"Format", o.Format, true},
|
||||||
{"Grayscale", o.Grayscale},
|
{"Quality", o.Quality, o.Format == "jpeg"},
|
||||||
{"Crop", o.Crop},
|
{"Grayscale", o.Grayscale, true},
|
||||||
{"CropRatio", fmt.Sprintf("%d Left - %d Up - %d Right - %d Bottom", o.CropRatioLeft, o.CropRatioUp, o.CropRatioRight, o.CropRatioBottom)},
|
{"Crop", o.Crop, true},
|
||||||
{"Brightness", o.Brightness},
|
{"CropRatio", fmt.Sprintf("%d Left - %d Up - %d Right - %d Bottom", o.CropRatioLeft, o.CropRatioUp, o.CropRatioRight, o.CropRatioBottom), o.Crop},
|
||||||
{"Contrast", o.Contrast},
|
{"Brightness", o.Brightness, o.Brightness != 0},
|
||||||
{"AutoRotate", o.AutoRotate},
|
{"Contrast", o.Contrast, o.Contrast != 0},
|
||||||
{"AutoSplitDoublePage", o.AutoSplitDoublePage},
|
{"AutoRotate", o.AutoRotate, true},
|
||||||
{"NoBlankImage", o.NoBlankImage},
|
{"AutoSplitDoublePage", o.AutoSplitDoublePage, true},
|
||||||
{"Manga", o.Manga},
|
{"NoBlankImage", o.NoBlankImage, true},
|
||||||
{"HasCover", o.HasCover},
|
{"Manga", o.Manga, true},
|
||||||
{"LimitMb", limitmb},
|
{"HasCover", o.HasCover, true},
|
||||||
{"StripFirstDirectoryFromToc", o.StripFirstDirectoryFromToc},
|
{"LimitMb", fmt.Sprintf("%d Mb", o.LimitMb), o.LimitMb != 0},
|
||||||
{"SortPathMode", sortpathmode},
|
{"StripFirstDirectoryFromToc", o.StripFirstDirectoryFromToc, true},
|
||||||
{"Foreground Color", fmt.Sprintf("#%s", o.ForegroundColor)},
|
{"SortPathMode", sortpathmode, true},
|
||||||
{"Background Color", fmt.Sprintf("#%s", o.BackgroundColor)},
|
{"Foreground Color", fmt.Sprintf("#%s", o.ForegroundColor), true},
|
||||||
{"Resize", !o.NoResize},
|
{"Background Color", fmt.Sprintf("#%s", o.BackgroundColor), true},
|
||||||
{"Format", o.Format},
|
{"Resize", !o.NoResize, true},
|
||||||
} {
|
} {
|
||||||
b.WriteString(fmt.Sprintf("\n %-26s: %v", v.K, v.V))
|
if v.Condition {
|
||||||
|
b.WriteString(fmt.Sprintf("\n %-26s: %v", v.Key, v.Value))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return b.String()
|
return b.String()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user