def cmd_alias(args):
 usage = 'usage: alias <add|remove|list>'
 if ((len(args) < 1) or (args[0] == 'list')):
  if (len(args) >= 2):
   wildcard = args[1].upper()
  else:
   wildcard = '*'
  for a in sorted(mpstate.aliases.keys()):
   if fnmatch.fnmatch(a.upper(), wildcard):
    print ('%-15s : %s' % (a, mpstate.aliases[a]))
 elif (args[0] == 'add'):
  if (len(args) < 3):
   print usage
   return
  a = args[1]
  mpstate.aliases[a] = ' '.join(args[2:])
 elif (args[0] == 'remove'):
  if (len(args) != 2):
   print usage
   return
  a = args[1]
  if (a in mpstate.aliases):
   mpstate.aliases.pop(a)
  else:
   print ('no alias %s' % a)
 else:
  print usage
  return

def cmd_alias ( args ) : usage = 'usage: alias <add|remove|list>' if ( ( len ( args ) < 1 ) or ( args [ 0 ] == 'list' ) ) : if ( len ( args ) >= 2 ) : wildcard = args [ 1 ] . upper ( ) else : wildcard = '*' for a in sorted ( mpstate . aliases . keys ( ) ) : if fnmatch . fnmatch ( a . upper ( ) , wildcard ) : print ( '%-15s : %s' % ( a , mpstate . aliases [ a ] ) ) elif ( args [ 0 ] == 'add' ) : if ( len ( args ) < 3 ) : print usage return a = args [ 1 ] mpstate . aliases [ a ] = ' ' . join ( args [ 2 : ] ) elif ( args [ 0 ] == 'remove' ) : if ( len ( args ) != 2 ) : print usage return a = args [ 1 ] if ( a in mpstate . aliases ) : mpstate . aliases . pop ( a ) else : print ( 'no alias %s' % a ) else : print usage return
alias commands .