On 10 Nov 2018, Christoph Anton Mitterer wrote:

>On Sat, 2018-11-10 at 18:27 -0200, Gabriel F. T. Gomes wrote:
>
>> That is possible, but it would require a change that has not yet been
>> accepted upstream [1].  I have added this information to Debian's
>> bash-completion git repository [2], but I'm not yet confident that
>> this is the right thing to do, so I will not apply this to Debian.  
>
>Just curios, why not?
>
>If one completes without the glob, the completion already shows the
>alternatives (which is e.g. like a handy shortcut ls in a directory)...
>why not having this with globs in place?

I agree that it looks like the correct thing to do, however, I'm always
concerned of unintended, undesired side-effects that these changes
could have.

Particularly for this additional change [1], there has been some
discussion around it in the past [2], and, more specifically, Ville
Skyttä mentioned what could be the side-effects when someone adds
`set show-all-if-ambiguous on' to ~/.inputrc [3].

I gave it a try, and here's what it looks like.

  $ ls /tmp/test/[ENTER]
  bla  ble  blee

1) bash-completion 2.8-3
   + `set show-all-if-ambiguous off' in ~/.inputrc

  $ ls /tmp/test/*[TAB][TAB][TAB][...]
  (no output)

2) bash-completion 2.8-3
   + `set show-all-if-ambiguous on' in ~/.inputrc

  $ ls /tmp/test/*[TAB][TAB][TAB][...]
  (no output)

Same behaviour on both cases.

3) bash-completion 2.8-3
   + additional change [1]
   + `set show-all-if-ambiguous off' in ~/.inputrc

  $ ls /tmp/test/*
  bla   ble   blee  
  $ ls /tmp/test/*

  (this is the behaviour you want, I guess)

4) bash-completion 2.8-3
   + additional change [1]
   + `set show-all-if-ambiguous on' in ~/.inputrc

  $ ls /tmp/test/*
  /tmp/test/bla   /tmp/test/ble   /tmp/test/blee  
  $ ls /tmp/test/bl

  (notice that `*' was expanded to `bl' (common part of the options))

There's a difference in behaviour depending on the setting of
`show-all-if-ambiguous'.  This inconsistency looks weird to me.

Cheers,
Gabriel

[1] 
https://superuser.com/questions/823257/unexpected-bash-glob-completion-uses-first-match-even-if-ambiguous/1022284#1022284
[2] https://github.com/scop/bash-completion/pull/77#issuecomment-251582105
[3] https://github.com/scop/bash-completion/pull/77#issuecomment-251728248

Reply via email to