This repository was archived by the owner on Oct 28, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change 1+ package config
2+
3+ import "github.com/fatih/structs"
4+
5+ // AppleScript is an Alfred action that runs NSAppleScript
6+ type AppleScript struct {
7+ Cache bool `yaml:"cache" structs:"cachescript"`
8+ Script ScriptConfig `yaml:"script" structs:"-"`
9+ }
10+
11+ func (a AppleScript ) ToWorkflowConfig () map [string ]interface {} {
12+ m := structs .Map (a )
13+ m ["applescript" ] = a .Script .Content
14+ return m
15+ }
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import (
1313type ObjectType string
1414
1515var (
16+ AppleScriptType ObjectType = "applescript"
1617 ClipboardType ObjectType = "clipboard"
1718 KeywordType ObjectType = "keyword"
1819 OpenURLType ObjectType = "open-url"
@@ -62,6 +63,12 @@ func (o *Object) UnmarshalYAML(node *yaml.Node) error {
6263 }
6364
6465 switch o .Type {
66+ case AppleScriptType :
67+ var cfg AppleScript
68+ if err := yaml .Unmarshal (rawConfig , & cfg ); err != nil {
69+ return err
70+ }
71+ o .Config = cfg
6572 case ClipboardType :
6673 var cfg Clipboard
6774 if err := yaml .Unmarshal (rawConfig , & cfg ); err != nil {
@@ -100,6 +107,7 @@ func (o *Object) UnmarshalYAML(node *yaml.Node) error {
100107}
101108
102109var objectType = map [ObjectType ]string {
110+ "applescript" : "alfred.workflow.action.applescript" ,
103111 "clipboard" : "alfred.workflow.output.clipboard" ,
104112 "keyword" : "alfred.workflow.input.keyword" ,
105113 "open-url" : "alfred.workflow.action.openurl" ,
You can’t perform that action at this time.
0 commit comments