Class: GT::Commands::Restack

Inherits:
Object
  • Object
show all
Defined in:
lib/gt/commands/restack.rb

Class Method Summary collapse

Class Method Details

.run(argv) ⇒ Object

Raises:



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/gt/commands/restack.rb', line 6

def self.run(argv)
  state = GT::State.new

  if argv.include?("--abort")
    return handle_abort(state)
  end

  if argv.include?("--continue")
    return handle_continue(state)
  end

  branches = GT::Stack.build_all
  raise GT::UserError, "No stack found. Use `gt create` to start one." if branches.length < 2

  maybe_delete_merged(branches)
  branches = GT::Stack.build_all
  restack_from(branches, 1, state)
end