| 15 | |
| 16 | def parser(help_msg, subcmd): |
| 17 | def f(subparsers, repo): |
| 18 | p = subparsers.add_parser( |
| 19 | subcmd, help=help_msg, description=help_msg.capitalize()) |
| 20 | p.add_argument( |
| 21 | 'files', nargs='+', help='the file(s) to {0}'.format(subcmd), |
| 22 | action=helpers.PathProcessor, repo=repo, |
| 23 | skip_dir_test=repo and repo.current_branch.path_is_ignored, |
| 24 | skip_dir_cb=lambda path: pprint.warn( |
| 25 | 'Skipped files under directory {0} since they are all ' |
| 26 | 'ignored'.format(path))) |
| 27 | p.set_defaults(func=main(subcmd)) |
| 28 | return f |
| 29 | |
| 30 | |