Documentation
¶
Overview ¶
Package marktab handles reading and parsing of marktab files, inspired by the crontab file format. Marktab files are text files that define rules and actions to execute when gosuki detects a bookmark with tags matching the defined rule.
Marktab Format: ¶
Each line in a marktab file represents a rule. A rule consists of three fields: trigger, pattern, and command. The syntax for each line is as follows:
# * * * # | | |_____ shell command to execute # | |_________ pattern to match on the url or title # |____________ trigger keyword to detect on the tags
Example:
notify .* my_notify_script
The syntax of each line expects an expression made of three field: trigger, pattern and command.
Trigger: ¶
The keyword to detect in the bookmark tags. When gosuki parses bookmark tags and finds this trigger keyword, it evaluates the pattern rule. If the pattern matches, the corresponding command is executed.
Pattern: ¶
A regular expression used for matching against a part of the bookmark URL or title. Once a trigger is detected, the pattern is evaluated to determine if there's a match with the bookmark data.
Command: ¶
The shell command to execute when both the trigger and pattern are matched in a bookmark tag. This command can be any valid shell command and it allows for flexibility in performing various actions.
Index ¶
Constants ¶
const InvalidFormat = "invalid format"
Variables ¶
This section is empty.
Functions ¶
func PreloadRules ¶
func PreloadRules() error
Types ¶
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.
var (
CachedRules *MarkTab
)
func (*MarkTab) LoadMarktabs ¶
type MarktabError ¶
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
}