webrecorder/py-wacz

Command Line Return Code should be 0

ikreymer opened this issue · 0 comments

We now have the 0 return code in:

if __name__ == "__main__":
    sys.exit(0 if main() else 1)

which works only if calling main.py directly.
For the installed wacz script to return 0, we really should have the main() function itself return 0 if success, non-zero if error.
Currently, it returns true if success/valid, false otherwise.
Or, can wrap it in another function that is used by the setup.py wacz script, that may be simpler, but also less consistent.
In the end, it probably makes sense to be able to have:

if main['validate', '-f', 'file.wacz'] == 0:
   print('success!')

since that's close to what it would be in a shell script also..