Class: Dothtml::CLI

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

Constant Summary collapse

VERSION_STRING =
"dothtml #{Dothtml::VERSION}"
COMMANDS =
{
  "build" => {
    "usage"    => "build [dotfile]",
    "synopsis" => <<-EOS
Builds the specified dotfile (or all .dot files, if not specified)
into .svg and .html files.  This is the default command if nothing
is specified on the command line.
    EOS
  },
  "create" => {
    "usage"    => "create <dir>",
    "synopsis" => <<-EOS
Generates a new Dothtml repo at the indicated dir.
    EOS
  },
  "watch" => {
    "usage"    => "watch",
    "synopsis" => <<-EOS
Starts a guard process, which automatically does a build as .dot
files are changed.
    EOS
  },
}
COMMAND_NAMES =
COMMANDS.keys + %w(version help)
DEFAULT_COMMAND =
"build"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ CLI

Returns a new instance of CLI.



37
38
39
# File 'lib/dothtml/cli.rb', line 37

def initialize(args)
  @args = args
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



35
36
37
# File 'lib/dothtml/cli.rb', line 35

def args
  @args
end

Instance Method Details

#executeObject



41
42
43
44
45
# File 'lib/dothtml/cli.rb', line 41

def execute
  parse_global_options
  parse_command_options
  execute_command
end