mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-13 08:01:09 +00:00
* hugdaylist: Improved argument and error handling.
This commit is contained in:
parent
59a6f32e8e
commit
684715ff89
1
debian/changelog
vendored
1
debian/changelog
vendored
@ -3,6 +3,7 @@ ubuntu-dev-tools (0.37ubuntu1) intrepid; urgency=low
|
|||||||
[ Jonathan Patrick Davies ]
|
[ Jonathan Patrick Davies ]
|
||||||
* get-branches: Open the teams code page before making a new directory.
|
* get-branches: Open the teams code page before making a new directory.
|
||||||
* doc/get-branches.1: Created.
|
* doc/get-branches.1: Created.
|
||||||
|
* hugdaylist: Improved argument and error handling.
|
||||||
|
|
||||||
-- Jonathan Patrick Davies <jpds@ubuntu.com> Sun, 10 August 2008 22:07:58 +0100
|
-- Jonathan Patrick Davies <jpds@ubuntu.com> Sun, 10 August 2008 22:07:58 +0100
|
||||||
|
|
||||||
|
15
hugdaylist
15
hugdaylist
@ -50,6 +50,7 @@ def check_args():
|
|||||||
# Our usage options.
|
# Our usage options.
|
||||||
usage = "usage: %prog [-n <number>] launchpad-buglist-url"
|
usage = "usage: %prog [-n <number>] launchpad-buglist-url"
|
||||||
optParser = OptionParser(usage)
|
optParser = OptionParser(usage)
|
||||||
|
argsParsed = 0
|
||||||
|
|
||||||
# Options - namely just the number of bugs to output.
|
# Options - namely just the number of bugs to output.
|
||||||
optParser.add_option("-n", "--number", action = "store_true",
|
optParser.add_option("-n", "--number", action = "store_true",
|
||||||
@ -57,11 +58,14 @@ def check_args():
|
|||||||
|
|
||||||
# Parse arguments.
|
# Parse arguments.
|
||||||
(options, args) = optParser.parse_args()
|
(options, args) = optParser.parse_args()
|
||||||
|
print options
|
||||||
|
print args
|
||||||
|
|
||||||
# Check if we want a number other than the default.
|
# Check if we want a number other than the default.
|
||||||
if options.number:
|
if options.number:
|
||||||
try:
|
try:
|
||||||
howmany = int(args[0])
|
howmany = int(args[argsParsed])
|
||||||
|
argsParsed += 1
|
||||||
except:
|
except:
|
||||||
print >> sys.stderr, "Option '-n' requires an integer for an " \
|
print >> sys.stderr, "Option '-n' requires an integer for an " \
|
||||||
"argument."
|
"argument."
|
||||||
@ -75,7 +79,7 @@ def check_args():
|
|||||||
optParser.print_help()
|
optParser.print_help()
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
url = args[0]
|
url = args[argsParsed]
|
||||||
|
|
||||||
return (howmany, url)
|
return (howmany, url)
|
||||||
|
|
||||||
@ -93,7 +97,12 @@ def filter_unsolved(b):
|
|||||||
def main():
|
def main():
|
||||||
(howmany, url) = check_args()
|
(howmany, url) = check_args()
|
||||||
|
|
||||||
bl = BugList(url)
|
try:
|
||||||
|
bl = BugList(url)
|
||||||
|
except:
|
||||||
|
print >> sys.stderr, "The page '%s' does not appear to exist." % url
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
l = filter(filter_unsolved, bl)
|
l = filter(filter_unsolved, bl)
|
||||||
|
|
||||||
if not l:
|
if not l:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user