Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
How to write CUI application in Go
Search
Takashi Kokubun
June 17, 2014
Programming
4
3k
How to write CUI application in Go
Takashi Kokubun
June 17, 2014
Tweet
Share
More Decks by Takashi Kokubun
See All by Takashi Kokubun
YJIT Makes Rails 1.7x faster / RubyKaigi 2024
k0kubun
7
12k
Ruby JIT Hacking Guide / RubyKaigi 2023
k0kubun
2
9.4k
YJIT: Dive into Ruby's JIT compiler written in Rust / Rust.Tokyo 2022
k0kubun
1
2k
Towards Ruby 4 JIT / RubyKaigi 2022
k0kubun
3
11k
Optimizing Production Performance with MRI JIT / RubyConf 2021
k0kubun
1
400
Why Ruby's JIT was slow / RubyKaigi Takeout 2021
k0kubun
3
1.8k
数時間かかる週一リリースを毎日何度も爆速でできるようにするまで / CI/CD Conference 2021
k0kubun
21
14k
Ruby 3 JIT's roadmap / RubyConf China 2020
k0kubun
0
750
Ruby 3.0 JIT on Rails
k0kubun
9
9.1k
Other Decks in Programming
See All in Programming
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
7
2.8k
[PyCon Korea 2024 Keynote] 커뮤니티와 파이썬, 그리고 우리
beomi
0
110
Identifying User Idenity
moro
6
7.9k
VR HMDとしてのVision Pro+ゲーム開発について
yasei_no_otoko
0
100
Java ジェネリクス入門 2024
nagise
0
610
Go言語でターミナルフレンドリーなAIコマンド、afaを作った/fukuokago20_afa
monochromegane
2
140
飲食業界向けマルチプロダクトを実現させる開発体制とリアルな現状
hiroya0601
1
400
『ドメイン駆動設計をはじめよう』のモデリングアプローチ
masuda220
PRO
8
440
Hotwire or React? ~Reactの録画機能をHotwireに置き換えて得られた知見~ / hotwire_or_react
harunatsujita
9
4.1k
gopls を改造したら開発生産性が高まった
satorunooshie
8
240
Kotlin2でdataクラスの copyメソッドを禁止する/Data class copy function to have the same visibility as constructor
eichisanden
1
140
カスタムしながら理解するGraphQL Connection
yanagii
1
1.2k
Featured
See All Featured
Music & Morning Musume
bryan
46
6.1k
A better future with KSS
kneath
238
17k
The World Runs on Bad Software
bkeepers
PRO
65
11k
Designing on Purpose - Digital PM Summit 2013
jponch
115
6.9k
YesSQL, Process and Tooling at Scale
rocio
167
14k
Gamification - CAS2011
davidbonilla
80
5k
It's Worth the Effort
3n
183
27k
Adopting Sorbet at Scale
ufuk
73
9k
Rails Girls Zürich Keynote
gr2m
93
13k
A Modern Web Designer's Workflow
chriscoyier
692
190k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
Transcript
2014/06/17 hikarie.go How to write CUI application in Go by
@k0kubun
ɾRails app engineer ɾGithub, Twitter: ɹ@k0kubun Έͳ͞ΜɺॳΊ·ͯ͠ Takashi Kokubun
ಥવͰ͕͢
օ͞ΜීஈGoͰ ԿΛॻ͍͍ͯ·͔͢ʁ
ࢲɺ
scheme interpreter
Twitter client
peco (just contribution)
TETRIS
CUI
Why do I write CUI application in Go?
Because
I work with Terminal, !
I work with Terminal, I love Terminal,
I work with Terminal, I love Terminal, I live in
Terminal.
And
Go is Fast
I love to use fast CUI app
That's all.
ࢲͷߟ͑
ͱΓ͋͑ͣGoͰ ॻ͍ͱ͚ͦ͏ ࢲͷߟ͑
Α͠ॻ͍ͯΈΑ͏
None
ΧʔιϧҠಈͰ͖Δ Α͏ʹ͍ͨ͠
r := bufio.NewReader(os.Stdin) buf, _ := r.ReadString('\n') ...
ɾɾɾʁ
EnterΩʔԡ͢·Ͱ Ωʔೖྗड͚औΕͳ͍
ࠔͬͨ
ΊͬͪΌάάͬͨ ΊͬͪΌίʔυړͬͨ
݁Ռ
mattn/http-gonsole uses go-readline
ɾgo-readline ɹɾGNU readlineґଘ(໘), GPL ɹɾUTF-8ରԠͯ͠Δ, WindowsՄ ɾgo.linenoise ɹɾ1100ߦͷCͷίʔυ, BSD ɹɾUTF-8ରԠͯ͠ͳ͍…,
Windowsແཧ readlineܥͷϥΠϒϥϦ͍·͠ΐ͏ ͳΜ͔Ϗϧυࣦഊͨ͠Γ͢ΔͷͰదͳϑΥʔΫ୳͔ࣗ͢Ͱ͢
ͬͱॻ͍ͯΈΑ͏
None
Ͳ͏͢Μͩ͜Ε ผʹจࣈΛೖྗ͍ͨ͠Θ͚͡Όͳ͍
linenoiseͷίʔυಡΜͰΈΔ͔ ͕ͬͯΔͭ ͨͬͨͷ1100ߦʂ
linenoiseͷίʔυಡΜͰΈΔ͔ ͜Μͳͷʹ 3ສߦॻ͘ඞཁ͕ ͋Δͷ͔ʁ ͔͍͍ͬ͜
݁Ռ
#include <termios.h> tcsetattr()
termiosͷcgoόΠϯσΟϯάॻ͍ͨ k0kubun/go-termios ॻ͍͔ͯΒؾ͍͚ͮͨͲdavecheneyͷ github.com/pkg/term ྑ͛͞
ͰϙʔλϏϦςΟ͍ Windows? ͪΐͬͱฉ͍ͨ ͜ͱͳ͍Ͱ͢Ͷ
·ͨίʔυړͬͨ
lestrrat/peco uses termbox-go
ɾWindowsରԠͯ͠ΔͬΆ͍ ɾେମͷΩʔೖྗఆͰ͖Δ ɾ࠲ඪࢦఆ͍ͯ͠Ζ͍Ζॻ͚Δ termbox-goྑ͍Ͱ͢
termbox-go ศར
·ͱΊ
ɾCUIΞϓϦॻ͜͏ ɾtermbox-goศར ·ͱΊ
Thank you for your listening