Slide 1

Slide 1 text

Create shell manager with golang Photo by Ilya Pavlov on Unsplash Yusuke Komatsu GitHub: usk81

Slide 2

Slide 2 text

Create shell manager with golang Photo by Ilya Pavlov on Unsplash Yusuke Komatsu GitHub: usk81 creating

Slide 3

Slide 3 text

{ "basics": { "name": "Yusuke Komatsu" }, "skills": [ {"name": "Data Analyst"}, {"name": "Web Development"} ], "works": [ {"company": "Persol Process & Technology"}, ], "interests": [ {"name": "Fortnite"}, {"name": "Coffee"}, {"name": "Machine Learning"} ] } About Me:

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

Create shell manager with golang Photo by Ilya Pavlov on Unsplash creating

Slide 7

Slide 7 text

https://github.com/getshway/shway

Slide 8

Slide 8 text

Origin of name (public stance) sh(ell) + way = shway

Slide 9

Slide 9 text

Origin of name SCHWAY!! DC Comic The flash

Slide 10

Slide 10 text

Motivation

Slide 11

Slide 11 text

Motivation Change default shell to zsh

Slide 12

Slide 12 text

Motivation

Slide 13

Slide 13 text

Motivation How to manage dotfiles?

Slide 14

Slide 14 text

Motivation

Slide 15

Slide 15 text

Motivation

Slide 16

Slide 16 text

Motivation Can I use Homebrew on future Mac?

Slide 17

Slide 17 text

Motivation

Slide 18

Slide 18 text

Motivation

Slide 19

Slide 19 text

Motivation How to share development environment?

Slide 20

Slide 20 text

Motivation Join a new project

Slide 21

Slide 21 text

Motivation Join a new project Get ready in 40 seconds!

Slide 22

Slide 22 text

Motivation development environment ↓ as shell scripts ↓ manage with git ↓ get from git repos ↓ we can share!!

Slide 23

Slide 23 text

What’s SHWAY !?

Slide 24

Slide 24 text

What’s SHWAY !? milestone • manage dot files • manage homebrew and cask • manage ssh config • install homebrew and dependency packages when initialize shway

Slide 25

Slide 25 text

What’s SHWAY !? current features
 •manage your •dot files •homebrew and cask •manage your team •dot files •homebrew and cask

Slide 26

Slide 26 text

What’s SHWAY !? # initialize shway $ shway init # sets a project (dotfiles) from github $ shway set foobar [email protected]:getshway/sampleproject.git … # update a project and update/install homebrew and homebrew-cask $ shway update foobar Updated 5 taps (golangci/tap, homebrew/cask-versions, homebrew/core, homebrew/cask and homebrew/cask-fonts). ==> New Formulae awsume dvc govc grin grin-wallet javacc minikube navi nbdime ngt onefetch pnpm prestosql pylint tdkjs toast ttyplot wal2json ==> Updated Formulae ack ✔ borgmatic docfx gleam libphonenumber osquery s3ql terragrunt awscli ✔ botan docker glooctl librsvg paket salt terrahub dark-mode ✔ buku docker-completion gnuradio librsync pango saxon theharvester ...

Slide 27

Slide 27 text

I thought I could create 2 days But I couldn’t

Slide 28

Slide 28 text

I couldn’t create 2days Change specification 1. Coding shell script shell script -> Golang Maybe, can not maintenance 2. source command is not work with Go 3. stdout is caught source command

Slide 29

Slide 29 text

source command is not work with Go // golang // not work exec.Command("source", “something.sh").Run() // not work exec.Command("bash", "-c", "source", "something.sh").Run() 1SPDFTT TIXBZ 1SPDFTT TIFMM TPVSDF 1SPDFTT UFSNJOBM UBSHFUDVSSFOUQSPDFTT

Slide 30

Slide 30 text

source command is not work with Go $ shway init shway() { case "$1" in init | load) source <( /usr/local/bin/shway $@ ) || /usr/local/bin/shway $@ ;; set | update) /usr/local/bin/shway $@ && source <( /usr/local/bin/shway load $2 ) || /usr/local/bin/shway $@ ;; *) /usr/local/bin/shway $@ ;; esac } _shway() { IFS=' ' read -A reply <<< "help set update load list init" } compctl -K _shway shway source /Users/usk/.shway/default/.alias source /Users/usk/.shway/default/.completions source /Users/usk/.shway/default/.functions source /Users/usk/.shway/default/.golang source /Users/usk/.shway/default/.history #.zshrc source <(shway init)

Slide 31

Slide 31 text

refer. antibody $ antibody init #!/usr/bin/env zsh antibody() { case "$1" in bundle) source <( /usr/local/bin/antibody $@ ) || /usr/local/bin/antibody $@ ;; *) /usr/local/bin/antibody $@ ;; esac } _antibody() { IFS=' ' read -A reply <<< "help bundle update home purge list init" } compctl -K _antibody antibody #.zshrc source <(antibody init) https://getantibody.github.io/

Slide 32

Slide 32 text

stdout is caught source command $ shway init shway() { case "$1" in init | load) source <( /usr/local/bin/shway $@ ) || /usr/local/bin/shway $@ ;; set | update) /usr/local/bin/shway $@ && source <( /usr/local/bin/shway load $2 ) || /usr/local/bin/ shway $@ ;; *) /usr/local/bin/shway $@ ;; esac } _shway() { IFS=' ' read -A reply <<< "help set update load list init" } compctl -K _shway shway source /Users/usk/.shway/default/.alias source /Users/usk/.shway/default/.completions source /Users/usk/.shway/default/.functions source /Users/usk/.shway/default/.golang source /Users/usk/.shway/default/.history update dot files and brews and install brews source dot files

Slide 33

Slide 33 text

stdout is caught source command // Exit finishs requests func Exit(err error, codes ...int) { log.SetOutput(os.Stderr) log.SetPrefix("shway: ") log.SetFlags(0) var code int if len(codes) > 0 { code = codes[0] } else { code = 1 } log.Print(err.Error()) os.Exit(code) }

Slide 34

Slide 34 text

Awesome packages https://github.com/src-d/go-git

Slide 35

Slide 35 text

Awesome packages https://github.com/src-d/go-git

Slide 36

Slide 36 text

Awesome packages https://github.com/spf13/cobra

Slide 37

Slide 37 text

Awesome packages package command import ( "fmt" "github.com/getshway/shway/initialize" "github.com/spf13/cobra" ) var ( initCmd = &cobra.Command{ Use: "init", Short: "setup shway and load zsh config", Long: "setup shway and load zsh config", Run: initCommand, } ) func init() { RootCmd.AddCommand(initCmd) } func initCommand(cmd *cobra.Command, args []string) { out, err := initialize.Run() if err != nil { Exit(err, 1) } fmt.Println(out) } define as a use case command package

Slide 38

Slide 38 text

Thank you ϦϦʔεͰ͖ͨΒ Ͳ͔ͬͷLTͰ ใࠂ͍ͤͯͩ͘͞͞