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
Thor - Building CLI with ruby
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Mann
September 08, 2012
Programming
5
590
Thor - Building CLI with ruby
Create command-line interface with thor
Mann
September 08, 2012
Tweet
Share
More Decks by Mann
See All by Mann
From Cambodia to Mizzou
lchanmann
0
38
Khmer ASR using Deep Learning
lchanmann
0
430
Path Finding using Search Algorithms
lchanmann
0
46
The secret to a good life
lchanmann
0
44
Monit - unix monitoring utility
lchanmann
1
110
Techcamp PP
lchanmann
0
110
Trying out Verboice
lchanmann
1
95
CoffeeScript
lchanmann
4
200
Other Decks in Programming
See All in Programming
2026年 エンジニアリング自己学習法
yumechi
0
130
LLM Observabilityによる 対話型音声AIアプリケーションの安定運用
gekko0114
2
420
SourceGeneratorのススメ
htkym
0
190
16年目のピクシブ百科事典を支える最新の技術基盤 / The Modern Tech Stack Powering Pixiv Encyclopedia in its 16th Year
ahuglajbclajep
5
1k
AI巻き込み型コードレビューのススメ
nealle
1
140
疑似コードによるプロンプト記述、どのくらい正確に実行される?
kokuyouwind
0
380
AI時代の認知負荷との向き合い方
optfit
0
150
OSSとなったswift-buildで Xcodeのビルドを差し替えられるため 自分でXcodeを直せる時代になっている ダイアモンド問題編
yimajo
3
610
AI Agent の開発と運用を支える Durable Execution #AgentsInProd
izumin5210
7
2.3k
そのAIレビュー、レビューしてますか? / Are you reviewing those AI reviews?
rkaga
6
4.5k
CSC307 Lecture 03
javiergs
PRO
1
490
Honoを使ったリモートMCPサーバでAIツールとの連携を加速させる!
tosuri13
1
170
Featured
See All Featured
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
90
The Illustrated Children's Guide to Kubernetes
chrisshort
51
51k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.1k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
280
Making Projects Easy
brettharned
120
6.6k
How to make the Groovebox
asonas
2
1.9k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
210
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
61
52k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.6k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
230
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
30 Presentation Tips
portentint
PRO
1
210
Transcript
Building command-line interface (CLI) with ruby
I have learnt ruby the rails way. http://www.frankwatching.com/wordpress/wp-content/uploads/2007/11/rails.jpg
Then... tryruby.org rubykoans.com rubeque.com more and more ruby
A rails app is a ruby app. A ruby app
may NOT be a rails app.
Today Ruby on CLI
What for? Utility => curl Code Genertor => Rails generator
Automation => db migration
Hello world puts "Hello world"
My ideal CLI mycli <command> [options]
I need to parse the command and options in mycli
manually. ARGV or
None
Multiple commands desc "hi", "Say hi" def hi puts "hi
!" end desc "bye", "Say goodbye" def bye puts "bye !" end
Passing argument desc "hello NAME", "Say hello to <NAME>" def
hello(name) puts "hello #{name}!" end
Parsing options desc "hello NAME", "Say hello to <NAME>" method_options
loudly: false def hello(name) name.upcase! if options[:loudly] puts "hello #{name}!" end
Documentation ready
Thanks @lchanmann
References http://whatisthor.com/ http://yehudakatz.com/2009/01/13/some-thor-news/ http://rubylearning.com/blog/2011/01/03/how-do-i-make-a-command-line-tool-in-ruby/ http://www.bounga.org/ruby/2011/09/12/thor-a-command-line-scripting-tool/ Demo: https://gist.github.com/3688473 Checkout thor on
Github https://github.com/wycats/thor http://whatisthor.com/images/thor.png