Class: InteractorsMindmap::Cli

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

Overview

Command line interface

Constant Summary collapse

HELP_TEXT =
<<~HELP_TEXT
  Usage:
    interactors_mindmap [options]
  Options:
    --all      # Generate md and html file
    --md       # Generate md file
    --html     # Generate html file
    --version  # Show gem version
    --help     # Show this message
HELP_TEXT

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Cli

Returns a new instance of Cli.



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

def initialize(argv)
  @argv = argv
end

Instance Attribute Details

#argvObject (readonly)

Returns the value of attribute argv.



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

def argv
  @argv
end

Instance Method Details

#runObject



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

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