diff --git a/fdroid b/fdroid index 22bcffac..f8f2473f 100755 --- a/fdroid +++ b/fdroid @@ -31,17 +31,23 @@ commands = [ "stats", "server"] +def print_help(): + print "Valid commands are:" + for command in commands: + print " " + command + print "Use '%s -h' for more info about that command."%sys.argv[0] + def main(): if len(sys.argv) <= 1: - print "Specify a command. Valid commands are:" - for command in commands: - print " " + command + print_help() sys.exit(0) command = sys.argv[1] if not command in commands: - print "Command '" + command + "' not recognised" + print "Command '" + command + "' not recognised." + print "" + print_help() sys.exit(1) # Trick optparse into displaying the right usage when --help is used. diff --git a/fdroidserver/checkupdates.py b/fdroidserver/checkupdates.py index 96ad5a18..90b0fcd2 100644 --- a/fdroidserver/checkupdates.py +++ b/fdroidserver/checkupdates.py @@ -130,12 +130,14 @@ def main(): # Get all apps... apps = common.read_metadata(options.verbose) - for app in apps: + # Filter apps according to command-line options + if options.package: + apps = [app for app in apps if app['id'] == options.package] + if len(apps) == 0: + print "No such package" + sys.exit(1) - if options.package and options.package != app['id']: - # Silent skip... - pass - else: + for app in apps: print "Processing " + app['id'] + '...' mode = app['Update Check Mode'] diff --git a/fdroidserver/rewritemeta.py b/fdroidserver/rewritemeta.py index 347493bd..3ec57714 100644 --- a/fdroidserver/rewritemeta.py +++ b/fdroidserver/rewritemeta.py @@ -36,11 +36,20 @@ def main(): parser = OptionParser() parser.add_option("-v", "--verbose", action="store_true", default=False, help="Spew out even more information than normal") + parser.add_option("-p", "--package", default=None, + help="Build only the specified package") (options, args) = parser.parse_args() # Get all apps... apps = common.read_metadata(options.verbose) + # Filter apps according to command-line options + if options.package: + apps = [app for app in apps if app['id'] == options.package] + if len(apps) == 0: + print "No such package" + sys.exit(1) + for app in apps: print "Writing " + app['id'] common.write_metadata(os.path.join('metadata', app['id']) + '.txt', app) diff --git a/fdroidserver/scanner.py b/fdroidserver/scanner.py index bd9d2700..c5a04132 100644 --- a/fdroidserver/scanner.py +++ b/fdroidserver/scanner.py @@ -50,6 +50,13 @@ def main(): # Get all apps... apps = common.read_metadata(options.verbose) + # Filter apps according to command-line options + if options.package: + apps = [app for app in apps if app['id'] == options.package] + if len(apps) == 0: + print "No such package" + sys.exit(1) + html_parser = HTMLParser.HTMLParser() problems = [] @@ -59,9 +66,7 @@ def main(): for app in apps: skip = False - if options.package and app['id'] != options.package: - skip = True - elif app['Disabled']: + if app['Disabled']: print "Skipping %s: disabled" % app['id'] skip = True elif not app['builds']: