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

Do not crash if the last CLI parameter was -c #92

Merged
merged 3 commits into from
Sep 25, 2024
Merged

Conversation

MAKMED1337
Copy link
Contributor

Maybe also add some warnings if more than one config file is provided ?

Copy link
Member

@vaxerski vaxerski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be an error (e.g. "No config file provided"

also needs a check if the next arg isn't a flag (e.g. argv[i+1].begin() != '-', also remember to check !.empty())

@MAKMED1337
Copy link
Contributor Author

The error "No config file provided" should be if more than 1 config file is provided ?
If the next arg is a flag, then it will fail with "Make sure you have a config." in the try catch. Should I add explicit check for it then ?

@vaxerski
Copy link
Member

The error "No config file provided" should be if more than 1 config file is provided ?

No, only when it's not provided, otherwise print something like "too many config files provided" I guess

If the next arg is a flag, then it will fail with "Make sure you have a config." in the try catch

Yeah, not ideal if you ask me, why try to canonicalize a flag

@MAKMED1337
Copy link
Contributor Author

But when a config file is not provided, it uses the default one. Why should it throw an error ?

@vaxerski
Copy link
Member

if you do hypridle -c --help it should throw an error "no file provided" because you used -c without a parameter

src/main.cpp Show resolved Hide resolved
@vaxerski vaxerski merged commit cc23f97 into hyprwm:main Sep 25, 2024
1 check passed
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