def _ask_and_call(cmds, cwd=None):
 def quote(s):
  return (('"%s"' % s) if (' ' in s) else s)
 sys.stdout.write(('Okay to execute:\n\n%s\n(y/n)?\n' % '\n'.join([' '.join([quote(s) for s in c]) for c in cmds])))
 while 1:
  input = sys.stdin.readline().strip().lower()
  if (input in ['y', 'n']):
   break
 accepted = (input == 'y')
 if accepted:
  _call(cmds, cwd)
 return accepted

def _ask_and_call ( cmds , cwd = None ) : def quote ( s ) : return ( ( '"%s"' % s ) if ( ' ' in s ) else s ) sys . stdout . write ( ( 'Okay to execute:\n\n%s\n(y/n)?\n' % '\n' . join ( [ ' ' . join ( [ quote ( s ) for s in c ] ) for c in cmds ] ) ) ) while 1 : input = sys . stdin . readline ( ) . strip ( ) . lower ( ) if ( input in [ 'y' , 'n' ] ) : break accepted = ( input == 'y' ) if accepted : _call ( cmds , cwd ) return accepted
pretty print cmds .