def print_usage(actions):
 actions = actions.items()
 actions.sort()
 print ('usage: %s <action> [<options>]' % basename(sys.argv[0]))
 print ('       %s --help' % basename(sys.argv[0]))
 print
 print 'actions:'
 for (name, (func, doc, arguments)) in actions:
  print ('  %s:' % name)
  for line in doc.splitlines():
   print ('    %s' % line)
  if arguments:
   print
  for (arg, shortcut, default, argtype) in arguments:
   if isinstance(default, bool):
    print ('    %s' % ((((shortcut and ('-%s, ' % shortcut)) or '') + '--') + arg))
   else:
    print ('    %-30s%-10s%s' % (((((shortcut and ('-%s, ' % shortcut)) or '') + '--') + arg), argtype, default))
  print

def print_usage ( actions ) : actions = actions . items ( ) actions . sort ( ) print ( 'usage: %s <action> [<options>]' % basename ( sys . argv [ 0 ] ) ) print ( '       %s --help' % basename ( sys . argv [ 0 ] ) ) print print 'actions:' for ( name , ( func , doc , arguments ) ) in actions : print ( '  %s:' % name ) for line in doc . splitlines ( ) : print ( '    %s' % line ) if arguments : print for ( arg , shortcut , default , argtype ) in arguments : if isinstance ( default , bool ) : print ( '    %s' % ( ( ( ( shortcut and ( '-%s, ' % shortcut ) ) or '' ) + '--' ) + arg ) ) else : print ( '    %-30s%-10s%s' % ( ( ( ( ( shortcut and ( '-%s, ' % shortcut ) ) or '' ) + '--' ) + arg ) , argtype , default ) ) print
print the usage information .