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

Improve -vv and --help #1501

Merged
merged 4 commits into from
Dec 11, 2022
Merged

Improve -vv and --help #1501

merged 4 commits into from
Dec 11, 2022

Conversation

DL6ER
Copy link
Member

@DL6ER DL6ER commented Dec 9, 2022

What does this implement/fix?

This PR adds colors (if supported by the terminal) to verbose version output and completely revamps the help function.
When the "consumer" is not a terminal (e.g. a pipe), no escape sequences will be added.


pihole-FTL -vv BEFORE

vv-old

pihole-FTL -vv NOW

vv-new


pihole-FTL -h BEFORE

help-old

pihole-FTL -h NOW

help-new


Related issue or feature (if applicable): N/A

Pull request in docs with documentation (if applicable): N/A


By submitting this pull request, I confirm the following:

  1. I have read and understood the contributors guide, as well as this entire template. I understand which branch to base my commits and Pull Requests against.
  2. I have commented my proposed changes within the code.
  3. I am willing to help maintain this change if there are issues with it later.
  4. It is compatible with the EUPL 1.2 license
  5. I have squashed any insignificant commits. (git rebase)

Checklist:

  • The code change is tested and works locally.
  • I based my code and PRs against the repositories developmental branch.
  • I signed off all commits. Pi-hole enforces the DCO for all contributions
  • I signed all my commits. Pi-hole requires signatures to verify authorship
  • I have read the above and my PR is ready for review.

@DL6ER DL6ER requested a review from a team December 9, 2022 10:35
src/args.c Show resolved Hide resolved
Copy link
Member

@yubiuser yubiuser left a comment

Choose a reason for hiding this comment

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

--hash, d, handling of --(dnsmasq options), -q are missing from the help section.

(Some more as well, but I think the above should be part of the help text)

Copy link
Member

@rdwebdesign rdwebdesign left a comment

Choose a reason for hiding this comment

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

This is one thing I don't like in codespell.

You had to change a perfectly correct line of code (and removed some text: "the optional") just to please the checker.

Signed-off-by: DL6ER <[email protected]>
@DL6ER
Copy link
Member Author

DL6ER commented Dec 10, 2022

Thanks for your comments. -q makes only sense in combination with regex-test which is why I mention it only there.

I added the missing bits with the exception of the -- pass-through. It seems a dangerous idea and I don't think we have ever advertised to be able to do it. Really, all configuration should be done using config files, instead. It was added in v5.0 when we added the drop-in binary support but this -- was probably just a bad idea.

I'll leave the code here in case you still think we need it:

			printf("\t%s-- args...%s          Collect arguments behind %s--%s for\n", green, normal, green, normal);
			printf("\t                    the embedded dnsmasq server\n");

I also don't think we should always include all variants of an option, e.g, --test as alternative to dnsmasq-test as this may cause further confusion with the option option test. We can still leave it in there for any scripts that may be using it.

Furthermore, I replaced -- --help dhcp and -- --help dhcp6 by ``--list-dhcpand--list-dhcp6`, respectively. I checked Discourse, our docs and also asked Google whether the old syntax is mentioned anywhere and found no results. This isn't something you'd be using in a script so the change should be without any adverse consequences.


Updated screenshot:

Screenshot from 2022-12-10 13-57-31

@DL6ER DL6ER merged commit ffea21e into development Dec 11, 2022
@DL6ER DL6ER deleted the new/colorful_cli branch December 11, 2022 10:33
@pralor-bot
Copy link

This pull request has been mentioned on Pi-hole Userspace. There might be relevant details there:

https://discourse.pi-hole.net/t/pi-hole-ftl-v5-20-and-web-v5-18-released/59959/1

@yubiuser yubiuser mentioned this pull request Jan 8, 2023
1 task
@pralor-bot
Copy link

This pull request has been mentioned on Pi-hole Userspace. There might be relevant details there:

https://discourse.pi-hole.net/t/v6-development-branch-man-page-gone/72644/8

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

Successfully merging this pull request may close these issues.

4 participants