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

自作 CLI ツールのワークフローとそれを支える技術 / the workflow of my CLI tool and technologies which supports it

398137161a861ee5412b84b234c65187?s=47 ktr
May 29, 2018

自作 CLI ツールのワークフローとそれを支える技術 / the workflow of my CLI tool and technologies which supports it

398137161a861ee5412b84b234c65187?s=128

ktr

May 29, 2018
Tweet

Transcript

  1. at u-aizu LT spring ࣗ࡞ CLI πʔϧͷϫʔΫϑϩʔͱ ͦΕΛࢧ͑Δٕज़

  2. !LUS@ LUSɺΩλϩʔ  ձ௡େֶT XIPBNJ

  3. !LUS@ LUSɺΩλϩʔ  ձ௡େֶT ແ৬ XIPBNJ

  4. None
  5. None
  6. None
  7. $-*πʔϧͷ ϝϯςφϯεͷ໰୊

  8. w ΞοϓσʔτΛ఻͑Δखஈ͕ͳ͍ w खಈͰ ܧଓతʹϦϦʔε͢Δίετ ϝϯςφαΠυ

  9. w ࠷৽͔Ͳ͏͔෼͔Βͳ͍ w Ξοϓσʔτ͕खؒ ϢʔβαΠυ

  10. w (PQIFSɺαʔόΤϯδχΞҎ֎΋
 Ϣʔβͱͯ͠૝ఆ w ࠷దͳΠϯετʔϧํ๏Λఏڙ͍ͨ͠ LUSFWBOT

  11. w Ϣʔβ͸Πϯετʔϧํ๏ΛબΜͰΠϯετʔϧ w Ϣʔβ͸ΞοϓσʔτΛߦ͏͔ΛબͿ͚ͩ w ΞοϓσʔτΛ֬ೝͤ͞ͳ͍ w Ξοϓσʔτํ๏Λߟ͑ͤ͞ͳ͍ ΄Μͱ͏ʹඞཁͳ͜ͱ

  12. ˞ Ҏ߱ͷϑϩʔ͸(PϓϩδΣΫτΛ લఏͱ͍ͯ͠·͢

  13. $* SFQPTJUPSZ (JU)VC3FMFBTFT )PNFCSFXGPSNVMB  commit fire create VTFS update

    NBJOUBJOFS OFXWFSTJPO bump
  14. w ϓϩδΣΫτͷόʔδϣχϯά w $*ͱ࿈ܞͨ͠ϏϧυɺϦϦʔε w πʔϧͷࣗಈతͳΞοϓσʔτ $* SFQPTJUPSZ (JU)VC3FMFBTFT )PNFCSFXGPSNVMB

     commit fire create VTFS update NBJOUBJOFS OFXWFSTJPO bump
  15. $* SFQPTJUPSZ (JU)VC3FMFBTFT )PNFCSFXGPSNVMB  commit fire create VTFS update

    NBJOUBJOFS OFXWFSTJPO bump LUSHPTFNWFS
  16. ηϚϯςΟοΫόʔδϣχϯά cmd/bumpʹΑΔߋ৽ LUSHPTFNWFS var v = semver.MustParse("0.3.1") $ bump patch

    main.go package main ... var v = semver.MustParse("0.3.2") CLI main.go
  17. "45΁ม׵͠ɺόʔδϣϯΛ୳͢ ͜ͱͰɺ҆શʹॻ͖׵͕͑Մೳ LUSHPTFNWFS *ast.CallExpr { . Fun: *ast.SelectorExpr { .

    . X: *ast.Ident { . . . NamePos: meta.go:10:12 . . . Name: "semver" . . } . . Sel: *ast.Ident { . . . NamePos: meta.go:10:19 . . . Name: "MustParse" . . } . } . Lparen: meta.go:10:28 . Args: []ast.Expr (len = 1) { . . 0: *ast.BasicLit { . . . ValuePos: meta.go:10:29 . . . Kind: STRING . . . Value: "\"0.3.1\"" . . } . } . Ellipsis: - . Rparen: meta.go:10:36 }
  18. NJUDIFMMIHPYUDOLTNHIS $* SFQPTJUPSZ (JU)VC3FMFBTFT )PNFCSFXGPSNVMB  commit fire create VTFS

    update NBJOUBJOFS OFXWFSTJPO bump
  19. ෳ਺ϓϥοτϑΥʔϜ޲͚ʹϏϧυ (JU)VC3FMFBTFT΁ͷ഑෍ NJUDIFMMIHPY
 UDOLTNHIS mitchellh/gox gox -osarch "$OSARCH" . for

    f in *; do mv "$f" evans tar cvzf "$f.tar.gz" evans rm -f evans done tcnksm/ghr git tag "$VERSION" git push origin "$VERSION" ghr "$VERSION" pkg
  20. LUSHPVQEBUFS $* SFQPTJUPSZ (JU)VC3FMFBTFT )PNFCSFXGPSNVMB  commit fire create VTFS

    update NBJOUBJOFS OFXWFSTJPO bump
  21. w ࣗಈΞοϓσʔτ༻ϥΠϒϥϦ w ೚ҙͷखஈ .FBOT ͰΞοϓσʔτ͕Մೳ LUSHPVQEBUFS

  22. var current = semver.MustParse("0.2.0") func main() { means, _ :=

    updater.NewMeans( github.GitHubReleaseMeans("ktr0731", "evans", nil), ) u := updater.New(current, means) updatable, new, _ := u.Updatable(context.Background()) if updatable { _ = u.Update(context.Background()) fmt.Printf("updated: %s ! %s\n", current, new) } }
  23. var current = semver.MustParse("0.2.0") func main() { means, _ :=

    updater.SelectAvailableMeansFrom( context.Background(), brew.HomebrewMeans("ktr0731/evans", "evans"), github.GitHubReleaseMeans("ktr0731", "evans", nil), ) u := updater.New(current, means) updatable, new, _ := u.Updatable(context.Background()) if updatable { _ = u.Update(context.Background()) fmt.Printf("updated: %s ! %s\n", current, new) } }
  24. $-*Ϟʔυ 3&1-Ϟʔυ autoUpdate
 USVF ΞοϓσʔτΛ
 ߦΘͳ͍ ϓϩϯϓτඇදࣔ ඇಉظΞοϓσʔτ autoUpdate GBMTF

    ΞοϓσʔτΛ
 ߦΘͳ͍ ϓϩϯϓτදࣔ ಉظΞοϓσʔτ
  25. None
  26. w HPTFNWFSʹΑΔόʔδϣχϯά w HPYHISʹΑΔϏϧυɺϦϦʔε w HPVQEBUFSʹΑΓɺΞοϓσʔτखॱʹ
 ؔ͢Δ஌ࣝΛϢʔβ͔Β׬શʹ෼཭ ·ͱΊ

  27. w IUUQTNPUFNFOIBUFOBCMPHDPNFOUSZ HPHPCVNQWFSTJPOJOH w IUUQTEFFFFUDPNXSJUJOHHIS w IUUQTTZGNIBUFOBCMPHDPNFOUSZ  ࢀߟ

  28. w (P-PHPJT$PQZSJHIU5IF(P"VUIPST "MMSJHIUTSFTFSWFE $PQZSJHIU