Class: Coinpare::CLI
- Inherits:
-
Thor
- Object
- Thor
- Coinpare::CLI
- Defined in:
- lib/coinpare/cli.rb
Overview
Handle the application command line parsing and the dispatch to various command objects
Constant Summary collapse
- Error =
Error raised by this runner
Class.new(StandardError)
Instance Method Summary collapse
- #coins(*names) ⇒ Object
- #help(*args) ⇒ Object
- #holdings ⇒ Object
- #markets(name = "BTC") ⇒ Object
- #version ⇒ Object
Instance Method Details
#coins(*names) ⇒ Object
60 61 62 63 64 65 66 67 |
# File 'lib/coinpare/cli.rb', line 60 def coins(*names) if [:help] invoke :help, ["coins"] else require_relative "commands/coins" Coinpare::Commands::Coins.new(names, ).execute end end |
#help(*args) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/coinpare/cli.rb', line 16 def help(*args) font = TTY::Font.new(:standard) pastel = Pastel.new(enabled: !["no-color"]) puts pastel.yellow(font.write("Coinpare")) super end |
#holdings ⇒ Object
106 107 108 109 110 111 112 113 |
# File 'lib/coinpare/cli.rb', line 106 def holdings(*) if [:help] invoke :help, ["holdings"] else require_relative "commands/holdings" Coinpare::Commands::Holdings.new().execute end end |
#markets(name = "BTC") ⇒ Object
144 145 146 147 148 149 150 151 |
# File 'lib/coinpare/cli.rb', line 144 def markets(name = "BTC") if [:help] invoke :help, ["markets"] else require_relative "commands/markets" Coinpare::Commands::Markets.new(name, ).execute end end |
#version ⇒ Object
154 155 156 157 |
# File 'lib/coinpare/cli.rb', line 154 def version require_relative "version" puts "v#{Coinpare::VERSION}" end |