summaryrefslogtreecommitdiff
path: root/model/tags.go
diff options
context:
space:
mode:
authorewy <ewy0@protonmail.com>2026-06-06 16:55:11 +0200
committerewy <ewy0@protonmail.com>2026-06-06 16:55:11 +0200
commit8a376262447f8858d83d07e0d98e8e4ea5c50865 (patch)
tree1b950a49f56aea32842e2a6fc5dc243e27f051b2 /model/tags.go
parent58e255d3c16c7d4a7d08afde7dd3acf481e2d8ae (diff)
add more shit to the manpage
Diffstat (limited to 'model/tags.go')
-rw-r--r--model/tags.go42
1 files changed, 24 insertions, 18 deletions
diff --git a/model/tags.go b/model/tags.go
index a34f555..9c5035d 100644
--- a/model/tags.go
+++ b/model/tags.go
@@ -6,41 +6,47 @@ import (
)
// Tag is some text which is contained in a filename which triggers pik functionality
-type Tag *string
+type Tag struct {
+ Name string
+ Description string
+}
type TagAction func(src *Source)
// New creates a new tag and registers it in the subsystems
-func New(input string) Tag {
- result := &input
- TagMap[input] = result
- TagList = append(TagList, result)
- return result
+func New(input string, description string) *Tag {
+ t := &Tag{
+ Name: input,
+ Description: description,
+ }
+ TagMap[input] = t
+ TagList = append(TagList, t)
+ return t
}
var (
// Here will force the target to run in the current directory instead of the source directory
- Here = New("here")
+ Here = New("here", "run target in the currrent working directory instead of the source root. Same as invoking with `pik --here`.")
// Pre turns the target into a trigger, causing it to be triggered before another target gets ran
- Pre = New("pre")
+ Pre = New("pre", "in non-single mode, run this target before the actually invoked target (this one must succeed)")
// Post turns the target into a trigger, causing it to be triggered after another target gets ran and exits succesfully
- Post = New("post")
+ Post = New("post", "in non-single mode, run this target after the actually invoked target (if it succeeded)")
// Final turns the target into a trigger, causing it to be triggered after another target gets ran
- Final = New("final")
+ Final = New("final", "in non-single mode, run this target after the actually invoked target regardless of failure")
// Hidden means the target is not visible in the menu
- Hidden = New("hidden")
+ Hidden = New("hidden", "do not show this target in the TUI. Still invokable through the command line.")
// Single means this target will not use any triggers
- Single = New("single")
+ Single = New("single", "do not run any triggers (like pre, post, and final). Same as invoking with `pik --single`.")
// Override means this should be selected instead of a non-override target, if possible
- Override = New("override")
+ Override = New("override", "the .override tag will make this target get selected over other targets with the same name. Use this when your machine needs a custom workflow. It is discouraged to check these into version control, as everyone will receive your override.")
)
-var TagList []Tag
+var TagList []*Tag
-var TagMap = map[string]Tag{}
+var TagMap = map[string]*Tag{}
-type Tags []Tag
+type Tags []*Tag
-func (t Tags) AnyOf(expected ...Tag) bool {
+func (t Tags) AnyOf(expected ...*Tag) bool {
if len(expected) > 1 && len(t) == 0 {
return false
}
@@ -55,7 +61,7 @@ func (t Tags) AnyOf(expected ...Tag) bool {
return false
}
-func (t Tags) Has(expected Tag) bool {
+func (t Tags) Has(expected *Tag) bool {
return slices.Contains(t, expected)
}