Class: RailsBlocks::CLI

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

Constant Summary collapse

DownloadError =
Class.new(StandardError)
DEFAULT_REGISTRY_URL =
"https://raw.githubusercontent.com/Rails-Blocks/components/main/registry.json".freeze
DEFAULT_API_URL =
"https://railsblocks.com".freeze

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ CLI

Returns a new instance of CLI.



16
17
18
# File 'lib/rails_blocks/cli.rb', line 16

def initialize(argv)
  @argv = argv.dup
end

Instance Method Details

#runObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/rails_blocks/cli.rb', line 20

def run
  command = @argv.shift

  case command
  when "list" then list
  when "search" then search(@argv.join(" "))
  when "show" then show(@argv.shift)
  when "docs" then docs(@argv.shift)
  when "examples" then examples(@argv.shift)
  when "install" then install(@argv.shift)
  when "diff" then diff(@argv.shift)
  when "update" then update(@argv.shift)
  when "login" then 
  when "logout" then logout
  when "whoami" then whoami
  when "agents" then agents
  when "mcp" then mcp
  when "doctor" then doctor
  else help
  end
end