Class: Icarus::Mod::CLI::Remove

Inherits:
SubcommandBase show all
Includes:
Tools::Sync::Helpers
Defined in:
lib/icarus/mod/cli/remove.rb

Overview

Remove CLI command definitions rubocop:disable Style/GlobalVars

Instance Method Summary collapse

Methods included from Tools::Sync::Helpers

#retrieve_from_url

Methods inherited from SubcommandBase

banner, subcommand_prefix

Methods inherited from Base

exit_on_failure?

Instance Method Details

#mod(mod_id) ⇒ Object



75
76
77
78
79
80
81
82
83
84
# File 'lib/icarus/mod/cli/remove.rb', line 75

def mod(mod_id)
  remove_entity(
    :mod,
    mod_id,
    "Mod",
    "Mod not found with ID: #{mod_id}",
    "Successfully removed mod: #{mod_id}",
    "Failed to remove mod: #{mod_id}"
  )
end

#modinfo(item) ⇒ Object



51
52
53
54
55
56
57
58
59
60
# File 'lib/icarus/mod/cli/remove.rb', line 51

def modinfo(item)
  remove_item(
    :modinfo,
    item,
    "Modinfo entry",
    "Modinfo entry not found: #{item}",
    "Successfully removed modinfo entry: #{item}",
    "Failed to remove modinfo entry: #{item}"
  )
end

#repos(repo) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/icarus/mod/cli/remove.rb', line 19

def repos(repo)
  # Try exact match first (for full URLs), then stripped format
  repo_name = if firestore.repositories.include?(repo)
                repo
              else
                repo.gsub(%r{https?://.*github\.com/}, "")
              end

  # Check if repository exists
  unless firestore.repositories.include?(repo_name)
    warn "Repository not found: #{repo_name}"
    exit 1
  end

  puts Paint["Removing repository: #{repo_name}", :black] if verbose?

  if options[:cascade]
    cascade_delete_repo(repo_name)
  else
    # Just remove from repositories list
    remove_item(
      :repositories,
      repo_name,
      "Repository",
      "Repository not found: #{repo_name}",
      "Successfully removed repository: #{repo_name}",
      "Failed to remove repository: #{repo_name}"
    )
  end
end

#tool(tool_id) ⇒ Object



87
88
89
90
91
92
93
94
95
96
# File 'lib/icarus/mod/cli/remove.rb', line 87

def tool(tool_id)
  remove_entity(
    :tool,
    tool_id,
    "Tool",
    "Tool not found with ID: #{tool_id}",
    "Successfully removed tool: #{tool_id}",
    "Failed to remove tool: #{tool_id}"
  )
end

#toolinfo(item) ⇒ Object



63
64
65
66
67
68
69
70
71
72
# File 'lib/icarus/mod/cli/remove.rb', line 63

def toolinfo(item)
  remove_item(
    :toolinfo,
    item,
    "Toolinfo entry",
    "Toolinfo entry not found: #{item}",
    "Successfully removed toolinfo entry: #{item}",
    "Failed to remove toolinfo entry: #{item}"
  )
end