Class: HDOC::CLI

Inherits:
Object
  • Object
show all
Includes:
Actions
Defined in:
lib/1hdoc/cli.rb

Overview

Provides the CLI interface for interact with the program.

Constant Summary collapse

AVAILABLE_COMMANDS =
[
  ['-i', '--init', 'Initialize necessary files.'],
  ['-c', '--commit', 'Register your progress and sync it.'],
  ['-p', '--push', 'Manually synchronize your online repository.'],
  ['-v', '--version', 'Show program version.']
].freeze

Constants included from Actions

Actions::ENVIRONMENT, Actions::QUESTIONS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Actions

#commit, #init, #push, #version

Constructor Details

#initialize(option_parser = OptionParser) ⇒ CLI

Returns a new instance of CLI.



15
16
17
18
# File 'lib/1hdoc/cli.rb', line 15

def initialize(option_parser = OptionParser)
  @option_parser = option_parser
  check_for_configuration
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/1hdoc/cli.rb', line 5

def options
  @options
end

Instance Method Details

#runObject



20
21
22
23
24
# File 'lib/1hdoc/cli.rb', line 20

def run
  start_option_parser
rescue @option_parser::ParseError
  $stderr.puts options
end