zimfw / completion

Enables and configures smart and extensive tab completion.
MIT License
37 stars 10 forks source link

Add ypcat as dependency #19

Closed spreiter closed 8 months ago

spreiter commented 8 months ago

Prerequisites

Bug description

On EL8 ypcat is not installed by default. Can this be added to some requirements in the readme or checked during installation?

Related to #6

Steps to reproduce

Using completion on hostnames failed with a message that ypcat is not installed.

Current behavior

failure message and one has to abort the completion process entirely.

Expected behavior

Warn during installation that ypcat is required

zimfw info

zimfw version:        1.13.0 (built at 2024-02-17 02:05:06 UTC, previous commit is 9de3984)
LANG:                 en_US.UTF-8
OSTYPE:               linux-gnu
TERM:                 xterm-256color
TERM_PROGRAM:         
TERM_PROGRAM_VERSION: 
ZIM_HOME:             /home/sreiter/.zim
ZSH_VERSION:          5.5.1

Additional context

No response

ericbn commented 8 months ago

Hi @spreiter. ypcat is not installed in macOS either, and maybe in other OSes too. The command is ypcat hosts 2>/dev/null so it should fail silently if the ypcat command is not found. I wonder why are you seeing an error and why does the completion fail.

spreiter commented 8 months ago

Maybe this is a system related issue. In the example below I pressed TAB after ssh wo

> ssh woInstall package 'yp-tools' to provide command 'ypcat'? [N/y]

OK, seems to be related to the PackageKitCommandNotFound package.

But after the question is raised, even pressing n does not return to my previous input and I have to abort with Ctrl-C.

ericbn commented 8 months ago

Thanks for detailing the error you're getting. I think the solution here is to test if ypcat is an available command before calling it. I'll update the script.

spreiter commented 8 months ago

Elegant solution. Thanks! ❤️