Permalink
Browse files

Merge pull request #12 from icco/master

Add better argument parsing to ./profile
  • Loading branch information...
2 parents 79d9576 + 0dd06d8 commit 74f7633f28d909e7af845c5b38823e87709c9423 @jpf committed Jan 17, 2012
Showing with 17 additions and 2 deletions.
  1. +17 −2 profile
View
19 profile
@@ -6,5 +6,20 @@ require 'pp'
require 'domain-profiler'
require 'erb'
-profile = DomainProfiler.new(ARGV[0])
-puts ERB.new(File.read("view/text")).result
+def help
+ puts <<-help
+Usage:
+ $ ./profile domain.com
+help
+end
+
+if ($stdin.tty? && ARGV.empty?) || ARGV.delete('-h') || ARGV.delete('--help')
+ help
+else
+ profile = nil
+
+ ARGV.each do |domain|
+ profile = DomainProfiler.new(domain)
+ puts ERB.new(File.read("view/text")).result
+ end
+end

0 comments on commit 74f7633

Please sign in to comment.