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
責任感のあるCloudWatchアラームを設計しよう
akihisaikeda
3
170
AI & Enginnering
codelynx
0
110
humanlayerのブログから学ぶ、良いCLAUDE.mdの書き方
tsukamoto1783
0
190
React 19でつくる「気持ちいいUI」- 楽観的UIのすすめ
himorishige
11
7.3k
15年続くIoTサービスのSREエンジニアが挑む分散トレーシング導入
melonps
2
190
AIフル活用時代だからこそ学んでおきたい働き方の心得
shinoyu
0
130
組織で育むオブザーバビリティ
ryota_hnk
0
170
CSC307 Lecture 09
javiergs
PRO
1
830
KIKI_MBSD Cybersecurity Challenges 2025
ikema
0
1.3k
例外処理とどう使い分ける?Result型を使ったエラー設計 #burikaigi
kajitack
16
6k
AI Agent Tool のためのバックエンドアーキテクチャを考える #encraft
izumin5210
6
1.8k
Patterns of Patterns
denyspoltorak
0
1.4k
Featured
See All Featured
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.6k
Heart Work Chapter 1 - Part 1
lfama
PRO
5
35k
Agile that works and the tools we love
rasmusluckow
331
21k
Designing Powerful Visuals for Engaging Learning
tmiket
0
230
[SF Ruby Conf 2025] Rails X
palkan
1
740
The SEO identity crisis: Don't let AI make you average
varn
0
67
Principles of Awesome APIs and How to Build Them.
keavy
128
17k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
0
270
Testing 201, or: Great Expectations
jmmastey
46
8k
Exploring anti-patterns in Rails
aemeredith
2
250
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2k
Darren the Foodie - Storyboard
khoart
PRO
2
2.4k
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