Skip to content

Fix cli flags order #149

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

Merged
merged 1 commit into from
May 17, 2023
Merged

Fix cli flags order #149

merged 1 commit into from
May 17, 2023

Conversation

mmkamron
Copy link
Contributor

@mmkamron mmkamron commented May 17, 2023

Fixes #148

After recent changes, there is a little confusion in the flags order. If a user has a flag -s for the subdomain feature, it doesn't work. However, it works when there is also a --debug option in the last parameter. This PR will temporarily fix that issue. I'd suggest using Go's flag package as more options may appear in the future.

@azimjohn azimjohn merged commit 8f60840 into azimjohn:master May 17, 2023
@azimjohn
Copy link
Owner

Thanks Kamron, indeed parsing flags are getting out of hand.

The problem is there're 3 types of args {"subcommand", "-key value", "--flag"}.

Standard flag package doesn't have definitions for all these types and may require passing protocol as "--protocol or -p" and it's not good.

Post a PR if you think it's possible to do it cleaner way.

@mmkamron mmkamron deleted the args branch May 18, 2023 11:41
@mmkamron
Copy link
Contributor Author

There is a NewFlagSet function in the flag package, maybe that's what we need to use in this case. Because current if-else trick worries me. Here is a basic overview. By the way, I admire you implementing many functions yourself thus minimizing the dependencies and libraries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants