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
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
1
100
NSOutlineView何もわからん:( 前編 / I Don't Understand About NSOutlineView :( Pt. 1
usagimaru
0
340
みんなでプロポーザルを書いてみた
yuriko1211
0
280
ふかぼれ!CSSセレクターモジュール / Fukabore! CSS Selectors Module
petamoriken
0
150
型付き API リクエストを実現するいくつかの手法とその選択 / Typed API Request
euxn23
8
2.2k
C++でシェーダを書く
fadis
6
4.1k
Webの技術スタックで マルチプラットフォームアプリ開発を可能にするElixirDesktopの紹介
thehaigo
2
1k
2024/11/8 関西Kaggler会 2024 #3 / Kaggle Kernel で Gemma 2 × vLLM を動かす。
kohecchi
5
930
Arm移行タイムアタック
qnighy
0
330
카카오페이는 어떻게 수천만 결제를 처리할까? 우아한 결제 분산락 노하우
kakao
PRO
0
110
「今のプロジェクトいろいろ大変なんですよ、app/services とかもあって……」/After Kaigi on Rails 2024 LT Night
junk0612
5
2.2k
LLM生成文章の精度評価自動化とプロンプトチューニングの効率化について
layerx
PRO
2
190
Featured
See All Featured
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.7k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
840
Building a Modern Day E-commerce SEO Strategy
aleyda
38
6.9k
Adopting Sorbet at Scale
ufuk
73
9.1k
Being A Developer After 40
akosma
87
590k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
65k
Building a Scalable Design System with Sketch
lauravandoore
459
33k
Unsuck your backbone
ammeep
668
57k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
Making Projects Easy
brettharned
115
5.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