argparse: fix 'task' to be a string posititional argument, not list
ClosedPublic

Authored by kparal on Mar 3 2016, 3:07 PM.

Details

Summary

We've had a strange situation where we have 'task' as a single-item list
and then have to unpack it to 'taskfile', so we carry both variables in
our parsed args. Turns out if we just omit nargs=1 from argparse
method, it creates a string directly, instead of a single-item list.

As a result, we can simplify the rest of our code to use args.task
directly instead of args.taskfile.

Kudos to @adamwill for pointing this out (in a different script, but still).

Test Plan

test suite works

Diff Detail

Repository
rLTRN libtaskotron
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
kparal retitled this revision from to argparse: fix 'task' to be a string posititional argument, not list.Mar 3 2016, 3:07 PM
kparal updated this object.
kparal edited the test plan for this revision. (Show Details)
kparal added a reviewer: libtaskotron.
kparal added a subscriber: adamwill.
mkrizek accepted this revision.Mar 3 2016, 3:36 PM
mkrizek added a reviewer: mkrizek.
mkrizek added a subscriber: mkrizek.

LGTM

This revision is now accepted and ready to land.Mar 3 2016, 3:36 PM
tflink accepted this revision.Mar 3 2016, 3:56 PM
tflink added a reviewer: tflink.
This revision was automatically updated to reflect the committed changes.