complete icon indicating copy to clipboard operation
complete copied to clipboard

[Proposal] Add new API to pass options to complete command

Open vadmeste opened this issue 5 years ago • 5 comments

Hey.

Currently, using posener/complete does not automatically escape spaces in bash.

I think the best solution of this is to add a new API which pass options to complete command, such as:

  • -o filenames to automatically escapes spaces
  • -o nospace related to this issue https://github.com/posener/complete/issues/87

What do you think @posener ?

vadmeste avatar Oct 11 '19 15:10 vadmeste

Hey, I'm currently on vacation. I'll get back to you in a couple of weeks. I think it should be added to the install stage. If I understand correctly. Cheers, Eyal

On Fri, Oct 11, 2019, 20:58 Anis Elleuch [email protected] wrote:

Hey.

Currently, using posener/complete does not automatically escape spaces in bash.

I think the best solution of this is to add a new API which pass options to complete command, such as:

What do you think @posener https://github.com/posener ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/posener/complete/issues/101?email_source=notifications&email_token=AAHAN7SJCGX76URKWTPC2VLQOCPD7A5CNFSM4I73SR42YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HRH6BOA, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHAN7SLX75VEJLVHIGUI3LQOCPD7ANCNFSM4I73SR4Q .

posener avatar Oct 13 '19 08:10 posener

Hey

If one would want to add these options, they would be added to the bash complete command here: https://github.com/posener/complete/blob/master/cmd/install/bash.go#L36.

  • I am not sure if you can add them to other supported shells (fish, zsh).
  • You would have to add them also to the install API here: https://github.com/posener/complete/blob/master/cmd/install/install.go#L21
  • Then, to the CLI struct: https://github.com/posener/complete/blob/master/cmd/cmd.go#L15, and propagate to the instsall call: https://github.com/posener/complete/blob/master/cmd/cmd.go#L43.

Would you be interested in contributing this options?

posener avatar Oct 23 '19 19:10 posener

Would you be interested in contributing this options?

Yes, I am interested.

  • I am not sure if you can add them to other supported shells (fish, zsh).

I think the best thing to do is to add an API which adds more flags and arguments to the completion command. fish complete command is different to bash & zsh

vadmeste avatar Oct 30 '19 13:10 vadmeste

I looked into this some time ago and found that it is not possible to call bash's builtins from an external program. So unless the fundamental mechanism that this completion library operates on is changed, this will not be possible IIRC.

See https://stackoverflow.com/questions/55842705/is-it-possible-to-modify-compopts-dynamically-from-an-external-completion-comman

AdamSLevy avatar Mar 01 '20 00:03 AdamSLevy

I looked into this some time ago and found that it is not possible to call bash's builtins from an external program. So unless the fundamental mechanism that this completion library operates on is changed, this will not be possible IIRC.

See https://stackoverflow.com/questions/55842705/is-it-possible-to-modify-compopts-dynamically-from-an-external-completion-comman

Indeed. This is not a dynamic thing. It will be configured during the setup of the completion

vadmeste avatar Apr 20 '20 15:04 vadmeste