dawg

package module
v0.0.0-...-6afac93 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 17, 2021 License: MIT Imports: 20 Imported by: 0

README

DAWG

Fancy link expander workflow generator for Alfred.

Installation

Download latest

Usage

  1. Install the workflow
  2. In Alfred, run dawg edit
  3. Edit the configuration file, save and exit the editor
  4. Enjoy thoroughly!

Screenshots!

Alfred

License

WTFPL

Documentation

Index

Constants

View Source
const (
	PListHeader  = `<?xml version="1.0" encoding="UTF-8"?>`
	PListDoctype = `<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">`
)

Variables

This section is empty.

Functions

func FilterChoices

func FilterChoices(choices []string, query string) []string

func GUID

func GUID() string

func SelfUpdate

func SelfUpdate(plist []byte, icons []ServiceIcon) (err error)

Types

type AlfredOutput

type AlfredOutput []AlfredOutputItem

<?xml version="1.0"?> <items>

<item uid="#{q dashboard_name}" valid="YES" autocomplete="#{q dashboard_name}">
  <title>#{dashboard_name}</title>
  <arg>https://app.datadoghq.com/screen/#{dashboard_id}</arg>
</item>

</items>

func Filter

func Filter(c Config, svc, pat string) (AlfredOutput, error)

func (AlfredOutput) MakeXML

func (a AlfredOutput) MakeXML() ([]byte, error)

func (AlfredOutput) MarshalXML

func (a AlfredOutput) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type AlfredOutputItem

type AlfredOutputItem struct {
	UID          string `xml:"uid,attr"`
	Autocomplete string `xml:"autocomplete,attr"`
	Title        string `xml:"title"`
	Icon         string `xml:"icon"`
	Arg          string `xml:"arg"`
}

type Config

type Config map[string]*ServiceConfig
{
   "myservice": {
     "template": "https://foo/bar/{id}/{kind}",
     "substitutions": {
       "myshortcut": {
         "id": "5000",
         "kind": "funny"
       }
     }
   }
}

func ReadConfig

func ReadConfig(path string) (Config, error)

func (Config) GetService

func (c Config) GetService(service string) (ServiceConfig, error)

type PArray

type PArray []xml.Marshaler

func (PArray) MarshalXML

func (a PArray) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type PBool

type PBool bool

func (PBool) MarshalXML

func (b PBool) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type PDict

type PDict map[string]xml.Marshaler

func (PDict) MarshalXML

func (d PDict) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type PInteger

type PInteger int

func (PInteger) MarshalXML

func (i PInteger) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type PList

type PList PDict

func MakeWorkflowPList

func MakeWorkflowPList(c Config) PList

func (PList) MarshalXML

func (p PList) MarshalXML(e *xml.Encoder, start xml.StartElement) error

func (PList) PListWithHeader

func (p PList) PListWithHeader() ([]byte, error)

type PReal

type PReal int

func (PReal) MarshalXML

func (i PReal) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type PString

type PString string

func (PString) MarshalXML

func (s PString) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type ScoredChoices

type ScoredChoices struct {
	Choices []string
	Scores  []float64
	Query   string
}

func NewScoredChoices

func NewScoredChoices(choices []string, query string) ScoredChoices

func (ScoredChoices) Len

func (a ScoredChoices) Len() int

func (ScoredChoices) Less

func (a ScoredChoices) Less(i, j int) bool

func (ScoredChoices) Swap

func (a ScoredChoices) Swap(i, j int)

type ServiceConfig

type ServiceConfig struct {
	GUID          string                            `json:"-"`
	Template      URITemplate                       `json:"template"`
	Keyword       string                            `json:"keyword"`
	Substitutions map[string]map[string]interface{} `json:"substitutions"`
}

func (*ServiceConfig) GetURL

func (s *ServiceConfig) GetURL(shortcut string) (string, error)

func (*ServiceConfig) Shortcuts

func (s *ServiceConfig) Shortcuts() []string

type ServiceIcon

type ServiceIcon struct {
	Service string
	GUID    string
	URL     string
	Data    []byte
}

func DownloadServiceIcons

func DownloadServiceIcons(c Config) ([]ServiceIcon, error)

type URITemplate

type URITemplate uritemplates.UriTemplate

func (*URITemplate) UnmarshalJSON

func (t *URITemplate) UnmarshalJSON(b []byte) error

Directories

Path Synopsis
cmd
dawg command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址