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
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
620
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
45
Khmer ASR using Deep Learning
lchanmann
0
460
Path Finding using Search Algorithms
lchanmann
0
57
The secret to a good life
lchanmann
0
60
Monit - unix monitoring utility
lchanmann
1
120
Techcamp PP
lchanmann
0
120
Trying out Verboice
lchanmann
1
100
CoffeeScript
lchanmann
4
200
Other Decks in Programming
See All in Programming
思考垂れ流し開発 ~音声入力 × AIエージェント × 開発ハーネスによる試行錯誤~
npostring
0
970
信頼性の目標を誰も求めてない
shubox
0
500
AWS DevOps Agentで インシデント対応をAIに任せたい
honmarkhunt
7
2.6k
AIエージェント時代のコードレビューを設計する
nogu66
6
2.6k
PyO3 で既存 Python 評価器を Rust core 化する ー wasm-bindgen でブラウザにも配るための設計
kdash
1
560
Foundry Localでエージェント開発
seosoft
0
150
DroidKaigi 2026 「個人開発という実験場: Android エンジニアが手にする4つの自由」
slashnephy
0
220
[DroidKaigi 2026] Bring your own phones to Gradle Managed Devices
f2lk
0
110
ハーネス設計入門 〜プロンプト、コンテキストの次〜
kinopeee
55
36k
DynamoDBの基礎を振り返りながらベクトル検索機能を理解する
musan
3
270
Claude Codeを組織的に動かして月400PRを実現した話
happy_ryo
0
260
週末にAI-DLCを本気で回したら$1,600溶けた
hbashimizu
0
130
Featured
See All Featured
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.3k
WCS-LA-2024
lcolladotor
0
820
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.3k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.5k
BBQ
matthewcrist
89
10k
Bootstrapping a Software Product
garrettdimon
PRO
306
120k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
370
Design in an AI World
tapps
1
310
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.8k
ラッコキーワード サービス紹介資料
rakko
1
4.8M
Java REST API Framework Comparison - PWX 2021
mraible
34
9.7k
Building a Scalable Design System with Sketch
lauravandoore
463
34k
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