Class: Branchtree::Commands::Parent

Inherits:
Common
  • Object
show all
Defined in:
lib/branchtree/commands/parent.rb

Instance Method Summary collapse

Methods inherited from Common

#load_situation, #load_tree, #pluralize

Methods included from Branchtree::Context

logger

Instance Method Details

#executeObject



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/branchtree/commands/parent.rb', line 11

def execute
  super

  situation = load_situation
  tree = load_tree
  current_branch = tree.find_branch(situation.current_branch_name)
  unless current_branch
    $stderr.puts "The current branch #{situation.current_branch_name} is not within the tree."
    exit 1
  end

  puts current_branch.parent_branch_name
end