Class: SnippetCli::CLI
- Inherits:
-
Thor
- Object
- Thor
- SnippetCli::CLI
- Defined in:
- lib/snippet_cli/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)
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.exit_on_failure? ⇒ Boolean
11 12 13 14 |
# File 'lib/snippet_cli/cli.rb', line 11 def self.exit_on_failure? true puts "Something went wrong, try again." end |
Instance Method Details
#info(docs = nil) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/snippet_cli/cli.rb', line 28 def info(docs = nil) if [:help] invoke :help, ['info'] else require_relative 'commands/info' SnippetCli::Commands::Info.new(docs, ).execute end end |
#new ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'lib/snippet_cli/cli.rb', line 40 def new(*) if [:help] invoke :help, ['new'] else require_relative 'commands/new' SnippetCli::Commands::New.new().execute end end |
#setup ⇒ Object
52 53 54 55 56 57 58 59 |
# File 'lib/snippet_cli/cli.rb', line 52 def setup(*) if [:help] invoke :help, ['setup'] else require_relative 'commands/setup' SnippetCli::Commands::Setup.new().execute end end |
#version ⇒ Object
19 20 21 22 |
# File 'lib/snippet_cli/cli.rb', line 19 def version require_relative 'version' puts "v#{SnippetCli::VERSION}" end |