wfxr / forgit

:zzz: A utility tool powered by fzf for using git interactively.
MIT License
4.33k stars 136 forks source link

Improve handling of arguments in forgit::add #237

Closed baodrate closed 1 year ago

baodrate commented 1 year ago

currently, passing arguments to forgit::add bypasses the interactive selector and are passed directly to git add. This isn't particularly useful. So pass the arguments to the git status call instead, so fzf can be used to interactively select from the list.

This is particularly useful when calling git forgit add against a subdirectory or a shell glob (e.g. git forgit add *(om[1,5]))

Check list

Description

Type of change

Test environment

carlfriedrich commented 1 year ago

Hey @qubidt, thanks for your suggestion.

The behavior for passing arguments to forgit::add has been deliberately implemented that way in e73cef6856e826173454ddfa1df9fb37fe9cff2f. It makes adding a file via the command line possible using the same command as adding a file interactively, so we don't have to use different commands for each use case. We actually handle arguments the same way on most other forgit commands as well (e.g. forgit::checkout::branch or forgit::revert::commit). I noticed that this is not documented, yet, I will put that on my to-do-list.

However, I see your use-case, and I also see that fzf does not support glob syntax. Since I assume we do not want to change the default behavior, I would rather only accept this in combination with an opt-in config, though.

@wfxr @cjappl What do you say?

baodrate commented 1 year ago

That's a very reasonable compromise! 😃I'm out of town currently so I can't implement it but I'll update the pr when I'm able

cjappl commented 1 year ago

Pinging @qubidt - we will close soon unless we hear a response / updated PR :)

baodrate commented 1 year ago

sorry! dropped off my plate but I'll see if I can revisit this soon!

cjappl commented 1 year ago

Closing, can re-open in the future if we get some new revisions :)