Add dump feature, enhance code quality (#1)

This commit is contained in:
T.v.Dein
2025-10-16 12:24:47 +02:00
committed by GitHub
parent d9ed4dee10
commit 6099806e22
10 changed files with 125 additions and 423 deletions

View File

@@ -21,13 +21,13 @@ const (
Options:
-D --dark enable dark mode
-s --store-progress store and use previous (experimental)
-s --store-progress remember reading position
-n --line-numbers add line numbers
-c --config <file> use config <file>
-t --txt dump readable content to STDOUT
-d --debug enable debugging
-h --help show help message
-v --version show program version
`
-v --version show program version`
)
type Config struct {
@@ -36,6 +36,7 @@ type Config struct {
StoreProgress bool `koanf:"store-progress"` // -s
Darkmode bool `koanf:"dark"` // -D
LineNumbers bool `koanf:"line-numbers"` // -n
Dump bool `koanf:"txt"` // -t
Config string `koanf:"config"` // -c
ColorDark ColorSetting `koanf:"colordark"` // comes from config file only
ColorLight ColorSetting `koanf:"colorlight"` // comes from config file only
@@ -64,6 +65,7 @@ func InitConfig(output io.Writer) (*Config, error) {
flagset.BoolP("dark", "D", false, "enable dark mode")
flagset.BoolP("store-progress", "s", false, "store reading progress")
flagset.BoolP("line-numbers", "n", false, "add line numbers")
flagset.BoolP("txt", "t", false, "dump readable content to STDOUT")
flagset.StringP("config", "c", "", "read config from file")
if err := flagset.Parse(os.Args[1:]); err != nil {