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

[CI:DOCS] Maintain consistent order of short and long flag names in docs #8318

Merged

Conversation

Luap99
Copy link
Member

@Luap99 Luap99 commented Nov 12, 2020

Make the order of short and long flag names in the documentation
consistent. Also adjust the man page validaten script to only allow the
**--long**, **-s** syntax.

Signed-off-by: Paul Holzinger paul.holzinger@web.de

@Luap99
Copy link
Member Author

Luap99 commented Nov 12, 2020

@edsantiago PTAL and check the regex.

@edsantiago edsantiago self-assigned this Nov 12, 2020
@rhatdan
Copy link
Member

rhatdan commented Nov 12, 2020

LGTM

@edsantiago
Copy link
Member

Something is broken, because you missed one in podman-create.1.md (--hostname) and the script isn't complaining. I'm looking into it now.

@edsantiago
Copy link
Member

Friendly suggestion:

diff --git a/hack/xref-helpmsgs-manpages b/hack/xref-helpmsgs-manpages
index 557b22446..c5447c5d6 100755
--- a/hack/xref-helpmsgs-manpages
+++ b/hack/xref-helpmsgs-manpages
@@ -331,8 +331,15 @@ sub podman_man {
             @most_recent_flags = ();
             # As of PR #8292, all options are <h4> and anchored
             if ($line =~ s/^\#{4}\s+//) {
-                # Handle any variation of '**--foo**=*bar*, **-f**'
-                while ($line =~ s/^\*\*((--[a-z0-9-]+)|(-[a-zA-Z0-9]))\*\*((=\*[a-zA-Z0-9-]+\*)?,\s+)?//g) {
+                # If option has long and short form, long must come first.
+                # This is a while-loop because there may be multiple long
+                # option names, e.g. --net/--network
+                while ($line =~ s/^\*\*(--[a-z0-9-]+)\*\*(=\*[a-zA-Z0-9-]+\*)?(,\s+)?//g) {
+                    $man{$1} = 1;
+                    push @most_recent_flags, $1;
+                }
+                # Short form
+                if ($line =~ s/^\*\*(-[a-zA-Z0-9])\*\*(=\*[a-zA-Z0-9-]+\*)?//g) {
                     $man{$1} = 1;

                     # Keep track of them, in case we see 'Not implemented' below

It's ugly, but it's the best I can do on short notice. You will need to fix --hostname in podman-create.md. And while you're at it, could you look at --net,--network in podman-{build,create,run}.1.md, choose one form or the other, and make those consistent? I don't have a good way to add that consistency check to the xref script.

Make the order of short and long flag names in the documentation
consistent. Also adjust the man page validaten script to only allow
the `**--long**, **-s**` syntax.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
@@ -394,7 +394,7 @@ The format of `LIMIT` is `<number>[<unit>]`. Unit can be `b` (bytes),
`k` (kilobytes), `m` (megabytes), or `g` (gigabytes). If you don't specify a
unit, `b` is used. Set LIMIT to `-1` to enable unlimited swap.

#### **--net**, **--network**=*string*
#### **--network**=*mode*
Copy link
Member Author

Choose a reason for hiding this comment

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

podman build doesn't support the --net alias I opend #8322

Copy link
Member

Choose a reason for hiding this comment

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

That is a bug, but I am fine with fixing the man pages for now.

@Luap99
Copy link
Member Author

Luap99 commented Nov 12, 2020

Thanks @edsantiago. It should be working now.

@edsantiago
Copy link
Member

LGTM but I'd like an extra set of eyes on the newly-changed portions of podman*-create.1.md

@rhatdan
Copy link
Member

rhatdan commented Nov 12, 2020

/lgtm
/approve

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 12, 2020
@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Luap99, rhatdan

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 12, 2020
@openshift-merge-robot openshift-merge-robot merged commit 2e474df into containers:master Nov 12, 2020
@Luap99 Luap99 deleted the doc-consistent-flag-order branch November 19, 2020 20:33
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants