Commits on Feb 7, 2013
  1. 0.1.11 released

    puzrin committed Feb 7, 2013
  2. updated history/docs

    puzrin committed Feb 7, 2013
  3. fromFile implementation

    hpaulj committed with ixti Jan 24, 2013
Commits on Feb 5, 2013
  1. history update

    puzrin committed Feb 5, 2013
Commits on Feb 4, 2013
  1. code cleanup, related to #40

    puzrin committed Feb 4, 2013
  2. Merge pull request #45 from hpaulj/user_type

    shkuropat committed Feb 4, 2013
    Bug in user defined argument type error message
Commits on Jan 29, 2013
  1. Bug: with a user defined argument type, an error displays

    hpaulj committed Jan 29, 2013
    the whole function code, rather than just its name.
    Modify the ArgumentParser._getValue() error message generator to test
    whether action.type is a string (registered type).  If not, it is a
    function.  Try to deduce its name (, or type.displayName (a
    user defined name).  If there is no name (an anonymous function), include
    the original error message in the displayed error.
    test/user_defined_type.js - mocha tests for action.type, including several
    user defined cases.  Some are taken from, some focus on
    the bug discussed here.
    In the Python, all functions have a .__name__, which it uses in the error
    message.  For lambda functions that name is just <lambda>
Commits on Jan 23, 2013
  1. Merge pull request #43 from applepicke/master

    shkuropat committed Jan 23, 2013
    Conflict Handler
Commits on Jan 22, 2013
  1. Updated README

    William Collins committed Jan 22, 2013
  2. Added conflictHandler feature.

    William Collins committed Jan 22, 2013
  3. Fixed removal bug. Array.remove should be Array.splice

    William Collins committed Jan 22, 2013
Commits on Jan 21, 2013
  1. Added conflictHandler test.

    William Collins committed Jan 21, 2013
  2. Merge pull request #42 from hpaulj/corrected_zip

    puzrin committed Jan 21, 2013
    Mismatch between py zip() and
  3. Mismatch between py zip() and

    hpaulj committed Jan 21, 2013
    In parse_known_args() consume_positionals()
    the, argCounts)
    behaves different from the python version when there aren't as many
    argCounts as positionals.  Python zip iterates over the shortest, the
    underscore version over the longest, adding undefines as needed.
    The if (argCounts.length>0) takes care of some cases, but parsing
    'X -f A Y', where arguments are -a, x, and y, is another case where
    this JS zip is wrong.  At the start, there are 2 possible positional
    actions [x, y], but only one [X] argument string.
    Adding an argCount === undefined test is the simplest fix.
    An alternative is to define a _zipShortest() as suggested in
    I added a test case to base.js
    I discovered this case when adapting 'TestArgumentsFromFile' from
Commits on Jan 8, 2013
  1. partial tests cleanup

    puzrin committed Jan 8, 2013
  2. updated test report format

    puzrin committed Jan 8, 2013
  3. Merge pull request #41 from hpaulj/exclusiveUsage

    puzrin committed Jan 8, 2013
    Exclusive usage
  4. clean up comments

    hpaulj committed Jan 8, 2013
  5. Corrections to formatter.js to format exclusive groups correctly

    hpaulj committed Jan 8, 2013
    testgroups.js - add exclusive group usage tests, based on
    argument_parser.js - change a action.default to action.defaultValue
Commits on Jan 4, 2013
  1. Merge pull request #38 from hpaulj/namespace

    puzrin committed Jan 4, 2013
    Change Namespace to handle null values as Python does for None
  2. Merge pull request #37 from hpaulj/positionalAppend

    puzrin committed Jan 4, 2013
    action/append should `push` new values, not `concat`
  3. Merge pull request #36 from hpaulj/helperrors

    puzrin committed Jan 4, 2013
    Correct 'help' when argumentDefault and prefixChars options are used
  4. Merge pull request #35 from hpaulj/optionalZEROorMORE

    puzrin committed Jan 4, 2013
    Optionals with '*' should accept a defaultValue
  5. Merge pull request #34 from hpaulj/appendConstDefault

    puzrin committed Jan 4, 2013
    Use of _.indexOf to search a Namespace is wrong
  6. Merge pull request #33 from hpaulj/testoptionlike

    puzrin committed Jan 4, 2013
    This argparse failed the TestOptionLike class
  7. TestPositionalsNargsOptional adapted from gives an e…

    hpaulj committed Jan 4, 2013
    'AssertionError: {} deepEqual {"foo":null}'
    A dozen other classes in the py test file give similar errors.
    The problem is that the JS Namespace class treads null differently than
    the python None.
    Python gives every 'dest' at least a None value.
    The JS Namespace tries to treat a null value as the same as undefined.
    However, because sometimes values are set with Namespace.set(), and other
    times with ordinary object assignment, sometimes a null value appears in
    a namespace.
    These tests do pass if a modified deepEqual is used, one that ignores
    differences between {bar: null} and {}
    Python has a special Namespace class because its base Object class does
    not directly accept attributes.  It also defines a nice display method.
    The resulting class is essentially the same as the Javascript object.
    To better match the Python:
    - change namespace.isset() to use _.has() instead of !! (!!null is false)
    - remove the null test in namespace.set()
    - the _.extend() alternative is not used.
    - namespace.get() is not used
  8. In TestPositionalsActionAppend

    hpaulj committed Jan 4, 2013
    with 2 positional args, one that takes 1, the other 2,
    parseArgs with 'a b c' produces spam: ['a','b','c'], but python expects
    spam: ['a', ['b','c']].
    This is because append.js uses 'concat', while python uses 'append'.
    Correction: change action/append.js set() to use push()
  9. argparse.js fails 2 help related tests in

    hpaulj committed Jan 4, 2013
    TestParserDefault42 sets a parser argumentDefault
    The error is that the namespace includes {help: 42, version: 42}
    Correction: add defaultValue: $$.SUPPRESS when defining --help and --version
    in ArgumentParser().
    TestOptionalsAlternatePrefixCharsAddedHelp sets prefixChars.
    If prefixChars does not include '-', setting ['-h','--help'] gives an error.
    Correction: set a defaultPrefix that is either '-' or the first prefixChar,
    and use this instead of '-h'
  10. JS argparse fails the test for

    hpaulj committed Jan 4, 2013
    Tests specifying an args for an Optional that accepts zero or more
    In this case ['-y'] with nargs='*' and defaultValue= 'spam', should be
    using that default.  (Positionals with '*' on the other hand don't)
    Correction: test for optionStrings.length in ArgumentParser._getValues()
    Action.isPositional() does the same thing.
  11. This argparse fails TestOptionalsActionAppendConstWi…

    hpaulj committed Jan 4, 2013
    …thDefault class.
    This test has two actions with the same 'dest'.  The Python test expects
    the defaultValue of the 1st action to apply, but the JS code uses the 2nd's
    defaultValue (or lack there of).
    The correction is to change how ArgumentParser.parseKnownArgs() checks the
    namespace for a value.  A namespace is object-like, so indexOf is wrong.
    Change this to _.has().  The indexOf version, besides applying to the wrong
    kind of object, always returns true (the key is never found).
    Namespace handling could be cleaned up.  Sometimes it is accessed with
    object methods, sometimes with its own set and isset.  Also its handling
    of null differs from the Python (more on this in another pull).
  12. This argparse failed the TestOptionLike class

    hpaulj committed Jan 4, 2013
    Args like '-x -2.5 a' are supposed to fail.
    The problem is that Python match() starts the match at the start of a string.
    Javascript match can match anywhere in the string.
    Correction in argument_parser.js, matchArguments() and matchArgumentsPartial()
    is to add '^' to the pattern.
    TestOptionLike.js tests the change in matchArguments().  I don't know of a test
    for the matchArgumentsPartial() change.
Commits on Dec 30, 2012
  1. 0.1.10 released

    puzrin committed Dec 30, 2012