Skip to content

incomplete man page completions #8305

Closed

Description

@pascal-huber

TL;DR: No completions for man pages with aliases are shown using BSD's mandoc.

asciicast

Environment

❯ echo $version
3.3.1
~
❯ uname -a
Linux poweriglu 5.13.19_1 #1 SMP Sat Sep 18 18:18:26 UTC 2021 x86_64 GNU/Linux
~
❯ echo $TERM
rxvt-unicode-256color
~
❯ cat /etc/os-release | grep "^NAME"
NAME="void"

mdocml (mandoc) version: 1.14.5

I also tried a FreeBSD virtual machine and found the same behaviour.

Problem description and reproduction

Man pages with aliases are not completed, for example man apr<tab> only completes to man aprofutil but does not offer a completion option for apropos although the man page exists and is indexed. More precisely, no pages with aliases are shown.

Reason

__fish_complete_man.fish works on the output of apropos which in the case of BSD's mandoc has the following form.

❯ apropos true
true(1) - do nothing, successfully
❯ apropos apropos
apropos, whatis, mandoc-apropos, mandoc-whatis(1) - search manual page databases
❯ apropos infocmp
infocmp(1, 1M, 1m) - compare or print out terminfo descriptions

The implementation doesn't work for the second example and it doesn't show the section for infocmp.

Further remarks

Looking at the code for the four different apropos implementations, it is not quite clear to me what the intended behaviour is. The BSD version tries to iterate over the aliases while the others seem to just print the first name. Giving completions for all aliases is far more user-friendly IMO.

Fix

I've written a possible fix for BSD's apropos, which, for the following (imaginary) apropos output creates the three lines shown below.

❯ apropos abc
xyz, abc, abcdef(1, 2X) - hello world
xyz, 1, 2X: hello world
abc, 1, 2X: hello world
abcdef, 1, 2X: hello world

This would yield the two compltions for man ab<tab>:

abc          (1, 2X: hello world)
abcdef       (1, 2X: hello world)

Activity

  1. faho commented on Sep 21, 2021

    @faho
    Member

    For the future reference: We don't require issues to be filed. A PR is enough documentation, unless there's a design decision to be made.

    All this does is separate the discussion into two parts needlessly.

  2. added
    bug
    on Sep 21, 2021
  3. added this to the fish 3.4.0 milestone on Sep 21, 2021
  4. added a commit that references this issue on Dec 12, 2021
  5. locked as resolved and limited conversation to collaborators on Sep 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions