Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support --help and --version CLI arguments #272

Merged
merged 4 commits into from
Jun 17, 2023

Conversation

Aloso
Copy link
Contributor

@Aloso Aloso commented Jun 12, 2023

This adds --help/-h and --version/-V CLI arguments, following the defaults used by clap. When any of these options is found, we exit with status code 0, which indicates success. When an unknown argument is supplied, we exit with the status code 1. Arguments after --help/--version are ignored, which I think is not a big deal.

If the plan is to support more CLI arguments, it would make sense to switch to a proper argument parser like clap or lexopt.

Closes #264

@GyulyVGC GyulyVGC added the enhancement New feature, request, or improvement label Jun 12, 2023
@GyulyVGC GyulyVGC added this to the v1.2.2 milestone Jun 12, 2023
@GyulyVGC
Copy link
Owner

I think it's better to not include clap just for these two arguments, as you did.
I originally thought to also implement #243 through CLI arguments, but in the end I think I'll implement it as a feature directly inside the GUI for ease of the users.

Seems fine to me, I will test it as soon as I have time to do so.
Just a little notice is that we could also include -v in lowercase (I've seen it more often lowercase wrt uppercase).

@Aloso
Copy link
Contributor Author

Aloso commented Jun 12, 2023

@GyulyVGC sure, I'll add -v as well.

Regarding the geoip database, another option is to use an environment variable, e.g.

SNIFFNET_GEOIP_COUNTRY=/path/to/country.mmdb sniffnet

which can be added to a shell config file for convenience.

@GyulyVGC
Copy link
Owner

I'm already using confy to save configurations for the app (settings info and last successfully sniffed adapter) and I was thinking to adopt the same approach.

@GyulyVGC
Copy link
Owner

@all-contributors please add @Aloso for code.

@allcontributors
Copy link
Contributor

@GyulyVGC

I've put up a pull request to add @Aloso! 🎉

@GyulyVGC GyulyVGC merged commit 188a2ad into GyulyVGC:main Jun 17, 2023
3 checks passed
@Aloso Aloso deleted the cli-args branch June 17, 2023 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature, request, or improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sniffnet doesn't respect --help and --version flags
2 participants