Documentation
¶
Overview ¶
Copyright © 2025 Thomas von Dein
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Copyright © 2025-2026 Thomas von Dein ¶
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Copyright © 2025 Thomas von Dein ¶
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Copyright © 2025 Thomas von Dein ¶
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Copyright © 2025 Thomas von Dein ¶
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Copyright © 2025 Thomas von Dein ¶
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Index ¶
- Constants
- Variables
- func Die(err error) int
- func Execute(output io.Writer) int
- func FileExists(filename string) bool
- func GetProgress(conf *Config) (int64, error)
- func Mkdir(dir string) error
- func Pager(book *Ebook) (int, error)
- func Slug(input string) string
- func StoreProgress(conf *Config, progress int) error
- func WriteFile(filename string, content []byte) error
- type ColorSetting
- type Colors
- type Config
- type Doc
- type Ebook
- type Meta
- type UserConfig
Constants ¶
const ( Version string = `v0.0.8` Usage string = `` /* 673-byte string literal not displayed */ )
const ( MarginStep = 5 MinSize = 40 )
Variables ¶
var ( DefaultDark = ColorSetting{ Title: "#ff4500", Chapter: "#ff4500", Body: "#cdb79e", } DefaultLight = ColorSetting{ Title: "#ff0000", Chapter: "#8b0000", Body: "#696969", } )
Functions ¶
func FileExists ¶
func GetProgress ¶
func StoreProgress ¶
Types ¶
type ColorSetting ¶
type Colors ¶
func SetColorconfig ¶
func SetColorconfig(defaultdark, defaultlight ColorSetting, conf *Config) Colors
type Config ¶
type Config struct {
Showversion bool `koanf:"version"` // -v
Debug bool `koanf:"debug"` // -d
StoreProgress bool `koanf:"store-progress"` // -s
Darkmode bool `koanf:"dark"` // -D
LineNumbers bool `koanf:"line-numbers"` // -n
Dump bool `koanf:"txt"` // -t
XML bool `koanf:"xml"` // -x
NoColor bool `koanf:"no-color"` // -n
Config string `koanf:"config"` // -c
ColorDark ColorSetting `koanf:"colordark"` // comes from config file only
ColorLight ColorSetting `koanf:"colorlight"` // comes from config file only
ShowHelp bool `koanf:"help"`
ShowCover bool `koanf:"cover-image"` // -i
CreateConfig bool `koanf:"create-config"` // --create-config
Colors Colors // generated from user config file or internal defaults, respects dark mode
Document string
InitialProgress int // lines
}
func (*Config) GetConfigDir ¶
func (*Config) WriteConfigFile ¶
type Doc ¶
type Doc struct {
Cover *termimg.ImageWidget
// contains filtered or unexported fields
}
type UserConfig ¶
type UserConfig struct {
StoreProgress bool `koanf:"store-progress"`
Darkmode bool `koanf:"dark"`
LineNumbers bool `koanf:"line-numbers"`
NoColor bool `koanf:"no-color"`
ColorDark ColorSetting `koanf:"colordark"`
ColorLight ColorSetting `koanf:"colorlight"`
}
used for config writing, it's a subset of the Config struct add fields as you add user configurable fields to Config