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

Make usage documentation consistent and also demoose #371

Merged
merged 4 commits into from
Nov 12, 2024

Conversation

mattias-p
Copy link
Member

@mattias-p mattias-p commented May 28, 2024

Purpose

This PR kills two birds with one stone:

  • It fixes the discrepancy between perldoc zonemaster-cli and zonemaster-cli --help, and
  • it migrates away from Moose and Moosex::Getopt::GLD.

Context

Changes

Application:

  • Instead of using Moose and Moosex::Getopt::GLD we now Getopt::Long and Pod::Usage which are both Perl core modules.
  • I merged the best parts of the --help and perldoc usage texts. As I worked through them I realized there was a lot of room for further improvement. I tried to be conservative making improvements but in some cases I couldn't help myself.

Tests:

  • A unit test is added to make sure --help work.
  • A unit test is added to make sure all POD is syntactically correct.

Documentation:

  • The --help text is longer now and formatted differently. This because we're using a different method of generating it and the details are taken from POD instead of Moose attributes.

Reviewing this PR

  • Inspect the help text and man page of both this branch and the develop branch looking details that have gone missing.

Testing this PR

  • Unit tests should pass.
  • Perform a limited amount of exploratory testing for edge cases like missing required arguments, unknown options, invalid arguments, or conflicting flags.

@mattias-p mattias-p added the V-Patch Versioning: The change gives an update of patch in version. label May 28, 2024
@mattias-p mattias-p added this to the v2024.1 milestone May 28, 2024
@matsduf
Copy link
Contributor

matsduf commented Jun 25, 2024

I guess .travis.yml should also be updated to match the update. The installation instruction also needs an update.

@mattias-p mattias-p marked this pull request as draft June 25, 2024 17:34
@mattias-p mattias-p force-pushed the 68-usage branch 4 times, most recently from a813fd4 to e56eec4 Compare July 1, 2024 09:33
@mattias-p
Copy link
Member Author

I've split out #381 from this PR and rebased this one on top of that one.

@mattias-p mattias-p marked this pull request as ready for review November 5, 2024 16:01
lib/Zonemaster/CLI.pm Outdated Show resolved Hide resolved
@matsduf
Copy link
Contributor

matsduf commented Nov 8, 2024

The man page starts with

zonemaster-cli --test=delegation/delegation01 --level=debug zonemaster.net

The easier and preferred format is

zonemaster-cli --test=delegation01 --level=debug zonemaster.net

@matsduf
Copy link
Contributor

matsduf commented Nov 8, 2024

zonemaster-cli -h gives brief information now, and that is fine, but I do not get any information on how to get full information. zonemaster-cli --help gives brief information. Is it possible to give it paged like a man page? perldoc Zonemaster::CLI gives no information. Maybe refer to man zonemaster-cli and zonemaster-cli --help?

@matsduf
Copy link
Contributor

matsduf commented Nov 8, 2024

I think zonemaster-cli with no argument should refer to some documentation like "--help".

@matsduf
Copy link
Contributor

matsduf commented Nov 8, 2024

zonemaster-cli --help gives less information than man zonemaster-cli. Preferably it should be the same, or the former refer to the latter. The man page comes from the script. Couldn't --help extract the POD from the script and show that paged? I know that is possible to achieve.

@mattias-p
Copy link
Member Author

The man page starts with

zonemaster-cli --test=delegation/delegation01 --level=debug zonemaster.net

The easier and preferred format is

zonemaster-cli --test=delegation01 --level=debug zonemaster.net

As I state in the PR description I'm deferring all improvements to the text. If you look at #389 you'll see that I update the SYNOPSIS section so that it declares the command line syntax instead of just a selection of examples.

matsduf
matsduf previously approved these changes Nov 11, 2024
@matsduf
Copy link
Contributor

matsduf commented Nov 11, 2024

@mattias-p, please look at issue #388. I think you are behind that code.

@mattias-p
Copy link
Member Author

@matsduf As you discovered I had forgotten to implement the --help aliases. I've force-pushed implementation and automatic test for that. Please review again.

@mattias-p mattias-p requested a review from matsduf November 11, 2024 14:35
Copy link
Contributor

@marc-vanderwal marc-vanderwal left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@mattias-p mattias-p merged commit cef20e9 into zonemaster:develop Nov 12, 2024
1 check passed
@mattias-p mattias-p deleted the 68-usage branch November 25, 2024 15:01
@marc-vanderwal
Copy link
Contributor

Release testing for 2024.2: I have some remarks, but there are no show-stoppers.

What works:

  • zonemaster-cli --json-stream --no-json is rejected, as it should;
  • zonemaster-cli --json-translate without --json nor --json-stream gives a deprecation warning and a warning that --json-stream has no effect;
  • invalid values for --level and --stop-level are rejected;
  • erroneous values for --ns or --ds (that do not respect the prescribed syntax) are rejected.

But there are some things worth looking at:

  • A command line such as zonemaster-cli --help --list-tests --version --dump-profile doesn’t make much sense; maybe these four options should be all made mutually exclusive to each other?
  • In the synopsis, one line says zonemaster-cli [OPTIONS] --dump-profile. Except from --profile=FILE, are there any other options that could make sense when combined with --dump-profile? For example, zonemaster-cli --dump-profile --no-json still gives me JSON output because --no-json is not applicable to the output caused by --dump-profile.
  • The error messages displayed on erroneous values for --level and --stop-level are inconsistent:
$ zonemaster-cli --stop-level=INVALID
Failed to recognize stop level 'INVALID'.
$ zonemaster-cli --level=INVALID
--level must be one of CRITICAL, ERROR, WARNING, NOTICE, INFO, DEBUG, DEBUG2 or DEBUG3.

@marc-vanderwal marc-vanderwal added the S-ReleaseTested Status: The PR has been successfully tested in release testing label Dec 3, 2024
@matsduf
Copy link
Contributor

matsduf commented Dec 3, 2024

@marc-vanderwal wrote:

  • In the synopsis, one line says zonemaster-cli [OPTIONS] --dump-profile. Except from --profile=FILE, are there any other options that could make sense when combined with --dump-profile? For example, zonemaster-cli --dump-profile --no-json still gives me JSON output because --no-json is not applicable to the output caused by --dump-profile.

My comment:

I guess it would make sense to combine --profile FILE with --dump-profile.

@matsduf
Copy link
Contributor

matsduf commented Dec 3, 2024

@marc-vanderwal, will you create an issue or a PR of your findings?

@marc-vanderwal
Copy link
Contributor

I guess it would make sense to combine --profile FILE with --dump-profile.

Yes, I agree that it makes sense; you just end up dumping the profile from FILE.

@marc-vanderwal, will you create an issue or a PR of your findings?

I’ve created issue #403.

@matsduf
Copy link
Contributor

matsduf commented Dec 3, 2024

Yes, I agree that it makes sense; you just end up dumping the profile from FILE.

Not necessarily. File could contains just one property, e.g. no_network, and then you should get the resulting profile with --dump-profile.

I’ve created issue #403.

Great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-ReleaseTested Status: The PR has been successfully tested in release testing V-Patch Versioning: The change gives an update of patch in version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants