Class: Lapidarius::CLI

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

Constant Summary collapse

HELP_FLAGS =
%w[-h --help]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args: [], io: STDOUT, command: Command, cutter: Cutter, tree: Tree, spinner: Spinner.new) ⇒ CLI

Returns a new instance of CLI.



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/lapidarius/cli.rb', line 10

def initialize(args: [], io: STDOUT, command: Command, cutter: Cutter, 
               tree: Tree, spinner: Spinner.new)
  @args = args
  @io = io
  @command = command
  @cutter = cutter
  @tree = tree
  @spinner = spinner
  @name = @args.shift unless help?
  parser.parse!(@args)
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/lapidarius/cli.rb', line 8

def name
  @name
end

#remoteObject (readonly)

Returns the value of attribute remote.



8
9
10
# File 'lib/lapidarius/cli.rb', line 8

def remote
  @remote
end

#versionObject (readonly)

Returns the value of attribute version.



8
9
10
# File 'lib/lapidarius/cli.rb', line 8

def version
  @version
end

Instance Method Details

#callObject



22
23
24
25
26
27
# File 'lib/lapidarius/cli.rb', line 22

def call
  @spinner.call do
    @output = cut
  end
  @io.puts @output
end