Documentation ¶
Overview ¶
Package tag provides a representation for short, descriptive words or phrases, used to describe the contents of a file.
The combination of multiple tags can help to uniquely classify files.
TIX's primary goal is management of duplicate files, including the alignment of their tags.
Since file tagging is a manual, almost random task, it is highly unlikely that all duplicates of a file will have the same set of tags. Some tags can be expected to be common to all duplicates, others may represent aspects of the file which were not considered while tagging the other duplicates.
There is also the consideration of inconsistent spelling, capitalisation or colorisation of tags.
This package provides:
basic tag attributes: text and color
merging the tags of multiple, identical files into a single tag set
while maintaining a (hopefully) recognisable order
identification and alignment of inconsitently spellt tags
the permanent replacement of tags
e.g. always replace 'important' with 'prio 1'
Index ¶
Constants ¶
const NoColor = "none"
Variables ¶
This section is empty.
Functions ¶
func ValidColorName ¶ added in v0.0.10
Types ¶
type List ¶
type List []*Tag
List represents the ordered list of tags for a single file
func NewTagList ¶
func NewTagList() List
NewTagList only provides a common New... interface to a simple list of tags
type Preferences ¶
type Preferences struct {
// contains filtered or unexported fields
}
func NewPreferences ¶
func NewPreferences() *Preferences
func (*Preferences) NewTag ¶
func (p *Preferences) NewTag(name, color string) *Tag
type Set ¶
type Set struct {
// contains filtered or unexported fields
}
Set collect multiple TagLists and provides methods for merging them into a single, common TagList which can be applied to all instances of a duplicated file.
func (*Set) AddTagList ¶
AddTagList adds an ordered list of tags to the set (for eventual merging)
func (*Set) ClearPreferredTags ¶
func (ts *Set) ClearPreferredTags()
ClearPreferredTags removes all tag preferences, reverting to the most recently used name and color of each tag.
func (*Set) MergedTagList ¶
MergedTagList returns a TagList containing the full set of tags found in all TagLists within this TagSet, in an order that should keep the original order in tact as much as possible, while favouring later TagLists over earlier tag lists.
func (*Set) PreferTag ¶
PreferTag can be used to override the derived representation of a tag with a user-selected preference.
Note that this overrides both the tag's name as well as its color
func (*Set) TagColors ¶
TagColors returns the full list of colors that were used for a tag within this TagSet
type Tag ¶
type Tag struct {
// contains filtered or unexported fields
}
Tag represents a single tag, with a name and color
func New ¶ added in v0.0.10
New creates a new tag with a name and color.
The color may be a color id ("0" .. "7") or name ("none", "red", "orange", "yellow", "green", "blue", "purple", "grey"). Any other color strings will be translate to the color None
An empty string may be provided for either name or color, however, nil will be returned if neither name nor color are defined.