Skip to content

Commit

Permalink
Add a force argument to the parser.
Browse files Browse the repository at this point in the history
This will eventually trigger the composer to force
writing even when no modification may be required.
  • Loading branch information
mblayman committed Sep 7, 2015
1 parent 69aa624 commit 91e5e14
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions handroll/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ def parse_args(argv):
'-v', '--verbose', action='store_true', help=_('use verbose messages'))
parser.add_argument(
'-t', '--timing', action='store_true', help=_('time the execution'))
parser.add_argument(
'-f', '--force', action='store_true',
help=_('force composers to write output'))
parser.add_argument(
'-d', '--debug', action='store_true',
help=_('show debug level messages'))
Expand Down
14 changes: 14 additions & 0 deletions handroll/tests/test_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,20 @@ def test_outdir_argument(self):
args = command.parse_args(self.arguments)
self.assertEqual(outdir, args.outdir)

def test_force_argument(self):
args = command.parse_args(self.arguments)
self.assertFalse(args.force)

argv = list(self.arguments)
argv.append('-f')
args = command.parse_args(argv)
self.assertTrue(args.force)

argv = list(self.arguments)
argv.append('--force')
args = command.parse_args(argv)
self.assertTrue(args.force)


class TestMain(TestCase):

Expand Down

0 comments on commit 91e5e14

Please sign in to comment.