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: Append-Query #2509

Closed
7 of 11 tasks
rayiik opened this issue May 30, 2021 · 3 comments
Closed
7 of 11 tasks

Feature Request: Append-Query #2509

rayiik opened this issue May 30, 2021 · 3 comments

Comments

@rayiik
Copy link

rayiik commented May 30, 2021

  • 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
    • powershell

Problem / Steps to reproduce

Feature Request

Append query/QUERY variable:
So i don't know if theirs a way outside of fzf to achieve this, ive tried a couple different things with very low levels of success. However there are many times (at least for me) when i dont want to replace-query or clear-query but rather i want to take the first query toggle search add some data then add another line from query and ad some data to that as well before i reload command {q}.

I think this change/addition wouldn't be a taxing change but would add much depth and many creative possibilities. I think having the ability to append query using a variable QUERY="$QUERY {}" --bind="key:set-query" would be the most versatile as this would allow for process substitution and herestring magic and possibly --bind="key:execute:export QUERY=$othervar/$(somsubstitution {}}"

Some examples would be pulling part of a line from the results into the query using awk, adding a password to a list of generated ssh files, minor changes in format of the data before piping to some other command, appending a value after a list of generated flags. just some ideals off the top of my head but very very open field of possibility.

@rayiik
Copy link
Author

rayiik commented Jun 20, 2021

hey so i've made a pull request (not sure how to link) but basically i took the replace query function duplicated it but modified the the first action
terminal.go

case actAppendQuery:
current := t.currentItem()
    if current != nil {
    t.input = append(t.input, current.text.ToRunes()...)
}
type acctionType int
const (
actAppendQuery

options.go

case "append-query":
appendAction(actAppendQuery)

however if failed two checks (which upon research seems to be related to the version of the request from github end and not the golang itself) have tested both the install script and make install from kali and arch linux both in actual installs and wsl.

@SpicyLemon
Copy link

This looks similar to #2465 ([FEATURE] dynamic replace-query). That one's for the more general ability to replace the query, but could also easily handle appending to it.

@rayiik
Copy link
Author

rayiik commented Jul 28, 2021

@SpicyLemon i mean yea but the way ive set it up works, so for now ill just implement it in a custom build of fzf the problem with the dynamic replace is that it modifies the search upon update my case use would be for example producing a list of flags for a command and some of the flags need additional information command --flag=(additional information) *append query here for next flag
its the additional information fields that i dont want being wiped out with a replace query {+} so i can build into a command from the list adding parameters as needed on a case by case basis

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

2 participants