Documentation ¶
Index ¶
- func Add(item AlfredItem)
- func Arguments() []string
- func IsDebug() bool
- func Log(text string)
- func Normalize(input string) (output string, err error)
- func NormalizedArguments() (normalizedArgs []string, err error)
- func Print()
- func Rerun(seconds int)
- func SetVariable(key string, value interface{})
- type AlfredItem
- type ComplexArg
- type Icon
- type IconType
- type Item
- type ItemType
- type ModContent
- type ModElements
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Arguments ¶
func Arguments() []string
Arguments just wrappes the call to os.Args for better readability
func IsDebug ¶
func IsDebug() bool
IsDebug returns if the current environment has 'alfred_debug' set.
func Log ¶
func Log(text string)
Log logs text to the debug panel. Only logs when IsDebug is true, so as not to interfere with the normal output.
func Normalize ¶
Normalize fixes problems with string encoding regarding the usage of special characters in Alfred. For more info on this topic, please refer to this thread: http://www.alfredforum.com/topic/2015-encoding-issue/
func NormalizedArguments ¶
NormalizedArguments re-normalizes the user arguments provided via Alfred. This isn't necessary for every workflow, specifically only when you're working with special characters. For more info on this topic, please refer to this thread: http://www.alfredforum.com/topic/2015-encoding-issue/ Arguments that couldn't get normalized are not part of the return value!
func Rerun ¶
func Rerun(seconds int)
Rerun sets the interval after how many seconds the workflow should run again
func SetVariable ¶
func SetVariable(key string, value interface{})
SetVariable sets the value of a workflow wide variable which is passed as env var to the workflow
Types ¶
type AlfredItem ¶
type AlfredItem interface {
Item() Item
}
AlfredItem defines that a struct is convertible to an Item
type ComplexArg ¶
type ComplexArg struct { Arg string `json:"arg,omitempty"` Variables map[string]interface{} `json:"variables,omitempty"` }
ComplexArg gives you the opportunity to set variables as well that you can use later
type IconType ¶
type IconType string
IconType describes the two possible values for the Type of an icon
type Item ¶
type Item struct { UID string `json:"uid,omitempty"` Title string `json:"title"` Subtitle string `json:"subtitle"` Arg string `json:"arg,omitempty"` Icon *Icon `json:"icon,omitempty"` Valid *bool `json:"valid,omitempty"` Autocomplete string `json:"autocomplete,omitempty"` Type ItemType `json:"type,omitempty"` Mod ModElements `json:"mods,omitempty"` Quicklook string `json:"quicklookurl,omitempty"` }
Item stores informations about on item in the script filter A possible gotcha here is the `Valid` attribute, which is a pointer to a bool. This ensures it is whatever you set it and it gets included in the output if and only if you set it.
func (*Item) SetComplexArg ¶
func (i *Item) SetComplexArg(arg ComplexArg)
SetComplexArg sets the argument of the item to a more complex one that could contain variables as well
type ItemType ¶
type ItemType string
ItemType describes the type of an Item
const ( // NoItemType is the default item type, you could also leave it in the zero value state NoItemType ItemType = "" // FileItemType makes Alfred treat your result as a file on your system FileItemType ItemType = "file" // SkipCheckItemType makes Alfred skip this check as you are certain that the files you are returning exist SkipCheckItemType ItemType = "file:skipcheck" )
type ModContent ¶
type ModContent struct { Valid bool `json:"valid,omitempty"` Arg string `json:"arg,omitempty"` Subtitle string `json:"subtitle,omitempty"` }
ModContent holds all informations about a modifier of an Item
func (*ModContent) SetComplexArg ¶
func (m *ModContent) SetComplexArg(arg ComplexArg)
SetComplexArg sets the argument of the item to a more complex one that could contain variables as well
type ModElements ¶
type ModElements struct { Alt *ModContent `json:"alt,omitempty"` Cmd *ModContent `json:"cmd,omitempty"` }
ModElements is a collection of the different modifiers for the item Alt will be visible when holding the alt-key Cmd will be visible when holding the cmd-key