Documentation
¶
Index ¶
- Constants
- Variables
- func CurrentExecutablePath() string
- func CurrentPlatformSupported() bool
- func DataDirPath() (string, error)
- func DisplayVersion(version string)
- func InstallLatestReleaseAsset(version, url, executablePath string) error
- func InstallLatestReleaseAssetWithProgress(version, url, executablePath string, onProgress UpdateProgressFunc) error
- func NormalizeConfiguredColor(value string) string
- func ParseRowNum(rowNum string) (int, error)
- func RemoveBookshelfBook(store *BookshelfStore, path string)
- func SaveBookmarks(store *BookmarkStore) error
- func SaveBookshelf(store *BookshelfStore) error
- func SaveConfig(cfg *Config) error
- func SaveProgress(store *ProgressStore) error
- func ShouldOfferUpdate(currentVersion, latestVersion string) bool
- func SortBooks(books []BookshelfBook, order string)
- func UpsertBookshelfBook(store *BookshelfStore, book BookshelfBook)
- type Bookmark
- type BookmarkStore
- type BookshelfBook
- type BookshelfStore
- type Config
- type ProgressAnchor
- type ProgressStore
- type ReleaseAsset
- type ReleaseInfo
- type UpdateInstallError
- type UpdateProgress
- type UpdateProgressFunc
Constants ¶
View Source
const ( UpdateStageDownload = "download" UpdateStageExtract = "extract" UpdateStageReplace = "replace" )
Variables ¶
View Source
var (
// Logo
Logo = `
ReadCLI V%s
https://github.com/lvshp/ReadCLI
`
)
Functions ¶
func CurrentExecutablePath ¶
func CurrentExecutablePath() string
func CurrentPlatformSupported ¶
func CurrentPlatformSupported() bool
func DataDirPath ¶
func DisplayVersion ¶
func DisplayVersion(version string)
func InstallLatestReleaseAssetWithProgress ¶ added in v0.3.5
func InstallLatestReleaseAssetWithProgress(version, url, executablePath string, onProgress UpdateProgressFunc) error
func ParseRowNum ¶
func RemoveBookshelfBook ¶
func RemoveBookshelfBook(store *BookshelfStore, path string)
func SaveBookmarks ¶
func SaveBookmarks(store *BookmarkStore) error
func SaveBookshelf ¶
func SaveBookshelf(store *BookshelfStore) error
func SaveConfig ¶
func SaveProgress ¶
func SaveProgress(store *ProgressStore) error
func ShouldOfferUpdate ¶
func SortBooks ¶
func SortBooks(books []BookshelfBook, order string)
func UpsertBookshelfBook ¶
func UpsertBookshelfBook(store *BookshelfStore, book BookshelfBook)
Types ¶
type BookmarkStore ¶
func LoadBookmarks ¶
func LoadBookmarks() (*BookmarkStore, error)
type BookshelfBook ¶
type BookshelfBook struct {
Path string `json:"path"`
Title string `json:"title"`
Format string `json:"format"`
ProgressPos int `json:"progress_pos"`
ProgressTotal int `json:"progress_total"`
ProgressPercent int `json:"progress_percent"`
CurrentChapter string `json:"current_chapter"`
ChapterIndex int `json:"chapter_index"`
ChapterOffset float64 `json:"chapter_offset"`
LastReadAt string `json:"last_read_at"`
ImportedAt string `json:"imported_at"`
}
func FilterBooks ¶
func FilterBooks(books []BookshelfBook, filter string) []BookshelfBook
func FindBookshelfBook ¶
func FindBookshelfBook(store *BookshelfStore, path string) (BookshelfBook, bool)
type BookshelfStore ¶
type BookshelfStore struct {
Books []BookshelfBook `json:"books"`
}
func LoadBookshelf ¶
func LoadBookshelf() (*BookshelfStore, error)
type Config ¶
type Config struct {
Theme string `json:"theme"`
DisplayLines int `json:"display_lines"`
ShowBorder bool `json:"show_border"`
CompactMode bool `json:"compact_mode"`
SelectedBookshelf int `json:"selected_bookshelf"`
SkippedUpdateVersion string `json:"skipped_update_version"`
BossKeyCommand string `json:"boss_key_command"`
ForceBasicColor bool `json:"force_basic_color"`
AutoPageIntervalMs int `json:"auto_page_interval_ms"`
ReadingContentWidthRatio float64 `json:"reading_content_width_ratio"`
ReadingAlignment string `json:"reading_alignment,omitempty"`
ReadingMarginLeft int `json:"reading_margin_left"`
ReadingMarginRight int `json:"reading_margin_right"`
ReadingMarginTop int `json:"reading_margin_top"`
ReadingMarginBottom int `json:"reading_margin_bottom"`
ReadingLineSpacing int `json:"reading_line_spacing"`
ReadingTextColor string `json:"reading_text_color"`
ReadingHighContrast bool `json:"reading_high_contrast"`
}
func LoadConfig ¶
type ProgressAnchor ¶
type ProgressStore ¶
type ProgressStore struct {
Books map[string]int `json:"books"`
Anchors map[string]ProgressAnchor `json:"anchors,omitempty"`
}
func LoadProgress ¶
func LoadProgress() (*ProgressStore, error)
type ReleaseAsset ¶
type ReleaseAsset struct {
Name string `json:"name"`
BrowserDownloadURL string `json:"browser_download_url"`
}
func SelectReleaseAsset ¶
func SelectReleaseAsset(release *ReleaseInfo, goos, goarch string) *ReleaseAsset
type ReleaseInfo ¶
type ReleaseInfo struct {
TagName string `json:"tag_name"`
Name string `json:"name"`
Body string `json:"body"`
Assets []ReleaseAsset `json:"assets"`
}
func FetchLatestRelease ¶
func FetchLatestRelease(version string) (*ReleaseInfo, error)
type UpdateInstallError ¶
func (*UpdateInstallError) Error ¶
func (e *UpdateInstallError) Error() string
type UpdateProgress ¶ added in v0.3.5
type UpdateProgressFunc ¶ added in v0.3.5
type UpdateProgressFunc func(UpdateProgress)
Click to show internal directories.
Click to hide internal directories.