Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up
for free
Alfred Workflows by Go
enta0701
December 11, 2017
Technology
4
1.3k
Alfred Workflows by Go
enta0701
December 11, 2017
Tweet
Share
More Decks by enta0701
See All by enta0701
endotakuya
0
79
endotakuya
0
34
endotakuya
1
390
endotakuya
0
66
endotakuya
1
540
endotakuya
0
120
endotakuya
0
33
endotakuya
0
410
endotakuya
0
390
Other Decks in Technology
See All in Technology
koukyo1994
6
1.7k
sat
40
29k
tosh2230
3
330
takehaya
0
140
dena_tech
15
3.5k
yunoda
0
150
udzura
2
260
uzabasetech
3
810
soracom
0
180
dena_tech
1
110
kahara33
0
130
robcrowley
1
470
Featured
See All Featured
lemiorhan
627
44k
malarkey
119
16k
pauljervisheath
195
15k
chriscoyier
683
180k
keathley
20
710
hatefulcrawdad
257
17k
schacon
145
6.6k
maggiecrowley
10
510
searls
204
36k
holman
447
130k
jonrohan
1021
380k
jlugia
217
16k
Transcript
"MGSFE8PSLqPXT CZ(P 2017/12/11 golang.tokyo #11 @enta0701
ࣗݾհ ❐ɹ!FOUB ❐ɹגࣜձࣾϕʔγοΫ ❐ɹ3VCZ%PDLFSLT ɹ(P"OESPJE+BWB4DSJQU ❐ɹ(Pྺɿ͗͢ @enta0701 @endotakuya @enta0701
"MGSFE ɹͬͯ·͔͢ʁ
"MGSFE ❐ΠϯΫϦϝϯλϧαʔνͰύύοͱݕࡧ ❐ग़དྷΔݶΓΩʔϘʔυͷૢ࡞Ͱ͍݁ͨ͠ਓ͚ ❐εϦʔϓͱ͔ຯʹָ
"MGSFE8PSLqPXT ❐"MGSFEΛΑΓޮՌతʹ͑Δ֦ுػೳ ❐Ϣʔϩʢ ԁʣΛ͏͜ͱͰ͑Δ ❐Α͘͏ͷɺHJUIVC'POU"XFTPNF2JJUB
8PSLqPX ࣗ࡞Ͱ͖·͢
8PSLqPXΛࣗ࡞͢Δ ❐"MGSFE1SFGFSFODFT8PSLqPXT ɹ(FU4UBSUFE4DSJQU'JMUFS
8PSLqPXΛࣗ࡞͢Δ ❐4DSJQU'JMUFSΛબ ❐ͲͷݴޠΛબΜͰɺ࠷ऴతʹඞཁͳͷ+40/ ❐CJOCBTIͰɺ(Pͷ࣮ߦϑΝΠϧΛͤ0,
ͪͳΈʹ4QPSUJGZʁ ೖྗ͢Δ,FZXPSE͝ͱʹ4DSJQUΛΈ߹ΘͤΔ
ຊ
"MGSFE8PSLqPXT CZ(P
͢Ͱʹଘࡏ͢Δ"MGSFEͷύοέʔδ ϑΥʔϚοτ 4UBS ϝϯςφϯε SVFEBQHPBMGSFE 9.- QBTDBMXHPBMGSFE 9.-
EFBOJTIFBXHP +40/ ˞"MGSFE͔Β+40/͕ਪ
BXHP ❐HPCVJMEͨ͠ͷΛɺຖճ8PSLqPXʹஔ͢Δ ɹඞཁͯ͠ݕূ͢Δඞཁ͕͋Δ ❐HPSVOͰؾܰʹݕূ͍ͨ͠ ❐DBDIFͱ͔͍ΖΜͳػೳ͋Δ͚Ͳͦ͜·ͰٻΊͯͳ͍ ❐ڥมΛ࣮ߦϑΝΠϧʹؚΊ͍ͨ ɹ˞8PSLqPXΛ͢Δͱ͖ʹFOWΛެ։ͨ͘͠ͳ͍
ͬͱγϯϓϧͰ ͍͍͕ͭ͢ཉ͍͠
8PSLqPXʹ͢ɺ࠷খݶͷ+40/ {"items": [ { "title": "Desktop", "arg": "~/Desktop", } ]}
BMGSFEHP $ go get github.com/endotakuya/alfred-go/... func main() { a :=
alfred.New() item := alfred.NewItem() item.Title = "Desktop" item.Arg = "~/Desktop" a.Append(item) a.Print() }
FOWͷσʔλΛຒΊࠐΉ HOGE="text" FUGA="http://example.com/" PIYO=50000 $ alfred-go $ ls env ./
../ env.go FOW FOWFOWHPΛੜ
FOWͷσʔλΛຒΊࠐΉ func main() { fmt.Println( env.List() ) fmt.Println( env.Get(“HOGE") )
} map[HOGE:text FUGA:http://example.com/ PIYO:50000] text औΓग़͢ͱ͖ɺ
FOWHPͷੜ w := bufio.NewWriter(f) => f: *os.File defer w.Flush() fmt.Fprintf(
w, `package main import ( "fmt" ) func main() { fmt.Println(“%s") }`, “Hello, world”) HPCJOEBUBΛࢀߟʢࡶʹॻ͘ͱ͜Μͳײ͡ʣ
·ͱΊ ❐HPͷϑΝΠϧͷੜํ๏ؾ࣋ͪѱ͍ɺɺɺ ❐8PSLqPXTΛ࡞Δͱ͖ɺ ɹػೳ͝ͱʢαδΣετ͍ͨ͠LFZXPSE͝ͱʁʣʹ ɹ࣮ߦϑΝΠϧΛੜ͍ͯ͠ΔΓํ͕ଟ͍ ɹ㱺͜Ε͙Β͍γϯϓϧͳύοέʔδͷ΄͏͕ѻ͍ͦ͢͏ ❐ͨͬͨͷ ԁͰ͜ΜͳʹշదʹͳΔͳΜͯʂ ❐"MGSFE8PSLqPXTΛ(Pࣗ࡞ָͯ͠Λ͠·ͤΜ͔
͋Γ͕ͱ͏͍͟͝·ͨ͠