Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Alfred Workflows by Go

B002134f2e824b2100761da10a9765a9?s=47 enta0701
December 11, 2017

Alfred Workflows by Go

B002134f2e824b2100761da10a9765a9?s=128

enta0701

December 11, 2017
Tweet

Transcript

  1. "MGSFE8PSLqPXT CZ(P 2017/12/11 golang.tokyo #11 @enta0701

  2. ࣗݾ঺հ ❐ɹ!FOUB ❐ɹגࣜձࣾϕʔγοΫ ❐ɹ3VCZ%PDLFSLT ɹ(P"OESPJE+BWB4DSJQU ❐ɹ(Pྺɿ൒೥͗͢ @enta0701 @endotakuya @enta0701

  3. "MGSFE ɹ࢖ͬͯ·͔͢ʁ

  4. "MGSFE ❐ΠϯΫϦϝϯλϧαʔνͰύύοͱݕࡧ ❐ग़དྷΔݶΓΩʔϘʔυͷૢ࡞Ͱ׬͍݁ͨ͠ਓ޲͚ ❐εϦʔϓͱ͔஍ຯʹָ

  5. "MGSFE8PSLqPXT ❐"MGSFEΛΑΓޮՌతʹ࢖͑Δ֦ுػೳ ❐Ϣʔϩʢ໿ ԁʣΛ෷͏͜ͱͰ࢖͑Δ ❐Α͘࢖͏ͷ͸ɺHJUIVC'POU"XFTPNF2JJUB

  6. 8PSLqPX͸ ࣗ࡞΋Ͱ͖·͢

  7. 8PSLqPXΛࣗ࡞͢Δ ❐"MGSFE1SFGFSFODFT8PSLqPXT  ɹ(FU4UBSUFE4DSJQU'JMUFS

  8. 8PSLqPXΛࣗ࡞͢Δ ❐4DSJQU'JMUFSΛબ୒ ❐ͲͷݴޠΛબΜͰ΋ɺ࠷ऴతʹඞཁͳͷ͸+40/ ❐CJOCBTIͰɺ(Pͷ࣮ߦϑΝΠϧΛ౉ͤ͹0,

  9. ͪͳΈʹ4QPSUJGZ͸ʁ ೖྗ͢Δ,FZXPSE͝ͱʹ4DSJQUΛ૊Έ߹ΘͤΔ

  10. ຊ୊

  11. "MGSFE8PSLqPXT CZ(P

  12. ͢Ͱʹଘࡏ͢Δ"MGSFEͷύοέʔδ ϑΥʔϚοτ 4UBS ϝϯςφϯε SVFEBQHPBMGSFE 9.-   QBTDBMXHPBMGSFE 9.-

      EFBOJTIFBXHP +40/   ˞"MGSFE͔Β+40/͕ਪ঑
  13. BXHP ❐HPCVJMEͨ͠΋ͷΛɺຖճ8PSLqPXʹ഑ஔ͢Δ
 ɹඞཁͯ͠ݕূ͢Δඞཁ͕͋Δ ❐HPSVOͰؾܰʹݕূ͍ͨ͠ ❐DBDIFͱ͔͍ΖΜͳػೳ͋Δ͚Ͳͦ͜·ͰٻΊͯͳ͍ ❐؀ڥม਺Λ࣮ߦϑΝΠϧʹؚΊ͍ͨ
 ɹ˞8PSLqPXΛ഑෍͢Δͱ͖ʹFOWΛެ։ͨ͘͠ͳ͍

  14. ΋ͬͱγϯϓϧͰ ࢖͍΍͍͢΍͕ͭཉ͍͠

  15. 8PSLqPXʹ౉͢ɺ࠷খݶͷ+40/ {"items": [ { "title": "Desktop", "arg": "~/Desktop", } ]}

  16. 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() }
  17. FOWͷσʔλΛຒΊࠐΉ HOGE="text" FUGA="http://example.com/" PIYO=50000 $ alfred-go $ ls env ./

    ../ env.go FOW FOWFOWHPΛੜ੒
  18. FOWͷσʔλΛຒΊࠐΉ func main() { fmt.Println( env.List() ) fmt.Println( env.Get(“HOGE") )

    } map[HOGE:text FUGA:http://example.com/ PIYO:50000] text औΓग़͢ͱ͖͸ɺ
  19. 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Λࢀߟʢࡶʹॻ͘ͱ͜Μͳײ͡ʣ
  20. ·ͱΊ ❐HPͷϑΝΠϧͷੜ੒ํ๏ؾ࣋ͪѱ͍ɺɺɺ ❐8PSLqPXTΛ࡞Δͱ͖͸ɺ
 ɹػೳ͝ͱʢαδΣετ͍ͨ͠LFZXPSE͝ͱʁʣʹ ɹ࣮ߦϑΝΠϧΛੜ੒͍ͯ͠Δ΍Γํ͕ଟ͍
 ɹ㱺͜Ε͙Β͍γϯϓϧͳύοέʔδͷ΄͏͕ѻ͍΍ͦ͢͏ ❐ͨͬͨͷ ԁͰ͜ΜͳʹշదʹͳΔͳΜͯʂ ❐"MGSFE8PSLqPXTΛ(Pࣗ࡞ָͯ͠Λ͠·ͤΜ͔

  21. ͋Γ͕ͱ͏͍͟͝·ͨ͠