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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Mann
September 08, 2012
Programming
5
610
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
39
Khmer ASR using Deep Learning
lchanmann
0
440
Path Finding using Search Algorithms
lchanmann
0
46
The secret to a good life
lchanmann
0
45
Monit - unix monitoring utility
lchanmann
1
110
Techcamp PP
lchanmann
0
110
Trying out Verboice
lchanmann
1
96
CoffeeScript
lchanmann
4
200
Other Decks in Programming
See All in Programming
CS教育のDX AIによる育成の効率化
niftycorp
PRO
0
170
おれのAgentic Coding 2026/03
tsukasagr
1
120
AI時代の脳疲弊と向き合う ~言語学としてのPHP~
sakuraikotone
1
1.6k
存在論的プログラミング: 時間と存在を記述する
koriym
5
580
Codex の「自走力」を高める
yorifuji
0
1.3k
Fundamentals of Software Engineering In the Age of AI
therealdanvega
2
300
Strategy for Finding a Problem for OSS: With Real Examples
kibitan
0
120
Everything Claude Code OSS詳細 — 5層構造の中身と導入方法
targe
0
160
ロボットのための工場に灯りは要らない
watany
12
3.2k
Reactive ❤️ Loom: A Forbidden Love Story
franz1981
2
200
一度始めたらやめられない開発効率向上術 / Findy あなたのdotfilesを教えて!
k0kubun
3
2.4k
Tamach-sre-3_ANDPAD-shimaison93
mane12yurks38
0
200
Featured
See All Featured
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
68
38k
Tell your own story through comics
letsgokoyo
1
870
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
440
Technical Leadership for Architectural Decision Making
baasie
3
300
Are puppies a ranking factor?
jonoalderson
1
3.2k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
160
Odyssey Design
rkendrick25
PRO
2
560
Making Projects Easy
brettharned
120
6.6k
Scaling GitHub
holman
464
140k
Chasing Engaging Ingredients in Design
codingconduct
0
150
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