1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-10-02 09:10:11 +02:00

fdroid.py: a pointer to the -h option of commands

This commit is contained in:
Tias Guns 2012-03-11 21:15:17 +00:00 committed by Tias Guns
parent ec396c3cc5
commit 409fd273b6

14
fdroid
View File

@ -31,21 +31,23 @@ commands = [
"stats",
"server"]
def print_help():
print "Valid commands are:"
for command in commands:
print " " + command
print "Use '%s <command> -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 ""
print "Valid commands are:"
for command in commands:
print " " + command
print_help()
sys.exit(1)
# Trick optparse into displaying the right usage when --help is used.