nhoffman / argparse-bash

Use python's argparse module in shell scripts
MIT License
166 stars 27 forks source link

Using an 'int' argument of 0 is broken #3

Closed alapidas closed 9 years ago

alapidas commented 9 years ago

Due to 0 being falsy, this code fails to parse an int argument of 0

https://github.com/nhoffman/argparse-bash/blob/master/argparse.bash#L39

for arg in [a for a in dir(args) if not a.startswith('_')]:
    print('{}="{}";'.format(arg.upper(), getattr(args, arg) or ''))
nhoffman commented 9 years ago

Fixed by fea2a01 - thanks @alapidas!