Skip to content

Update man page + change [FILE]:LINE:COL to FILE[:LINE:COL] in micro -help#3812

Merged
JoeKar merged 4 commits intomicro-editor:masterfrom
dmaluka:update-manpage
Aug 19, 2025
Merged

Update man page + change [FILE]:LINE:COL to FILE[:LINE:COL] in micro -help#3812
JoeKar merged 4 commits intomicro-editor:masterfrom
dmaluka:update-manpage

Conversation

@dmaluka
Copy link
Collaborator

@dmaluka dmaluka commented Jul 20, 2025

  • Update micro's man page (which hasn't been updated since 2020): align it with micro -help
  • Change confusing [FILE]:LINE:COL to FILE[:LINE:COL] in micro -help (and in the man page, obviously)

See #3811

@@ -95,9 +109,14 @@ file (see 'help options').
.PP
\-option value
Copy link
Contributor

@cutelisp cutelisp Jul 21, 2025

Choose a reason for hiding this comment

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

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>

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Could we change it so it's clear that's a variable? e.g. -

Looks like your comment got cut off?

How about -<option>?

Copy link
Member

Choose a reason for hiding this comment

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

Yep, -<option> is better.
To be changed for the command options too.

Copy link
Contributor

Choose a reason for hiding this comment

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

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]

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

They suggest using italic for argument, I like <> tho.
We should use it on -config-dir dir as 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 OPTION is, for example,-version or -plugin list FILE is 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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

(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:COL and +LINE:COL are mutually exclusive (and +LINE:COL takes priority), i.e. micro foo:10 bar +20 will not open foo at line 10 and bar at line 20, it will open foo:10 and bar, both at line 20. So, we will not be lying when we put micro [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)

Copy link
Collaborator Author

@dmaluka dmaluka Jul 22, 2025

Choose a reason for hiding this comment

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

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.

Copy link
Member

Choose a reason for hiding this comment

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

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Pushed updated version. I also ended up improving man page formatting as well, to use bold and italic as man man recommends.

@cutelisp
Copy link
Contributor

FILE[:LINE:COL] -> COL is not mandatory so it should be FILE[:LINE[:COL]]?

I think something like micro [OPTIONS] [FILE[:LINE[:COL]]]... (if the parsecursor option is enabled) could be added to synopsis.


.PP
[FILE]:LINE:COL
FILE[:LINE:COL] (if the `parsecursor` option is enabled)
Copy link
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Member

Choose a reason for hiding this comment

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

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.

Copy link
Member

@JoeKar JoeKar left a comment

Choose a reason for hiding this comment

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

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.

@@ -95,9 +109,14 @@ file (see 'help options').
.PP
\-option value
Copy link
Member

Choose a reason for hiding this comment

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

Yep, -<option> is better.
To be changed for the command options too.


.PP
[FILE]:LINE:COL
FILE[:LINE:COL] (if the `parsecursor` option is enabled)
Copy link
Member

Choose a reason for hiding this comment

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

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.

@niten94
Copy link
Contributor

niten94 commented Jul 23, 2025

The last modification date of the man page at line 1 may have to be updated, like noted in man-pages(7) (Linux man-pages project):
https://github.com/zyedidia/micro/blob/d7e43d497448cc30a20c38b8d76388877f6918e7/assets/packaging/micro.1#L1

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 man implementations, like mandoc (default in OpenBSD, Alpine Linux and Termux) and the one in FreeBSD. To test on Debian for example, mandoc's implementation is named mman and included in the mandoc package.

@dmaluka
Copy link
Collaborator Author

dmaluka commented Aug 16, 2025

The empty lines cause extra space to be displayed with other man implementations, like mandoc (default in OpenBSD, Alpine Linux and Termux) and the one in FreeBSD. To test on Debian for example, mandoc's implementation is named mman and included in the mandoc package.

Thanks for pointing this out. Done.

.B micro
.RI [ OPTION ]...\&
.RI [ FILE [: LINE [: COL ]]]...\&
\& (only if the `parsecursor` option is enabled)")
Copy link
Member

Choose a reason for hiding this comment

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

The ") or )" is a c&p issue from...

fmt.Println("FILE:LINE[:COL] (only if the `parsecursor` option is enabled)")

...right1? 😉

Footnotes

  1. Preview checked with https://roperzh.github.io/grapse/.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah right, thanks.

  1. 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.
@JoeKar JoeKar merged commit 421da67 into micro-editor:master Aug 19, 2025
6 checks passed
@niten94
Copy link
Contributor

niten94 commented Aug 22, 2025

Unlikely other people would look at the PR comments now, but small clarification on my statement:

To test on Debian for example, mandoc's implementation is named mman and included in the mandoc package.

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 man, but it should be possible to download the package, extract anywhere and run due to minimal dependencies.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants