Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: drop dependency for Perl in key-bindings.bash #3077

Closed
5 of 10 tasks
jlebon opened this issue Dec 7, 2022 · 5 comments
Closed
5 of 10 tasks

Feature request: drop dependency for Perl in key-bindings.bash #3077

jlebon opened this issue Dec 7, 2022 · 5 comments

Comments

@jlebon
Copy link

jlebon commented Dec 7, 2022

  • I have read through the manual page (man fzf)
  • I have the latest version of fzf
  • I have searched through the existing issues

Info

  • OS
    • Linux
    • Mac OS X
    • Windows
    • Etc.
  • Shell
    • bash
    • zsh
    • fish

Problem / Steps to reproduce

__fzf_history__() in key-bindings.bash requires Perl. In more minimal environments, Perl may not be installed. It would be nice to be able to drop that dependency. Looking at the exact code there, it seems like it's just doing some frequency counting of the bash command history. Could we have that be built into fzf perhaps and gated behind a flag?

step- added a commit to step-/fzf that referenced this issue May 14, 2023
While awk is POSIX, perl isn't pre-installed on all *nix flavors. This
commit replaces perl with awk thus it eliminates the perl dependency.

This commit passed the current test suite with zero errors :
* `make error` => all test sections 'ok'
* `make docker-test` =>
  Finished in 50.929904s, 4.1822 runs/s, 35.3427 assertions/s.
  213 runs, 1800 assertions, 0 failures, 0 errors, 0 skips

See also:  junegunn#2777 junegunn#1934 # junegunn#3077 junegunn#2260

Note: unlike the original perl script, which gets `$HISTCOUNT` from
the environment, the awk script reads the initial history count from
line 1 of stdin. Then follow the history list, and finally a `\t`.
The reason for `\t` is to fix a small, pre-existing issue I noticed
while developing this patch (see the PR associated with this commit
for additional information).
@glensc
Copy link

glensc commented Sep 8, 2023

this doesn't seem like big deal to rewrite in awk or so.

EDIT: the PR is already there: #3295

@jlebon
Copy link
Author

jlebon commented Sep 8, 2023

Looks like the latest effort is stuck on performance issues: #3313 (comment). I added a suggestion there.

@step-
Copy link
Contributor

step- commented Sep 13, 2023

Author of #3395 (closed), #3310 (bash) and #3313 (awk) here. I read your suggestion in #3310. You're suggesting to implement an ad-hoc filter that would do what the perl filter (or my awk filter) does now. Am I right?

@jlebon
Copy link
Author

jlebon commented Sep 13, 2023

Author of #3395 (closed), #3310 (bash) and #3313 (awk) here. I read your suggestion in #3310. You're suggesting to implement an ad-hoc filter that would do what the perl filter (or my awk filter) does now. Am I right?

Right, I'm suggesting implementing the filter in golang behind some hidden switch. But I'm not a maintainer :) I would try to get @junegunn's opinion on it before doing this.

@step-
Copy link
Contributor

step- commented Sep 22, 2023

can be closed due to #3313 merge

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

No branches or pull requests

4 participants