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 ( None ColorID = iota // None represents an uncolored (transparent) tag Red = iota // Red represents a red tag Orange = iota // Orange represents a orange tag Yellow = iota // Yellow represents a yellow tag Green = iota // Green represents a green tag Blue = iota // Blue represents a blue tag Purple = iota // Purple represents a purple tag Grey = iota // Grey represents a grey tag )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ColorID ¶
type ColorID byte
ColorID is a single-character identifier for the 8 colors that Apple defined for their file tags.
func AllColors ¶
func AllColors() []ColorID
AllColors returns the full list of available colors in a "pleasing" order, sorted by their hue.
func ColorWithID ¶
ColorWithID returns the colorID for a color's byte id (0 .. 7)
Any unknown id will return the constant None
func ColorWithIDOrName ¶
ColorWithIDOrName returns a colorID for a single-digit string number between "0" and "7" or, alternatively, the name of the color may be provided, e.g. "none", "red", "orange", "yellow", "green", "blue", "purple", "grey"
Any unknown color will return the color constant None
func ColorWithIDString ¶
ColorWithIDString returns the colorID for a color's string id ("0" .. "7")
Any unknown id will return the constant None
func ColorWithName ¶
ColorWithName returns the colorID for a color's name.
Valid names: "none", "red", "orange", "yellow", "green", "blue", "purple", "grey"
Any unknown color will return the color constant None
func (ColorID) BackgroundRGB ¶
BackgroundRGB returns the color's background RGB(A) color specification (alias for color.RGB())
func (ColorID) BorderRGB ¶
BorderRGB returns the RGB(A) specification for the border of a tag's color swatch
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 NewTag ¶
NewTag 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.