Module: Flare::CLI

Defined in:
lib/flare/cli.rb,
lib/flare/cli/output.rb

Defined Under Namespace

Modules: Output

Constant Summary collapse

COMMANDS =
{
  "setup" => "Authenticate and configure Flare for this project",
  "doctor" => "Check your Flare setup for issues",
  "status" => "Show current Flare configuration",
  "version" => "Print the Flare version",
  "help" => "Show this help message",
}.freeze

Class Method Summary collapse

Class Method Details



41
42
43
44
45
46
47
48
# File 'lib/flare/cli.rb', line 41

def self.print_help
  puts "Usage: flare <command>"
  puts
  puts "Commands:"
  COMMANDS.each do |name, description|
    puts "  %-12s %s" % [name, description]
  end
end

.start(argv) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/flare/cli.rb', line 15

def self.start(argv)
  command = argv.first

  case command
  when "setup"
    require_relative "cli/setup_command"
    force = argv.include?("--force")
    SetupCommand.new(force: force).run
  when "doctor"
    require_relative "cli/doctor_command"
    DoctorCommand.new.run
  when "status"
    require_relative "cli/status_command"
    StatusCommand.new.run
  when "version", "-v", "--version"
    puts "flare #{Flare::VERSION}"
  when "help", nil, "-h", "--help"
    print_help
  else
    $stderr.puts "Unknown command: #{command}"
    $stderr.puts
    print_help
    exit 1
  end
end