Class: InteractorsMindmap::Cli

Inherits:
Object
  • Object
show all
Defined in:
lib/interactors_mindmap/cli.rb

Overview

Command line interface

Constant Summary collapse

HELP_TEXT =
"Usage:\n  interactors_mindmap [options]\nOptions:\n  --all   # Generate md and html file\n  --md    # Generate md file\n  --html  # Generate html file\n  --help  # Show this message\n"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Cli

Returns a new instance of Cli.



19
20
21
# File 'lib/interactors_mindmap/cli.rb', line 19

def initialize(argv)
  @argv = argv
end

Instance Attribute Details

#argvObject (readonly)

Returns the value of attribute argv.



17
18
19
# File 'lib/interactors_mindmap/cli.rb', line 17

def argv
  @argv
end

Instance Method Details

#runObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/interactors_mindmap/cli.rb', line 23

def run
  first_argument = argv.first
  case first_argument
  when "--all"
    generate_all_docs
  when "--md"
    generate_md_doc
  when "--html"
    generate_html_doc
  when "--help"
    help
  when "--version"
    version
  else
    help
  end
end