Class: Bbl::CLI
- Inherits:
-
Object
- Object
- Bbl::CLI
- Defined in:
- lib/bbl.rb
Instance Method Summary collapse
-
#initialize(argv) ⇒ CLI
constructor
A new instance of CLI.
- #show_help ⇒ Object
- #validate(argv) ⇒ Object
Constructor Details
#initialize(argv) ⇒ CLI
Returns a new instance of CLI.
3 4 5 6 7 8 9 |
# File 'lib/bbl.rb', line 3 def initialize argv validate argv levels_above = '../../..' path = File. __FILE__ + levels_above + '/akjv.txt' cmd = ['grep'] + argv + [path] system *cmd end |
Instance Method Details
#show_help ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/bbl.rb', line 14 def show_help puts <<EOT \e[35;1mThis is just a wrapper around grep ____ akjv.txt\e[0m (so, for now, the help is: man grep ). If you want to see the whole text, you can do: \e[35mbbl . | less\e[0m EOT exit 1 end |
#validate(argv) ⇒ Object
11 12 13 |
# File 'lib/bbl.rb', line 11 def validate argv show_help if argv.empty? or %w(--help -h).include? argv.first end |