lib/git_topic/cli.rb in git_topic-0.2.5 vs lib/git_topic/cli.rb in git_topic-0.3.0
- old
+ new
@@ -2,29 +2,31 @@
require 'thor'
require 'open3'
require 'git_topic/version'
-require 'git_topic/commands/list'
+require 'git_topic/commands/add'
require 'git_topic/commands/edit'
+require 'git_topic/commands/list'
require 'git_topic/commands/show'
module GitTopic
# CLI command entry point
class Cli < Thor
default_command :list
desc 'list', 'Show managed topics'
option :version, aliases: 'v'
+ option :all, aliases: 'a'
def list
# Show version if -v specified
if options[:version]
version if options[:version]
return
end
- command = GitTopic::Commands::List.new
+ command = GitTopic::Commands::List.new options
command.execute
end
desc 'edit [branch_name]', 'Edit topic description'
def edit(branch_name = nil)
@@ -41,13 +43,13 @@
desc 'version', 'Show version'
def version
puts GitTopic::VERSION
end
- desc 'add topic_name', 'Remember topic'
- def add(topic_name)
- puts "add #{topic_name}"
- raise 'not implemented'
+ desc 'add topic_name summary', 'Remember topic'
+ def add(topic_name, summary)
+ command = GitTopic::Commands::Add.new topic_name, summary
+ command.execute
end
desc 'start topic_name', 'Transfer topic_name to branch to implement code'
def start(topic_name)
puts "start #{topic_name}"