-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Man pages: tighter documenting of --format fields #21060
Conversation
b12f8fa
to
85f54f4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No hurry. I think this PR should sit and simmer until Paul has a chance to look at it. I just wanted to get it submitted because it's been a lot of my work over the past two weeks.
@@ -115,8 +115,10 @@ Format the output to JSON Lines or using the given Go template. | |||
| .Name | Container name (string) | | |||
| .Network | Name of network being used (string) | | |||
| .PodID | ID of pod associated with container, if any | | |||
| .Recycle PATH BOOL | [unimplemented] | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the new convention for documenting cobra functions. It merits careful scrutiny.
@@ -86,7 +86,8 @@ Valid placeholders for the Go template are listed below: | |||
| .Created | Creation time of pod | | |||
| .ID | Container ID | | |||
| .InfraID | Pod infra container ID | | |||
| .Labels | All the labels assigned to the pod | | |||
| .Label STRING | Specified label of the pod | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This huge PR, just for this....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we use <STRING>
or *string*
as syntax to better display that this is a mandatory argument?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's what I was going for with CAPS, but yours seems more consistent with our conventions.
Angle brackets, probably not, because they'd need to be escaped and that's too hard to enforce. Asterisks (italics) show up only in generated HTML, not in man pages (at least not on my laptop, AFAICT). See attached image; the italics don't show up well in CAPS, but they are prominent in lowercase.
If we can find a way to highlight *italics*
in the terminal man page view, I'd like to go with that approach. Otherwise, slight preference for CAPS
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am fine with CAPS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Followup: go-md2man
seems to handle italics-in-tables just fine, and produces what looks like sane *roff:
\&.Recycle \fIpath\fP \fIbool\fP [unimplemented]
...but man -l
is not respecting that.
Italics and bold are possible in tables -- see systemd.unit(5)
-- I just can't figure out what special magic is needed, or what the difference is between the table in systemd.unit.5
and the podman one. Giving up for now, waiting for inspiration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I give up. Man page highlights are inconsistent. The following groff:
.SH DESCRIPTION
.PP
Monitor and print events that occur in Podman. Each event includes a timestamp,
a type, a status, name (if applicable), and image (if applicable). The default logging
mechanism is \fIjournald\fP\&. This can be changed in containers.conf by changing the \fB\fCevents_logger\fR
value to \fB\fCfile\fR\&. Only \fB\fCfile\fR and \fB\fCjournald\fR are accepted. A \fB\fCnone\fR logger is also
available, but this logging mechanism completely disables events; nothing is reported by
\fB\fCpodman events\fR\&.
.PP
By default, streaming mode is used, printing new events as they occur. Previous events can be listed via \fB\fC--since\fR and \fB\fC--until\fR\&.
...produces the following display:
Note the proliferation of \f<whatever>
in the source. The only ones that actually show up in the terminal view are the ones with --
(the options). This is too obscure for me.
85f54f4
to
87141db
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good, although I have not looked at the perl code just the docs and test cases.
@@ -86,7 +86,8 @@ Valid placeholders for the Go template are listed below: | |||
| .Created | Creation time of pod | | |||
| .ID | Container ID | | |||
| .InfraID | Pod infra container ID | | |||
| .Labels | All the labels assigned to the pod | | |||
| .Label STRING | Specified label of the pod | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we use <STRING>
or *string*
as syntax to better display that this is a mandatory argument?
87141db
to
1578c9f
Compare
The man page confusion was 100% PEBKAC: I This is too much to ask for full review. My recommendation is to focus on the man-page changes, see if those look reasonable, and then skip to the new error-message checks and see if those are acceptable. As in, if you submitted a PR and this script blew up at you with one of those messages, would you know what to do or at least have a starting point? |
| .Name | Container name (string) | | ||
| .Network | Name of network being used (string) | | ||
| .PodID | ID of pod associated with container, if any | | ||
| .Recycle *path* *bool* | [unimplemented] | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this look like a bogus function that is never called or used.
Mind removing it with
diff --git a/libpod/events/events.go b/libpod/events/events.go
index bcda07e06..18f531469 100644
--- a/libpod/events/events.go
+++ b/libpod/events/events.go
@@ -54,13 +54,6 @@ func NewEvent(status Status) Event {
}
}
-// Recycle checks if the event log has reach a limit and if so
-// renames the current log and starts a new one. The remove bool
-// indicates the old log file should be deleted.
-func (e *Event) Recycle(path string, remove bool) error {
- return errors.New("not implemented")
-}
-
// ToJSONString returns the event as a json'ified string
func (e *Event) ToJSONString() (string, error) {
b, err := json.Marshal(e)
Otherwise I can submit a PR to remove it because there should really be no point in documenting broken stuff that will never help any user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Brent has enough on his hands this week. I'm gonna say if there's ever a need for .Recycle()
it can be added (and actually implemented) then. @containers/podman-maintainers PTAL, I consider this ready to merge.
b89e4b4
to
d8d5a8c
Compare
Initial impetus was containers#20958 (ps --format .Label abc). This is a complicated solution to a simple-seeming problem. The problem: .Label is a cobra *function*, something I did not know about nor handle. Solution: recognize cobra functions. Switch to __complete, not __completeNoDesc, so we can see the number of arguments required. Invent new man-page format for documenting functions. And, finally, start enforcing how functions (and cobra structs) are documented. This discovered a never-used completion function, .Recycle(), in podman-events. Remove it. [NO NEW TESTS NEEDED] - the .go change is an excision of dead code. Signed-off-by: Ed Santiago <[email protected]>
d8d5a8c
to
dbe0e67
Compare
LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: edsantiago, giuseppe 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 |
eb77462
into
containers:main
Followup to: - containers#21060, where I added new struct checks (but did not make them fatal) - containers#21534, which added per-interface stats and a .Network field, but its documentation was slightly off Signed-off-by: Ed Santiago <[email protected]>
Initial impetus was #20958 (ps --format .Label abc). This is
a complicated solution to a simple-seeming problem.
The problem: .Label is a cobra function, something I did not
know about nor handle.
Solution: recognize cobra functions. Switch to __complete,
not __completeNoDesc, so we can see the number of arguments
required. Invent new man-page format for documenting functions.
And, finally, start enforcing how functions (and cobra structs)
are documented.
This discovered a never-used completion function, .Recycle(),
in podman-events. Remove it.
Signed-off-by: Ed Santiago [email protected]