Skip to content

Commit

Permalink
Add a --help option
Browse files Browse the repository at this point in the history
  • Loading branch information
purcell committed May 12, 2008
1 parent c6a1881 commit 2690e4b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion darcs-to-git
Expand Up @@ -68,12 +68,15 @@ OPTIONS
"Only pull N patches.") do |n|
OPTIONS[:num_patches] = n
end
opts.on('-h', '--help', "Show this message") do
abort opts.to_s
end
end
opts.parse!

SRCREPO = ARGV[0]
if SRCREPO.nil?
abort opts.banner() + opts.summarize()
abort opts.to_s
elsif !FileTest.exists?(SRCREPO + '/_darcs')
abort "#{SRCREPO} is not a valid local darcs repository"
end
Expand Down

2 comments on commit 2690e4b

@nominolo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is a —help option implemented by default. The opts.to_s trick seems ok, though. I could figure out how to manually display the full help message.

@purcell
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The —help didn’t appear on the list of options, so I felt compelled to add it. :)

Please sign in to comment.