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
410
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
760
Ruby 3.0 JIT on Rails
k0kubun
9
9.1k
Other Decks in Programming
See All in Programming
シェーダーで魅せるMapLibreの動的ラスタータイル
satoshi7190
1
480
3rd party scriptでもReactを使いたい! Preact + Reactのハイブリッド開発
righttouch
PRO
1
600
as(型アサーション)を書く前にできること
marokanatani
10
2.6k
Remix on Hono on Cloudflare Workers
yusukebe
1
290
PHP でアセンブリ言語のように書く技術
memory1994
PRO
1
170
『ドメイン駆動設計をはじめよう』のモデリングアプローチ
masuda220
PRO
8
540
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
100
シールドクラスをはじめよう / Getting Started with Sealed Classes
mackey0225
4
640
Quine, Polyglot, 良いコード
qnighy
4
640
ECS Service Connectのこれまでのアップデートと今後のRoadmapを見てみる
tkikuc
2
250
Amazon Qを使ってIaCを触ろう!
maruto
0
400
Click-free releases & the making of a CLI app
oheyadam
2
110
Featured
See All Featured
Documentation Writing (for coders)
carmenintech
65
4.4k
Navigating Team Friction
lara
183
14k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.8k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
Building Applications with DynamoDB
mza
90
6.1k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
47
2.1k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Bash Introduction
62gerente
608
210k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.8k
Ruby is Unlike a Banana
tanoku
97
11k
Docker and Python
trallard
40
3.1k
Making the Leap to Tech Lead
cromwellryan
133
8.9k
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