Documentation ¶
Index ¶
- func CalculateExpectedReadTime(wordCount int) int
- func CheckURLMostRecentlyAdded(clipboardManager ClipboardManager) bool
- func GetFromClipboard(clipboardManager ClipboardManager) (string, error)
- func IsURL(urlStr string) bool
- func IsURLInClipboard(clipboardManager ClipboardManager) bool
- func OpenAuthURL(code string, redirectURI string, browserOpenFunc func(string))
- func OpenBrowser(url string)
- func UserHomeDir() string
- type ClipboardManager
- type ClipboardManagerImpl
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateExpectedReadTime ¶
CalculateExpectedReadTime calculates approx. read time in minutes based on Medium's estimate https://help.medium.com/hc/en-us/articles/214991667-Read-time
func CheckURLMostRecentlyAdded ¶
func CheckURLMostRecentlyAdded(clipboardManager ClipboardManager) bool
CheckURLMostRecentlyAdded checks to see if the text in clipboard is the same as the URL that was just added
func GetFromClipboard ¶
func GetFromClipboard(clipboardManager ClipboardManager) (string, error)
GetFromClipboard gets clipboard text from the clipboard manager
func IsURL ¶
IsURL determines whether supplied string is a URL https://stackoverflow.com/a/55551215/9292680
func IsURLInClipboard ¶
func IsURLInClipboard(clipboardManager ClipboardManager) bool
IsURLInClipboard checks to see if the clipboard text is actually a URL
func OpenAuthURL ¶
OpenAuthURL opens auth url
func UserHomeDir ¶
func UserHomeDir() string
UserHomeDir gets the user's home directory based on OS https://stackoverflow.com/a/7922977/9292680
Types ¶
type ClipboardManager ¶
type ClipboardManager interface { GetFromClipboard() (string, error) GetMostRecentlyAddedURL() string SetMostRecentlyAddedURL(url string) CopyToClipboard(text string) error }
ClipboardManager is an interface for actions with the clipboard
type ClipboardManagerImpl ¶
type ClipboardManagerImpl struct {
AddedURL string
}
ClipboardManagerImpl is an implementation of ClipboardManager that uses atotto's clipboard library
func (*ClipboardManagerImpl) CopyToClipboard ¶
func (c *ClipboardManagerImpl) CopyToClipboard(text string) error
CopyToClipboard writes supplied text to the clipboard using atotto's clipboard library
func (*ClipboardManagerImpl) GetFromClipboard ¶
func (c *ClipboardManagerImpl) GetFromClipboard() (string, error)
GetFromClipboard gets the clipboard text using atotto's clipboard library
func (*ClipboardManagerImpl) GetMostRecentlyAddedURL ¶
func (c *ClipboardManagerImpl) GetMostRecentlyAddedURL() string
GetMostRecentlyAddedURL gets the URL that was most recently added
func (*ClipboardManagerImpl) SetMostRecentlyAddedURL ¶
func (c *ClipboardManagerImpl) SetMostRecentlyAddedURL(url string)
SetMostRecentlyAddedURL sets the URL that was most recently added