Exodus-Privacy / exodus-standalone

εxodus CLI client for local analysis
GNU Affero General Public License v3.0
77 stars 13 forks source link

no exit code as counter #44

Closed DMyachin closed 1 year ago

DMyachin commented 1 year ago

Added flag --no-exit-counter that allows get exit code 0 if no any errors appears.

DMyachin commented 1 year ago

https://github.com/Exodus-Privacy/exodus-standalone/issues/34

DMyachin commented 1 year ago

@pnu-s ?

pnu-s commented 1 year ago

Sorry for the delayed answer!

My proposal was not just to use the exit-code name rather than no-exit-code but to offer the user to specify its error code (0 to avoid failing totally, 1 to overwrite the current behavior which returns the number of trackers, or other)

That would improve the user experience in my opinion

In terms of code, it would mean:

DMyachin commented 1 year ago

See new commit

    if all([counter, forced_code is not None]):
        sys.exit(forced_code)
    sys.exit(counter)

0 is False in Python.

If counter is not zero (has trackers) AND code overwriting is set to any int value, the value will be used else counter.

pnu-s commented 1 year ago

LGTM, thanks for your quick changes!

You'll just need to remove that extra blank line to make the linter pass, and I'll be able to merge it :rocket: