Class: Ace::Retro::CLI::Commands::Create
- Inherits:
-
Support::Cli::Command
- Object
- Support::Cli::Command
- Ace::Retro::CLI::Commands::Create
- Includes:
- Support::Cli::Base
- Defined in:
- lib/ace/retro/cli/commands/create.rb
Overview
ace-support-cli Command class for ace-retro create
Instance Method Summary collapse
Instance Method Details
#call(title: nil, **options) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/ace/retro/cli/commands/create.rb', line 40 def call(title: nil, **) type = [:type] = [:tags] move_to = [:"move-to"] dry_run = [:"dry-run"] = ? .split(",").map(&:strip).reject(&:empty?) : [] unless title warn "Error: title is required" warn "" warn "Usage: ace-retro create TITLE [--type TYPE] [--tags T1,T2] [--move-to FOLDER]" raise Ace::Support::Cli::Error.new("Title required") end if dry_run puts "Would create retro:" puts " Title: #{title}" puts " Type: #{type || "standard"}" puts " Tags: #{.any? ? .join(", ") : "(none)"}" puts " Folder: #{move_to ? "_#{move_to.delete_prefix("_")}" : "(root)"}" return end manager = Ace::Retro::Organisms::RetroManager.new retro = manager.create( title, type: type, tags: , move_to: move_to ) folder_info = retro.special_folder ? " (#{retro.special_folder})" : "" puts "Retro created: #{retro.id} #{retro.title}#{folder_info}" puts " Path: #{retro.file_path}" if [:git_commit] Ace::Support::Items::Molecules::GitCommitter.commit( paths: [retro.path], intention: "create retro #{retro.id}" ) end end |