akinomyoga / ble.sh

Bash Line Editor―a line editor written in pure Bash with syntax highlighting, auto suggestions, vim modes, etc. for Bash interactive sessions.
BSD 3-Clause "New" or "Revised" License
2.72k stars 86 forks source link

[bash-completion] Short options for sed are not accessible #324

Closed EmilyGraceSeville7cf closed 1 year ago

EmilyGraceSeville7cf commented 1 year ago

ble version: 0.4.0-devel4+f4c973b Bash version: 5.1.16(1)-release (x86_64-pc-linux-gnu)

image

Maybe add them into completion suggestions manually or send request to change man page format slightly to make it parsable? 🤔 Or enhance parser itself.

akinomyoga commented 1 year ago

Thank you for the report! But what filters out short options is bash-completion. With the plain ble.sh without bash-completion, the menu shows short options at least in my environment, but it doesn't show them with bash-completion.

akinomyoga commented 1 year ago

Ref: https://github.com/scop/bash-completion/issues/831

EmilyGraceSeville7cf commented 1 year ago

As a sidenote, I almost always use long options. But having short ones can be beneficial for some users to learn them ones via completion and quickly type later. What about to provide some BLE setting whether to show both kind of options or particular one?

akinomyoga commented 1 year ago

BLE itself (without bash-completion) currently shows both, so are you suggesting an option to disable short options? Maybe I can add an option to ignore completions by a glob pattern.

Or if your suggestion is an option to modify the behavior of bash-completion, I don't think that option should be implemented in ble.sh. I'm thinking of suggesting an option to bash-completion, but the reasoning given in https://github.com/scop/bash-completion/issues/831 also seems to make sense. How many users want to find short options when they do not know about the option (given that no descriptions are shown in the plain Bash without ble.sh)? I personally feel it's worth showing, but it's merely my preference. I'll think about it more.

EmilyGraceSeville7cf commented 1 year ago

BLE itself (without bash-completion) currently shows both, so are you suggesting an option to disable short options?

Yes.

akinomyoga commented 1 year ago

BLE itself (without bash-completion) currently shows both, so are you suggesting an option to disable short options?

Yes.

I initially thought about adding a general bleopt option that specifies a pattern for the completion candidates that should be ignored in a similar way as FIGNORE so that the user can specify -? in the bleopt option. However, this will disable all the short option completions. On the other hand, the behavior of bash-completion is more specific: if there is a corresponding long option to a short option, the short option is not generated. Then, I'm not sure if it's worth implementing a bleopt option for this specific behavior.

For example, do you really need it? The filtering of short options is already implemented in bash-completion, so if you wouldn't like to see the short options, you can just load bash-completion. Actually, the initial request seems to be the opposite, and it seems like you have just suggested the same feature as bash-completion after looking at https://github.com/scop/bash-completion/issues/831. In that case, there is no reason to implement it in ble.sh.

EmilyGraceSeville7cf commented 1 year ago

So... even if it's gonna be implemented, it will be done in bash-completion? Then... is it worth to close this issue?

akinomyoga commented 1 year ago

So... even if it's gonna be implemented, it will be done in bash-completion?

Which feature are you talking about? The feature that turns off the short options are already implemented in bash-completion.

To summarize, in this issue, two opposite features are discussed.

In both cases, if there arise strong reasons that convince me, I'll consider implementing it in ble.sh, but currently it appears to be unlikely to me. If you currently do not have strong reasons that could convince me, you can close the issue for now. If you find them later, you can reopen it.