Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Thor - Building CLI with ruby
Search
Mann
September 08, 2012
Programming
630
5
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Thor - Building CLI with ruby
Create command-line interface with thor
Mann
September 08, 2012
More Decks by Mann
See All by Mann
From Cambodia to Mizzou
lchanmann
0
48
Khmer ASR using Deep Learning
lchanmann
0
460
Path Finding using Search Algorithms
lchanmann
0
61
The secret to a good life
lchanmann
0
62
Monit - unix monitoring utility
lchanmann
1
120
Techcamp PP
lchanmann
0
120
Trying out Verboice
lchanmann
1
110
CoffeeScript
lchanmann
4
210
Other Decks in Programming
See All in Programming
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Rails World 2026, Austin, Texas
marcoroth
0
220
PumaからFalconに移行したRailsアプリケーションでの実践
falcon8823
0
170
sbt 2.0: takeoff
eed3si9n
0
160
現場と育てるRailsモデリング 〜Spreadsheetから始めたモデル設計〜
siroemk
2
600
C#の現在地 進化の歴史と、AI時代の.NET Everywhere
neuecc
5
5.2k
Everything will be SERVERLESS — 信じて運用した10年の経験値 / Everything Will be Serverless — Lessons Learned from 10 Years of Operational Experience
seike460
PRO
1
1.1k
Rでドレミ/Do-Re-Mi_with_R
florets1
0
130
機械に任せるテスト、人が見るテスト ⽣成AIで引き直した、運⽤保守フェーズの線引き
dske104
0
190
當我們開始不讀 Code - AI Agent 時代,Code Review 與 Clean Code 還剩下什麼?
jame2408
1
230
JAWS-UG 東京支部が始める、JAWS-UG支部コラボ / JAWS-UG lunchtime LT Collaboration
y0hgi
0
280
Workers Cache を知る
syumai
0
370
contenteditable と日本語入力に向き合う
colorful12
0
200
Featured
See All Featured
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
530
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
1
280
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
The Spectacular Lies of Maps
axbom
PRO
1
1.1k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
8.1k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
2
6.3k
VelocityConf: Rendering Performance Case Studies
addyosmani
331
25k
How to Talk to Developers About Accessibility
jct
2
580
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
590
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
2
410
Darren the Foodie - Storyboard
khoart
PRO
4
4k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.6k
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