Method: Webgen::CLI::CommandParser#parse

Defined in:
lib/webgen/cli.rb

#parse(argv = ARGV) ⇒ Object

Parse the command line arguments.

Once the website directory information is gathered, the Webgen::Website is initialized to allow additional CLI commands to be added by extensions.



195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# File 'lib/webgen/cli.rb', line 195

def parse(argv = ARGV)
  super do |level, name|
    if level == 0
      # Create website object/automatically performs initialization; needed so that custom
      # commands can be added
      begin
        website
      rescue Webgen::BundleLoadError
      end
    end
  end
rescue
  puts "webgen encountered a problem:\n  " + $!.message
  puts $!.backtrace if @log_level == ::Logger::DEBUG
  exit(1)
end