Class: Terry
- Inherits:
-
Object
- Object
- Terry
- Defined in:
- lib/terry.rb
Defined Under Namespace
Classes: ApiService, BashAlias
Instance Method Summary collapse
-
#initialize(args) ⇒ Terry
constructor
A new instance of Terry.
Constructor Details
#initialize(args) ⇒ Terry
Returns a new instance of Terry.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/terry.rb', line 8 def initialize(args) case args[0] when "-v" puts "0.0.2" when "list" Terry::BashAlias.format_for_terminal(Terry::ApiService.list_all) when "search" if args[1] results = Terry::ApiService.search(args[1]) if results.empty? puts "No results found for #{args[1]} :(".red else puts "Found #{results.length} result(s) for #{args[1]}".green Terry::BashAlias.format_for_terminal(results) end else puts "Please provide a search term eg." puts "\n $ terry search git\n".green end end end |