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
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
CSC307 Lecture 02
javiergs
PRO
1
780
AIで開発はどれくらい加速したのか?AIエージェントによるコード生成を、現場の評価と研究開発の評価の両面からdeep diveしてみる
daisuketakeda
1
2.4k
AI によるインシデント初動調査の自動化を行う AI インシデントコマンダーを作った話
azukiazusa1
1
710
0→1 フロントエンド開発 Tips🚀 #レバテックMeetup
bengo4com
0
560
OCaml 5でモダンな並列プログラミングを Enjoyしよう!
haochenx
0
140
「ブロックテーマでは再現できない」は本当か?
inc2734
0
960
AIによる開発の民主化を支える コンテキスト管理のこれまでとこれから
mulyu
3
210
Lambda のコードストレージ容量に気をつけましょう
tattwan718
0
120
AgentCoreとHuman in the Loop
har1101
5
230
CSC307 Lecture 06
javiergs
PRO
0
680
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
540
Featured
See All Featured
Utilizing Notion as your number one productivity tool
mfonobong
3
220
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
56
Writing Fast Ruby
sferik
630
62k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
75
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
49
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.4k
The SEO identity crisis: Don't let AI make you average
varn
0
68
Stop Working from a Prison Cell
hatefulcrawdad
273
21k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
270
The untapped power of vector embeddings
frankvandijk
1
1.6k
What's in a price? How to price your products and services
michaelherold
247
13k
Navigating Weather and Climate Data
rabernat
0
100
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