Class: RabbitHole::CLI

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

Instance Method Summary collapse

Instance Method Details

#add(task) ⇒ Object



6
7
8
9
10
# File 'lib/rabbit_hole/cli.rb', line 6

def add(task)
  stack = Base.new
  stack.push task
  puts "Added task '#{task}' to the stack!"
end

#completeObject



19
20
21
22
23
# File 'lib/rabbit_hole/cli.rb', line 19

def complete
  stack = Base.new
  puts "Completed: '#{stack.pop}'"
  puts "Next task: '#{stack.top}'"
end

#currentObject



13
14
15
16
# File 'lib/rabbit_hole/cli.rb', line 13

def current
  stack = Base.new
  puts "Currently working on: '#{stack.top}'"
end

#showObject



26
27
28
29
30
31
32
33
34
# File 'lib/rabbit_hole/cli.rb', line 26

def show
  stack = Base.new
  tasks = stack.tasks
  puts "#{tasks.size} levels deep"
  puts "Current task: #{tasks.last}"
  tasks[0...-1].each do |task|
    puts task
  end
end