add line number support and support for text files

This commit is contained in:
2025-10-15 21:42:07 +02:00
parent ff9035f85f
commit 9c200de774
5 changed files with 66 additions and 19 deletions

View File

@@ -17,7 +17,17 @@ import (
const (
Version string = `v0.0.2`
Usage string = `epuppy [-vd] <epub file>`
Usage string = `Usage epuppy [options] <epub file>
Options:
-D --dark enable dark mode
-s --store-progress store and use previous (experimental)
-n --line-numbers add line numbers
-c --config <file> use config <file>
-d --debug enable debugging
-h --help show help message
-v --version show program version
`
)
type Config struct {
@@ -25,6 +35,7 @@ type Config struct {
Debug bool `koanf:"debug"` // -d
StoreProgress bool `koanf:"store-progress"` // -s
Darkmode bool `koanf:"dark"` // -D
LineNumbers bool `koanf:"line-numbers"` // -n
Config string `koanf:"config"` // -c
ColorDark ColorSetting `koanf:"colordark"` // comes from config file only
ColorLight ColorSetting `koanf:"colorlight"` // comes from config file only
@@ -52,6 +63,7 @@ func InitConfig(output io.Writer) (*Config, error) {
flagset.BoolP("debug", "d", false, "enable debugging")
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.StringP("config", "c", "", "read config from file")
if err := flagset.Parse(os.Args[1:]); err != nil {