Class: GitTopic::Cli

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

Overview

CLI command entry point

Instance Method Summary collapse

Instance Method Details

#add(topic_name, summary) ⇒ Object



53
54
55
56
# File 'lib/git_topic/cli.rb', line 53

def add(topic_name, summary)
  command = GitTopic::Commands::Add.new topic_name, summary
  command.execute
end

#delete(topic_name) ⇒ Object



59
60
61
62
# File 'lib/git_topic/cli.rb', line 59

def delete(topic_name)
  command = GitTopic::Commands::Delete.new topic_name
  command.execute
end

#edit(branch_name = nil) ⇒ Object



35
36
37
38
# File 'lib/git_topic/cli.rb', line 35

def edit(branch_name = nil)
  command = GitTopic::Commands::Edit.new branch_name
  command.execute
end

#listObject



24
25
26
27
28
29
30
31
32
# File 'lib/git_topic/cli.rb', line 24

def list
  # Show version if -v specified
  version && return if options[:version]
  # Edit topic if -e specified
  edit && return if options[:edit]

  command = GitTopic::Commands::List.new options
  command.execute
end

#publish(repo, base, branch_name) ⇒ Object

rubocop:enable Metrics/LineLength



73
74
75
76
77
# File 'lib/git_topic/cli.rb', line 73

def publish(repo, base, branch_name)
  client = Octokit::Client.new(netrc: true)
  command = GitTopic::Commands::Publish.new client, repo, branch_name, base
  command.execute
end

#show(branch_name = nil) ⇒ Object



41
42
43
44
# File 'lib/git_topic/cli.rb', line 41

def show(branch_name = nil)
  command = GitTopic::Commands::Show.new branch_name
  command.execute
end

#start(topic_name) ⇒ Object



65
66
67
68
# File 'lib/git_topic/cli.rb', line 65

def start(topic_name)
  command = GitTopic::Commands::Start.new topic_name
  command.execute
end

#versionObject



47
48
49
50
# File 'lib/git_topic/cli.rb', line 47

def version
  puts GitTopic::VERSION
  true
end