Commit 3d850c2a authored by Steve Kemp's avatar Steve Kemp
Browse files

when unrecognized arguments are found show the helop

parent 6b11b504
......@@ -152,25 +152,30 @@ opts = GetoptLong.new(
[ '--template-d', '-t', GetoptLong::REQUIRED_ARGUMENT ]
)
opts.each do |opt,arg|
case opt
when '--help'
help = true
when '--manual'
manual = true
when '--verbose'
$VERBOSE = true
when '--test'
test = true
when '--no-execute'
execute = false
when '--no-delete'
delete = false
when '--prefix'
base_dir = File.expand_path(arg)
when '--template-d'
template_dir = File.expand_path(arg)
begin
opts.each do |opt,arg|
case opt
when '--help'
help = true
when '--manual'
manual = true
when '--verbose'
$VERBOSE = true
when '--test'
test = true
when '--no-execute'
execute = false
when '--no-delete'
delete = false
when '--prefix'
base_dir = File.expand_path(arg)
when '--template-d'
template_dir = File.expand_path(arg)
end
end
rescue
# Any exceptions show the help.
help = true
end
#
......
......@@ -103,33 +103,39 @@ opts = GetoptLong.new(
[ '--expire-after', '-e', GetoptLong::REQUIRED_ARGUMENT ]
)
opts.each do |opt,arg|
case opt
when '--help'
help = true
when '--manual'
manual = true
when '--verbose'
$VERBOSE = true
when '--test'
test = true
when '--no-execute'
execute = false
when '--no-delete'
delete = false
when '--force'
force = true
when '--prefix'
base_dir = File.expand_path(arg)
when '--template-d'
template_dir = File.expand_path(arg)
when '--expire-after'
expire_after = arg.to_i
when '--attempts'
attempts = arg.to_i
begin
opts.each do |opt,arg|
case opt
when '--help'
help = true
when '--manual'
manual = true
when '--verbose'
$VERBOSE = true
when '--test'
test = true
when '--no-execute'
execute = false
when '--no-delete'
delete = false
when '--force'
force = true
when '--prefix'
base_dir = File.expand_path(arg)
when '--template-d'
template_dir = File.expand_path(arg)
when '--expire-after'
expire_after = arg.to_i
when '--attempts'
attempts = arg.to_i
end
end
rescue
# any errors, show the help
help = true
end
#
# CAUTION! Here be quality kode.
#
......
......@@ -94,33 +94,39 @@ opts = GetoptLong.new(
[ '--expire-after', '-e', GetoptLong::REQUIRED_ARGUMENT ]
)
opts.each do |opt,arg|
case opt
when '--help'
help = true
when '--manual'
manual = true
when '--verbose'
$VERBOSE = true
when '--test'
test = true
when '--no-execute'
execute = false
when '--no-delete'
delete = false
begin
opts.each do |opt,arg|
case opt
when '--help'
help = true
when '--manual'
manual = true
when '--verbose'
$VERBOSE = true
when '--test'
test = true
when '--no-execute'
execute = false
when '--no-delete'
delete = false
when '--force'
force = true
when '--prefix'
base_dir = File.expand_path(arg)
when '--template-d'
template_dir = File.expand_path(arg)
when '--expire-after'
expire_after = arg.to_i
when '--wtmp-file'
wtmp_file = arg
force = true
when '--prefix'
base_dir = File.expand_path(arg)
when '--template-d'
template_dir = File.expand_path(arg)
when '--expire-after'
expire_after = arg.to_i
when '--wtmp-file'
wtmp_file = arg
end
end
rescue
# any errors, show the help
help = true
end
#
# CAUTION! Here be quality kode.
#
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment