OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import fnmatch | 6 import fnmatch |
7 import glob | 7 import glob |
8 import optparse | 8 import optparse |
9 import os | 9 import os |
10 import posixpath | 10 import posixpath |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 'zip': Zip, | 518 'zip': Zip, |
519 'which': Which, | 519 'which': Which, |
520 } | 520 } |
521 | 521 |
522 | 522 |
523 def main(args): | 523 def main(args): |
524 if not args: | 524 if not args: |
525 print 'No command specified' | 525 print 'No command specified' |
526 print 'Available commands: %s' % ' '.join(FuncMap) | 526 print 'Available commands: %s' % ' '.join(FuncMap) |
527 return 1 | 527 return 1 |
528 func = FuncMap.get(args[0]) | 528 func_name = args[0] |
| 529 func = FuncMap.get(func_name) |
529 if not func: | 530 if not func: |
530 print 'Do not recognize command: ' + args[0] | 531 print 'Do not recognize command: %s' % func_name |
531 print 'Available commands: %s' % ' '.join(FuncMap) | 532 print 'Available commands: %s' % ' '.join(FuncMap) |
532 return 1 | 533 return 1 |
533 return func(args[1:]) | 534 try: |
| 535 return func(args[1:]) |
| 536 except KeyboardInterrupt: |
| 537 print '%s: interrupted' % func_name |
| 538 return 1 |
534 | 539 |
535 if __name__ == '__main__': | 540 if __name__ == '__main__': |
536 sys.exit(main(sys.argv[1:])) | 541 sys.exit(main(sys.argv[1:])) |
OLD | NEW |