Update man page + change [FILE]:LINE:COL to FILE[:LINE:COL] in micro -help#3812
Update man page + change [FILE]:LINE:COL to FILE[:LINE:COL] in micro -help#3812JoeKar merged 4 commits intomicro-editor:masterfrom
[FILE]:LINE:COL to FILE[:LINE:COL] in micro -help#3812Conversation
assets/packaging/micro.1
Outdated
| @@ -95,9 +109,14 @@ file (see 'help options'). | |||
| .PP | |||
| \-option value | |||
There was a problem hiding this comment.
I think -option is tricky. (I've been tricked by this in the past)
Could we change it so it's clear that's a variable? e.g. -<option>
There was a problem hiding this comment.
Could we change it so it's clear that's a variable? e.g. -
Looks like your comment got cut off?
How about -<option>?
There was a problem hiding this comment.
Yep, -<option> is better.
To be changed for the command options too.
There was a problem hiding this comment.
Actually man man says this
bold text type exactly as shown.
italic text replace with appropriate argument.
[-abc] any or all arguments within [ ] are optional.
-a|-b options delimited by | cannot be used together.
argument ... argument is repeatable.
[expression] ... entire expression within [ ] is repeatable.
They suggest using italic for argument, I like <> tho.
We should use it on -config-dir dir as well (-config-dir <dir> )?
bold text type exactly as shown.
Every man page I looked into respects this notation with flags, so we probably use it as well.
micro [OPTIONS] [FILE]...
This isn't always true, since if OPTION is, for example,-version or -plugin list FILE is not a valid argument anymore since micro won't open.
Multiple options can be passed so [OPTIONS]...?
Suggestion:
Split current options into options/commands (on options section).
Synopsis
micro [OPTIONS]... [FILE]...
micro [OPTIONS]... FILE[:LINE[:COL]]...
micro [COMMAND]
There was a problem hiding this comment.
They suggest using italic for argument, I like
<>tho.
We should use it on-config-dir diras well (-config-dir <dir>)?[...]
Every man page I looked into respects this notation with flags, so we probably use it as well.
We could. OTOH man vim, for instance, does it plain, without italic or bold or <>. No one seems to be dying because of that.
Multiple options can be passed so
[OPTIONS]...?
OPTIONS is already plural. Also man vim, for instance, has vim [options] [file ..]
But I'm ok with changing it to [OPTION]... (singular).
Also let's not forget about the +LINE:COL syntax (which, unlike :LINE:COL, works always, not only if parsecursor is enabled; OTOH, unlike :LINE:COL, it works for a single file on the command line only).
So, this?
micro [OPTION]... [FILE]...
micro [OPTION]... [FILE[:LINE[:COL]]]... (only if the `parsecursor` option is enabled)
micro [OPTION]... FILE +LINE[:COL]
This isn't always true, since if
OPTIONis, for example,-versionor-plugin listFILEis not a valid argument anymore since micro won't open.[...]
micro [COMMAND]
I see more problems than advantages with that. That would mean that we, for purely formalistic reasons, are introducing a concept of "command" as a special case of an "option". Whereas we already, for instance, use the term "command" to refer to plugin commands selected by the -plugin flag: install, remove etc.
We could instead just add "...and exit" to the descriptions of those options: -clean: "Clean the configuration directory and exit", -options: "Show all option help and exit" and so on.
There was a problem hiding this comment.
I'd like to prevent us all from this duplicated maintenance effort and risk of async documentation.
That is not exactly a huge effort, is it?
And if we forget to update the man page once again, we will recall again after another 5 years.
There was a problem hiding this comment.
(OTOH, if there are multiple
+LINE[:COL]]params, only the last one is applied (to all files), all the previous ones are ignored.)
It's reasonable ig, since +LINE[:COL]] it's meant to be used once.
Also, BTW,
LINE:COLand+LINE:COLare mutually exclusive (and+LINE:COLtakes priority), i.e.micro foo:10 bar +20will not openfooat line 10 andbarat line 20, it will openfoo:10andbar, both at line 20. So, we will not be lying when we putmicro [OPTION]... [FILE]... +LINE[:COL]at a separate line in the man page.
If they are mutually exclusive why not as I suggested?
micro [OPTION]... [FILE]... [+LINE[:COL]]
micro [OPTION]... [FILE[:LINE[:COL]]]... (only if the `parsecursor` option is enabled)
There was a problem hiding this comment.
If they are mutually exclusive why not as I suggested?
micro [OPTION]... [FILE]... [+LINE[:COL]] micro [OPTION]... [FILE[:LINE[:COL]]]... (only if the `parsecursor` option is enabled)
Well, yeah, makes sense. (Haven't noticed your suggestion first time.)
I hope this high density of brackets won't scare anyone off.
There was a problem hiding this comment.
And if we forget to update the man page once again, we will recall again after another 5 years.
Please add at least a comment somewhere around...
https://github.com/zyedidia/micro/blob/d7e43d497448cc30a20c38b8d76388877f6918e7/cmd/micro/micro.go#L49
...to // keep in sync with the man page located in assets/packaging/micro.1.
There was a problem hiding this comment.
Pushed updated version. I also ended up improving man page formatting as well, to use bold and italic as man man recommends.
|
I think something like |
assets/packaging/micro.1
Outdated
|
|
||
| .PP | ||
| [FILE]:LINE:COL | ||
| FILE[:LINE:COL] (if the `parsecursor` option is enabled) |
There was a problem hiding this comment.
I took a look at gedit man page I think it would be better to do something similar.
My suggestion is to swap this by something like this (under -version):
FILE
Specifies the file to open when micro starts.
If no files are passed, micro starts with an empty buffer.
FILE[:LINE[:COL]]
If the `parsecursor` option is enabled, a line number can be specified to position the cursor when opening a file.
Optionally, a column number can also be provided to set the cursor position within that line.
There was a problem hiding this comment.
At least in the command options fmt.Println("Usage: micro [OPTIONS] [FILE]...") already stands for its own. At least there we don't need the dedicated [FILE] description.
I agree regarding FILE[:LINE[:COL]], since [:COL] is optional.
JoeKar
left a comment
There was a problem hiding this comment.
However, the fact that we have to maintain it in two different places is disturbing.
This makes it easier to forget to update one of them.
assets/packaging/micro.1
Outdated
| @@ -95,9 +109,14 @@ file (see 'help options'). | |||
| .PP | |||
| \-option value | |||
There was a problem hiding this comment.
Yep, -<option> is better.
To be changed for the command options too.
assets/packaging/micro.1
Outdated
|
|
||
| .PP | ||
| [FILE]:LINE:COL | ||
| FILE[:LINE:COL] (if the `parsecursor` option is enabled) |
There was a problem hiding this comment.
At least in the command options fmt.Println("Usage: micro [OPTIONS] [FILE]...") already stands for its own. At least there we don't need the dedicated [FILE] description.
I agree regarding FILE[:LINE[:COL]], since [:COL] is optional.
|
The last modification date of the man page at line 1 may have to be updated, like noted in I suggest to also remove blank lines in this pull request, since they seem to be unnecessary and only hidden with man-db which is used in most Linux distributions. The empty lines cause extra space to be displayed with other |
f5725a6 to
8d0f6f3
Compare
Thanks for pointing this out. Done. |
8d0f6f3 to
119790f
Compare
assets/packaging/micro.1
Outdated
| .B micro | ||
| .RI [ OPTION ]...\& | ||
| .RI [ FILE [: LINE [: COL ]]]...\& | ||
| \& (only if the `parsecursor` option is enabled)") |
There was a problem hiding this comment.
The ") or )" is a c&p issue from...
fmt.Println("FILE:LINE[:COL] (only if the `parsecursor` option is enabled)")...right1? 😉
Footnotes
-
Preview checked with https://roperzh.github.io/grapse/. ↩
There was a problem hiding this comment.
Yeah right, thanks.
- Preview checked with https://roperzh.github.io/grapse/.
FWIW it can be checked simply with man ./assets/packaging/micro.1
Align it with `micro -help`.
Display option names in bold text and argument placeholders in italic text, as recommended in `man man`.
As pointed out by @niten94, empty lines in the man page are not just unnecessary but also cause extra empty lines to be displayed with alternative `man` implementations, e.g. `mandoc`. To test on Debian, for example, mandoc's implementation is named `mman` and included in the `mandoc` package.
119790f to
c7d65d1
Compare
|
Unlikely other people would look at the PR comments now, but small clarification on my statement:
Mandoc can be ran in the same way as the man-db implementation to view a file. The mandoc package provided by other distributions conflict with man-db due to the same executable name of |
micro -help[FILE]:LINE:COLtoFILE[:LINE:COL]inmicro -help(and in the man page, obviously)See #3811