Class: GitTopic::Commands::Show

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

Overview

show command shows branch description

Instance Method Summary collapse

Constructor Details

#initialize(topic_name) ⇒ Show

Returns a new instance of Show.



7
8
9
10
11
12
13
14
# File 'lib/git_topic/commands/show.rb', line 7

def initialize(topic_name)
  if topic_name.nil?
    command = 'git rev-parse --abbrev-ref HEAD'
    _stdin, stdout, _stderr, _wait_thr = *Open3.popen3(command)
    topic_name = stdout.readline.chop
  end
  @topic_name = topic_name
end

Instance Method Details

#executeObject



16
17
18
19
# File 'lib/git_topic/commands/show.rb', line 16

def execute
  config_key = "branch.#{@topic_name}.description"
  system("git config #{config_key}")
end