fix the completion problem of `man` under OS X #960

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
2 participants
@wwwjfy
Contributor

wwwjfy commented Aug 18, 2013

The problem is apropos under OS X behaves differently from Linux.

  1. The format: for command apropos sudo, the output under Linux:
sudo (8)             - execute a command as another user

and the output under OS X:

sudo(8)                  - execute a command as another user

one-space difference.

  1. For some items sharing a same manpage, e.g. for apropos printf,

Linux:

printf (3)           - formatted output conversion
snprintf (3)         - formatted output conversion
sprintf (3)          - formatted output conversion
vprintf (3)          - formatted output conversion
vsnprintf (3)        - formatted output conversion
vsprintf (3)         - formatted output conversion

OS X:

printf(3), fprintf(3), sprintf(3), snprintf(3), asprintf(3), dprintf(3), vprintf(3), vfprintf(3), vsprintf(3), vsnprintf(3), vasprintf(3), vdprintf(3) - formatted output conversion

OS X puts them in one line.

So, we need special handling here, otherwise, completion with prefix
man 3 printf will give the result of "man 3 printf(3),"

fix the completion problem of `man' under OS X
The problem is `apropos' under OS X behaves differently from Linux.

1. The format: for command `apropos sudo', the output under Linux:
...
sudo (8)             - execute a command as another user
...
and the output under OS X:
...
sudo(8)                  - execute a command as another user
...

one-space difference.

2. For some items sharing a same manpage, e.g. for `apropos printf',
Linux:
...
printf (3)           - formatted output conversion
snprintf (3)         - formatted output conversion
sprintf (3)          - formatted output conversion
vprintf (3)          - formatted output conversion
vsnprintf (3)        - formatted output conversion
vsprintf (3)         - formatted output conversion
...
OS X:
...
printf(3), fprintf(3), sprintf(3), snprintf(3), asprintf(3), dprintf(3), vprintf(3), vfprintf(3), vsprintf(3), vsnprintf(3), vasprintf(3), vdprintf(3) - formatted output conversion
...

OS X puts them in one line.

So, we need special handling here, otherwise, completion with prefix
`man 3 printf' will give the result of "man 3 printf\(3\),"
@zanchey

This comment has been minimized.

Show comment
Hide comment
@zanchey

zanchey Aug 19, 2013

Member

The behaviour of apropos on FreeBSD mirrors that of Darwin (unsurprisingly), so detecting uname is probably the wrong thing to do here.

Member

zanchey commented Aug 19, 2013

The behaviour of apropos on FreeBSD mirrors that of Darwin (unsurprisingly), so detecting uname is probably the wrong thing to do here.

@wwwjfy

This comment has been minimized.

Show comment
Hide comment
@wwwjfy

wwwjfy Aug 19, 2013

Contributor

@zanchey Oh, I was not aware of that. I don't have FreeBSD, so I don't know how to tell the differences.
What about

  1. use uname for Linux and others. I doubt it's a good option.
  2. include FreeBSD's uname value into Darwin. No idea about all the options, are they only FreeBSD-ish or LInux-ish?
Contributor

wwwjfy commented Aug 19, 2013

@zanchey Oh, I was not aware of that. I don't have FreeBSD, so I don't know how to tell the differences.
What about

  1. use uname for Linux and others. I doubt it's a good option.
  2. include FreeBSD's uname value into Darwin. No idea about all the options, are they only FreeBSD-ish or LInux-ish?
@zanchey

This comment has been minimized.

Show comment
Hide comment
@zanchey

zanchey Aug 19, 2013

Member

It gets worse! Solaris uses a totally different format altogether!

fwprintf        fwprintf (3c)   - print formatted wide-character output
printf          printf (1)      - write formatted output
printf          printf (3c)     - print formatted output
Member

zanchey commented Aug 19, 2013

It gets worse! Solaris uses a totally different format altogether!

fwprintf        fwprintf (3c)   - print formatted wide-character output
printf          printf (1)      - write formatted output
printf          printf (3c)     - print formatted output
@wwwjfy

This comment has been minimized.

Show comment
Hide comment
@wwwjfy

wwwjfy Aug 19, 2013

Contributor

@zanchey So we need another case? I think it'll be difficult to get an all-in-one command

Contributor

wwwjfy commented Aug 19, 2013

@zanchey So we need another case? I think it'll be difficult to get an all-in-one command

@zanchey

This comment has been minimized.

Show comment
Hide comment
@zanchey

zanchey Nov 22, 2013

Member

I have a solution using awk, but I'm honestly not sure if we care about Solaris any more. Current fish head doesn't build on Solaris, /usr/bin/awk is different to all other OSes that we support...

Member

zanchey commented Nov 22, 2013

I have a solution using awk, but I'm honestly not sure if we care about Solaris any more. Current fish head doesn't build on Solaris, /usr/bin/awk is different to all other OSes that we support...

@wwwjfy

This comment has been minimized.

Show comment
Hide comment
@wwwjfy

wwwjfy Nov 23, 2013

Contributor

In my opinion, it's not a problem to improve step by step. If anyone uses Solaris is uncomfortable with it, he can issue a pull request.

Contributor

wwwjfy commented Nov 23, 2013

In my opinion, it's not a problem to improve step by step. If anyone uses Solaris is uncomfortable with it, he can issue a pull request.

@zanchey zanchey closed this in 0c4dab5 Nov 27, 2013

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