Skip to content

Fix cli flags order#149

Merged
azimjohn merged 1 commit intoazimjohn:masterfrom
mmkamron:args
May 17, 2023
Merged

Fix cli flags order#149
azimjohn merged 1 commit intoazimjohn:masterfrom
mmkamron:args

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