Documentation ¶
Index ¶
- Constants
- Variables
- func CopyFile(src, dst string) (int64, error)
- func GetTime(ts string) string
- type Article
- type Command
- type Config
- type Controller
- func (c *Controller) GetArticleForSelection() *Article
- func (c *Controller) GetArticlesFromDB()
- func (c *Controller) GetConfigKeys() map[string]string
- func (c *Controller) Init(cfg, theme, db string)
- func (c *Controller) Input(e *tcell.EventKey) *tcell.EventKey
- func (c *Controller) OpenLink(link string)
- func (c *Controller) Quit()
- func (c *Controller) SelectArticle(row, col int)
- func (c *Controller) SelectFeed(row, col int)
- func (c *Controller) ShowArticles(feed string)
- func (c *Controller) ShowFeeds()
- func (c *Controller) UpdateFeeds()
- func (c *Controller) UpdateLoop()
- type DB
- func (d *DB) All() []Article
- func (d *DB) CleanupDB()
- func (d *DB) Delete(a *Article)
- func (d *DB) Init(c *Controller, dbFile string) error
- func (d *DB) MarkAllRead(feed string)
- func (d *DB) MarkAllUnread(feed string)
- func (d *DB) MarkRead(a *Article) error
- func (d *DB) MarkUnread(a Article) error
- func (d *DB) Save(a Article) error
- type Feed
- type RSS
- type Theme
- type Window
- func (w *Window) AddPreview(a *Article)
- func (w *Window) AddToArticles(a *Article, markedWeb bool)
- func (w *Window) AddToFeeds(name, displayName string, unread, total int, ref *Article)
- func (w *Window) ArticlesHasFocus() bool
- func (w *Window) AskQuit()
- func (w *Window) ClearArticles()
- func (w *Window) ClearFeeds()
- func (w *Window) ClearPreview()
- func (w *Window) Init(inputFunc func(*tcell.EventKey) *tcell.EventKey, c *Controller)
- func (w *Window) MoveDown(focus tview.Primitive)
- func (w *Window) MoveUp(focus tview.Primitive)
- func (w *Window) RegisterSelectedFeedFunc(f func(r, c int))
- func (w *Window) RegisterSelectedFunc(f func(r, c int))
- func (w *Window) RegisterSelectionChangedFunc(f func(r, c int))
- func (w *Window) Search()
- func (w *Window) SelectArticleWindow()
- func (w *Window) SelectFeedWindow()
- func (w *Window) SelectPreviewWindow()
- func (w *Window) SetupWindow()
- func (w *Window) Start()
- func (w *Window) StatusUpdate()
- func (w *Window) SwitchFocus()
- func (w *Window) ToggleHelp()
- func (w *Window) TogglePreview()
- func (w *Window) UpdateStatusTicker()
Constants ¶
const ( // KeyCell - KeyCell = iota // ActionCell - ActionCell )
Variables ¶
var Version string
Version is version of the application
Functions ¶
Types ¶
type Article ¶
type Article struct {
// contains filtered or unexported fields
}
Article holds the content of a feed item
type Config ¶
type Config struct { Highlights []string `json:"highlights"` InputFeeds []interface{} `json:"feeds"` Feeds []Feed `json:"-"` OPMLFile string `json:"opmlFile"` FeedWindowSizeRatio int `json:"feedWindowSizeRatio"` ArticleWindowSizeRatio int `json:"articleWindowSizeRatio"` PreviewWindowSizeRatio int `json:"previewWindowSizeRatio"` ArticlePreviewWindowSizeRatio int `json:"articlePreviewWindowSizeRatio"` SecondsBetweenUpdates int `json:"secondsBetweenUpdates"` SkipArticlesOlderThanDays int `json:"skipArticlesOlderThanDays"` DaysToKeepDeletedArticlesInDB int `json:"daysToKeepDeletedArticlesInDB"` DaysToKeepReadArticlesInDB int `json:"daysToKeepReadArticlesInDB"` SkipPreviewInTab bool `json:"skipPreviewInTab"` KeyOpenLink string `json:"keyOpenLink"` KeyMarkLink string `json:"keyMarkLink"` KeyOpenMarked string `json:"keyOpenMarked"` KeyDeleteArticle string `json:"keyDeleteArticle"` KeyMoveDown string `json:"keyMoveDown"` KeyMoveUp string `json:"keyMoveUp"` KeyFeedDown string `json:"keyFeedDown"` KeyFeedUp string `json:"keyFeedUp"` KeySortByDate string `json:"keySortByDate"` KeySortByTitle string `json:"keySortByTitle"` KeySortByUnread string `json:"keySortByUnread"` KeySortByFeed string `json:"keySortByFeed"` KeyUpdateFeeds string `json:"keyUpdateFeeds"` KeyMarkAllRead string `json:"keyMarkAllRead"` KeyMarkAllReadFeed string `json:"keyMarkAllReadFeed"` KeyMarkAllUnread string `json:"keyMarkAllUnread"` KeyMarkAllUnreadFeed string `json:"keyMarkAllUnreadFeed"` KeyTogglePreview string `json:"keyTogglePreview"` KeySelectFeedWindow string `json:"keySelectFeedWindow"` KeySelectArticleWindow string `json:"keySelectArticleWindow"` KeySelectPreviewWindow string `json:"keySelectPreviewWindow"` KeyToggleHelp string `json:"keyToggleHelp"` KeySwitchWindows string `json:"keySwitchWindows"` KeyQuit string `json:"keyQuit"` KeyUndoLastRead string `json:"keyUndoLastRead"` KeySearchPromt string `json:"keySearchPromt"` // WebBrowser overrides the default program used to open links. Default one depends on the OS: // * `xdg-open` for Linux // * `url.dll,FileProtocolHandler` for Windows // * `open` for Darwin WebBrowser string `json:"webBrowser"` CustomCommands []Command `json:"customCommands"` Notifications bool `json:"notifications"` }
Config load the configuration from JSON file
func LoadConfiguration ¶
LoadConfiguration takes a filename (configuration) and loads it.
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller handles the logic and keep everything together
func (*Controller) GetArticleForSelection ¶
func (c *Controller) GetArticleForSelection() *Article
GetArticleForSelection returns the article instance for the selected article in the aritcles table.
func (*Controller) GetArticlesFromDB ¶
func (c *Controller) GetArticlesFromDB()
GetArticlesFromDB fetches all articles from the database
func (*Controller) GetConfigKeys ¶
func (c *Controller) GetConfigKeys() map[string]string
GetConfigKeys creates a list of keys that we want to present in the help section.
func (*Controller) Init ¶
func (c *Controller) Init(cfg, theme, db string)
Init initiates the controller with database handles etc. It also starts the update loop and window handling.
func (*Controller) Input ¶
func (c *Controller) Input(e *tcell.EventKey) *tcell.EventKey
Input handles keystrokes
func (*Controller) OpenLink ¶
func (c *Controller) OpenLink(link string)
OpenLink opens a link in the default webbrowser.
func (*Controller) SelectArticle ¶
func (c *Controller) SelectArticle(row, col int)
SelectArticle is used a hook for article selection
func (*Controller) SelectFeed ¶
func (c *Controller) SelectFeed(row, col int)
SelectFeed is used as a callback for feed selection
func (*Controller) ShowArticles ¶
func (c *Controller) ShowArticles(feed string)
ShowArticles lists all articles for the current feed
func (*Controller) ShowFeeds ¶
func (c *Controller) ShowFeeds()
ShowFeeds updates the feeds window with the current feeds and statuses
func (*Controller) UpdateFeeds ¶
func (c *Controller) UpdateFeeds()
UpdateFeeds updates the articles kept in the controller
func (*Controller) UpdateLoop ¶
func (c *Controller) UpdateLoop()
UpdateLoop updates the feeds and windows
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB holds the database information
func (*DB) Init ¶
func (d *DB) Init(c *Controller, dbFile string) error
Init setups the database and creates tables if needed.
func (*DB) MarkAllRead ¶
MarkAllRead marks all articles in the database as read
func (*DB) MarkAllUnread ¶
MarkAllUnread marks all articles in the database as not read
func (*DB) MarkUnread ¶
MarkUnread marks an article as unread in the database
type RSS ¶
type RSS struct {
// contains filtered or unexported fields
}
RSS structure for handle parsing of RSS/Atom feeds
func (*RSS) FetchURL ¶
FetchURL fetches the feed URL and also fakes the user-agent to be able to retrieve data from sites like reddit.
func (*RSS) GetURLFromOPML ¶
GetURLFromOPML retrieves any URL from the OPML object
type Theme ¶
type Theme struct { FeedNames []string `json:"feedNames"` Date string `json:"date"` Time string `json:"time"` ArticleBorder string `json:"articleBorder"` PreviewBorder string `json:"previewBorder"` FeedBorder string `json:"feedBorder"` ArticleBorderTitle string `json:"articleBorderTitle"` FeedBorderTitle string `json:"feedBorderTitle"` PreviewBorderTitle string `json:"previewBorderTitle"` Highlights string `json:"highlights"` TableHead string `json:"tableHead"` Title string `json:"title"` UnreadFeedName string `json:"unreadFeedName"` TotalColumn string `json:"totalColumn"` UnreadColumn string `json:"unreadColumn"` PreviewText string `json:"previewText"` PreviewLink string `json:"previewLink"` UnreadMarker string `json:"unreadMarker"` LinkMarker string `json:"linkMarker"` FeedIcon string `json:"feedIcon"` ArticleIcon string `json:"articleIcon"` PreviewIcon string `json:"previewIcon"` StatusBackground string `json:"statusBackground"` StatusText string `json:"statusText"` StatusKey string `json:"statusKey"` StatusBrackets string `json:"statusBrackets"` }
Theme holds all colors for the theme
type Window ¶
type Window struct {
// contains filtered or unexported fields
}
Window holds all information regarding the Window layout and functionality
func (*Window) AddPreview ¶
AddPreview shows an article in the preview window
func (*Window) AddToArticles ¶
AddToArticles adds an article to the article window
func (*Window) AddToFeeds ¶
AddToFeeds add a new feed to the feed window
func (*Window) ArticlesHasFocus ¶
ArticlesHasFocus returns true if the aricles window has focus
func (*Window) ClearArticles ¶
func (w *Window) ClearArticles()
ClearArticles resets the articles window
func (*Window) ClearPreview ¶
func (w *Window) ClearPreview()
ClearPreview clears the preview window
func (*Window) Init ¶
func (w *Window) Init(inputFunc func(*tcell.EventKey) *tcell.EventKey, c *Controller)
Init sets up all information regarding widgets
func (*Window) RegisterSelectedFeedFunc ¶
RegisterSelectedFeedFunc registers a hook function for selecting feed
func (*Window) RegisterSelectedFunc ¶
RegisterSelectedFunc registers a hook function for selected article
func (*Window) RegisterSelectionChangedFunc ¶
RegisterSelectionChangedFunc registers a hook for change events for articles
func (*Window) SelectArticleWindow ¶
func (w *Window) SelectArticleWindow()
SelectArticleWindow selects the article window (focus)
func (*Window) SelectFeedWindow ¶
func (w *Window) SelectFeedWindow()
SelectFeedWindow selects the feed window (focus)
func (*Window) SelectPreviewWindow ¶
func (w *Window) SelectPreviewWindow()
SelectPreviewWindow selects the preview window (focus)
func (*Window) Start ¶
func (w *Window) Start()
Start initiates the application for the window system and sets its root
func (*Window) StatusUpdate ¶
func (w *Window) StatusUpdate()
StatusUpdate updates the status window with updated information
func (*Window) SwitchFocus ¶
func (w *Window) SwitchFocus()
SwitchFocus switches the focus between windows in a round-robin manner
func (*Window) ToggleHelp ¶
func (w *Window) ToggleHelp()
ToggleHelp shows/hides the keyboard shortchuts
func (*Window) TogglePreview ¶
func (w *Window) TogglePreview()
TogglePreview shows/hides the preview window for an article
func (*Window) UpdateStatusTicker ¶
func (w *Window) UpdateStatusTicker()
UpdateStatusTicker calls StatusUpdate periodically