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
47
Khmer ASR using Deep Learning
lchanmann
0
460
Path Finding using Search Algorithms
lchanmann
0
60
The secret to a good life
lchanmann
0
61
Monit - unix monitoring utility
lchanmann
1
120
Techcamp PP
lchanmann
0
120
Trying out Verboice
lchanmann
1
100
CoffeeScript
lchanmann
4
210
Other Decks in Programming
See All in Programming
テストを司るデーモンに会いに行く 〜隔離した仮想マシンでテストを通すまで〜
h1d3mun3
1
590
個人開発基盤をまるごとCloudflareに引っ越して爆速で総合的体験を向上させた話
tinykitten
0
210
20260914 AIエージェント時代のPlatform Engineering LLM基盤とプロダクトの責務境界線
kanfab1
7
2.3k
モジュールの視点からSwiftを読み解く #iosdc
s_shimotori
0
210
Omarchy Tokyo やると聞いて UMPC 買ってセットアップしてきた
mtsmfm
0
180
Heart of Swift Concurrency
koher
0
1.1k
ソニーのクラウド共通基盤の変遷とAI時代の開発スタイルに合わせた進化 / The Journey of Sony’s Common Cloud Platform and Its Evolution for AI-Native Development
kenjiyoneyama
0
160
AgentCore CLI で進化した AWS での AI エージェントの作り方 : 必要な機能を必要な時に
icoxfog417
PRO
3
390
iOSDCのペンライトを自動制御したい!
akkeylab
0
120
Agents on Rails - Rails at Scale 2026
irinanazarova
0
280
C#の現在地 進化の歴史と、AI時代の.NET Everywhere
neuecc
5
4.3k
AGENTS.md Is Not Enough:Build Skills, Don't Download Them
lx_t
0
130
Featured
See All Featured
WENDY [Excerpt]
tessaabrams
14
39k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
720
Context Engineering - Making Every Token Count
addyosmani
9
1.2k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3.1k
Six Lessons from altMBA
skipperchong
29
4.5k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
How STYLIGHT went responsive
nonsquared
100
6.3k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Accessibility Awareness
sabderemane
1
220
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