Skip to content

Commit

Permalink
Parse options
Browse files Browse the repository at this point in the history
  • Loading branch information
eparreno committed Aug 6, 2012
1 parent 14f1921 commit 302db94
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
5 changes: 5 additions & 0 deletions bin/apiary 100644 → 100755
@@ -0,0 +1,5 @@
#!/usr/bin/env ruby

require File.expand_path('../../lib/apiary', __FILE__)

Apiary::Cli.run(ARGV.dup)
22 changes: 22 additions & 0 deletions lib/apiary/cli.rb
@@ -0,0 +1,22 @@
class Apiary::Cli

def initialize(args=[])
@args = args
@exit_status = true
end

def self.run(args)
new(args).run
end

def parse_options!(args)
options_parser = OptionsParser.new do |opts|
opts.banner = "\nAvailable options:\n\n"

opts.on("--preview") {}
opts.on("--server") { @options[:port] = 8080 }
end
@args = options_parser.parse!(@args)
puts("ARGS: #{@args.inspect}")
end
end

0 comments on commit 302db94

Please sign in to comment.