Documentation
¶
Overview ¶
Package hooks permits to register custom hooks that will be called during the parsing process of a bookmark file. Hooks can be used to extract tags, commands or other custom data from a bookmark title or description.
They can effectively be used as a command line interface to the host system through the browser builtin Ctrl+D bookmark feature.
This is an example implementation of a hook that simply sends a notification using the notification daemon of the system.
Index ¶
- Variables
- func BkMktabHook(b *gosuki.Bookmark) error
- func BkNotifySend(b *gosuki.Bookmark) error
- func NodeMktabHook(n *tree.Node) error
- func NodeNotifySend(n *tree.Node) error
- func SortByPriority(hooks []NamedHook)
- type Hook
- type HookMap
- type HookRunner
- type Hookable
- type MarkTab
- type NamedHook
- type Rule
Constants ¶
This section is empty.
Variables ¶
var Defined = HookMap{ "node_tags_from_name": Hook[*tree.Node]{ Func: parsing.ParseNodeTags, // contains filtered or unexported fields }, "bk_tags_from_name": Hook[*gosuki.Bookmark]{ Func: parsing.ParseBkTags, // contains filtered or unexported fields }, }
Functions ¶
func BkMktabHook ¶
func BkNotifySend ¶
func NodeMktabHook ¶
func NodeNotifySend ¶
func SortByPriority ¶
func SortByPriority(hooks []NamedHook)
Types ¶
type Hook ¶
type Hook[T Hookable] struct { // Function to call on a node/bookmark Func func(T) error // contains filtered or unexported fields }
A Hook is a function that takes a *Bookmark or *Node and runs an arbitrary process. Hooks are called during the loading or real time detection of bookmarks.
For example the TAG extraction process is handled by the ParseXTags hooks.
Hooks can also be used handle call custom user commands and messages found in the various fields of a bookmark.
type HookRunner ¶
Browser who implement this interface will be able to register custom hooks which are called during the main Run() to handle commands and messages found in tags and parsed data from browsers
type MarkTab ¶
type MarkTab struct {
Rules []Rule // Rules contains all the parsed rules from the marktab file.
}
MarkTab represents a collection of rules defined in the marktab file as lines.
type Rule ¶
type Rule struct { Trigger string // keyword to detect in the bookmark tags Pattern string // regular expression used for matching against the bookmark URL or title. Command string // shell command to execute when both the trigger and pattern match the bookmark tags. // contains filtered or unexported fields }