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

Fix commandline handling #1208

Merged
merged 7 commits into from
Oct 24, 2023

Conversation

zappolowski
Copy link
Member

@zappolowski zappolowski commented Oct 11, 2023

The output of dunst -h differs from the one of dunst --help due to how the usage string is constructed. Furthermore, the options -print and --startup_notification are not listed at all (due to incorrect ordering of options).

This PR refactors cmdline_find_option to handle more than two alternatives (which fixes the first issue, when calls to cmdline_get_* are merged) and reorders command line parsing in a way, that all currently available options are listed.

NB: I've added -startup_notification as alternative to --startup_notification as it was the only option only available with to hyphens and thus breaking consistency.

Make it work for more than two possible values.
Now that `cmdline_find_option` can handle more than two cases repeated
calls to `cmdline_get_*` are not needed anymore.
Calls to `cmdline_get_*` also modify the usage string. When the entries
for help are not the last to set up all command line arguments set up
afterwards don't show up in the usage.
All other options have a variant with just a single hyphen - be
consistent.
@codecov-commenter
Copy link

codecov-commenter commented Oct 17, 2023

Codecov Report

Merging #1208 (d844e1d) into master (2cd719a) will decrease coverage by 0.01%.
Report is 3 commits behind head on master.
The diff coverage is 64.28%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

@@            Coverage Diff             @@
##           master    #1208      +/-   ##
==========================================
- Coverage   66.03%   66.02%   -0.01%     
==========================================
  Files          46       46              
  Lines        7595     7584      -11     
==========================================
- Hits         5015     5007       -8     
+ Misses       2580     2577       -3     
Flag Coverage Δ
unittests 66.02% <64.28%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
src/option_parser.c 80.28% <100.00%> (-0.44%) ⬇️
src/dunst.c 11.01% <0.00%> (+0.27%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@fwsmit
Copy link
Member

fwsmit commented Oct 17, 2023

That's a great find! It even simplifies the code :)

Could you add the new command line options to the dunst.1.pod man page?

@zappolowski
Copy link
Member Author

zappolowski commented Oct 17, 2023

Could you add the new command line options to the dunst.1.pod man page?

Just did ... and also fixed the spelling in the manpage for --startup-notification. Basically, I'd prefer to have it that way, but changing it would be an incompatible change.

While at it also fix the spelling of `--startup_notification` and
remove its argument as it is just a flag and doesn't take an argument.
@fwsmit
Copy link
Member

fwsmit commented Oct 24, 2023

Thanks for the improvements! This will be merged now

@fwsmit fwsmit merged commit ecbb370 into dunst-project:master Oct 24, 2023
18 checks passed
@zappolowski zappolowski deleted the fix-commandline-handling branch October 24, 2023 18:01
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.

3 participants