Class: Nova::CLI

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

Class Method Summary collapse

Class Method Details

.show_helpObject



28
29
30
31
32
33
34
35
# File 'lib/nova/cli.rb', line 28

def self.show_help
  puts "Nova - A CLI tool for generating project structures"
  puts ""
  puts "Usage:"
  puts "  nova new [app_name]    # Create a new app with the specified name"
  puts "  nova version           # Show the version"
  puts "  nova help              # Show this help message"
end

.start(args) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/nova/cli.rb', line 6

def self.start(args)
  command = args.shift
  case command
  when 'new'
    app_name = args.shift
    if app_name.nil? || app_name.empty?
      puts "Error: Please provide an app name"
      puts "Usage: nova new [app_name]"
      exit 1
    end
    Generator.new(app_name).generate
  when 'version', '-v', '--version'
    puts "Nova version #{Nova::VERSION}"
  when 'help', '-h', '--help', nil
    show_help
  else
    puts "Unknown command: #{command}"
    show_help
    exit 1
  end
end