Skip to content
Browse files

Merge branch 'master' of github.com:lucasefe/gn

  • Loading branch information...
2 parents cab03dc + 9bc06a1 commit d4359a4365fcf4cbe5e4287c2d7ce83703015678 @lucasefe committed May 12, 2012
Showing with 19 additions and 3 deletions.
  1. +19 −3 bin/gn
View
22 bin/gn
@@ -25,7 +25,7 @@ class Gn
end
def location
- @location ||= [name, "./plans/#{name}", "#{ENV['HOME']}.plans/#{name}"].detect do |path|
+ @location ||= [name, "./plans/#{name}", "#{ENV['HOME']}/.plans/#{name}"].detect do |path|
Dir.exists?(path)
end
end
@@ -46,7 +46,23 @@ class Gn
editor = ENV['EDITOR'] || "vi"
system("#{editor} #{file.path}")
end
-
+
end
-Gn.new(ARGV.first)
+name = ARGV.first.to_s.strip
+
+if name.empty? || name == "-h" || name == "--help"
+ puts <<-USAGE
+ Usage: gn <name>
+
+ Run the first <name> generator that is found in the following locations:
+
+ * <name>/init.rb
+ * plans/<name>/init.rb
+ * ~/.plans/<name>/init.rb
+
+ See http://lucasefe.github.com/gn for more information.
+ USAGE
+else
+ Gn.new(name)
+end

0 comments on commit d4359a4

Please sign in to comment.
Something went wrong with that request. Please try again.