Skip to content

Commit

Permalink
Merge pull request #17 from elorest/master
Browse files Browse the repository at this point in the history
Fixed error with newer versions of crystal where OptionParser now requires - before options
  • Loading branch information
f authored Mar 27, 2017
2 parents 2b687a6 + ff6b44e commit 603acb1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/libs/
/.crystal/
/.shards/
guardian


# Libraries don't need dependency lock
Expand Down
Binary file removed guardian
Binary file not shown.
25 changes: 15 additions & 10 deletions src/guardian.cr
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
require "./guardian/*"
require "option_parser"

options_parser = OptionParser.new do |options|
options.on "init", "Generates the .guardian.yml file" do
Guardian::Generator.new.generate
exit
end
case ARGV[0]?
when "init"
puts "\"init\" has been deprecated please use: -i or --init"
Guardian::Generator.new.generate
exit
else
OptionParser.parse! do |options|
options.on "-i", "--init", "Generates the .guardian.yml file" do
Guardian::Generator.new.generate
exit
end

options.on "-v", "--version", "Shows the version" do
puts "Guardian (#{Guardian::VERSION})"
exit
options.on "-v", "--version", "Shows the version" do
puts "Guardian (#{Guardian::VERSION})"
exit
end
end
end

options_parser.parse(ARGV.clone)

Guardian::Watcher.new

0 comments on commit 603acb1

Please sign in to comment.