Completion case considered catastrophic

4 views
Skip to first unread message

Reuben Thomas

unread,
May 21, 2012, 4:34:34 PM5/21/12
to wa...@googlegroups.com
Anyone else really fed up with wajig 2.5's bash-completion code (which I wrote, sorry!) which only completes command names to upper case, and only completes after commands which are upper case? I can't really be bothered to work fully with either case, but I'd be happy to make it work for lower case only. As it is it really annoys me, and I have to keep retyping. I think that the fact that commands otherwise identical with apt-get, aptitude &c. commands are in the "wrong" case is confusing too.

--
http://rrt.sc3d.org

Karl Schmidt

unread,
May 21, 2012, 5:30:18 PM5/21/12
to wa...@googlegroups.com
On 05/21/2012 03:34 PM, Reuben Thomas wrote:
> Anyone else really fed up with wajig 2.5's bash-completion code (which I
> wrote, sorry!) which only completes command names to upper case, and
> only completes after commands which are upper case?

Yes - pretty annoying - and require pressing two keys to type the command which leads to more typos.

I can't really be
> bothered to work fully with either case, but I'd be happy to make it
> work for lower case only. As it is it really annoys me, and I have to
> keep retyping. I think that the fact that commands otherwise identical
> with apt-get, aptitude &c. commands are in the "wrong" case is confusing
> too.

Besides looking like shouting - it should be the same as apt-get, aptitude, dpkg as you say above
to maintain an orthogonal work environment and reduce unneeded complexity.

http://en.wikipedia.org/wiki/Orthogonal#Computer_science




--
--------------------------------------------------------------------------------
Karl Schmidt EMail Ka...@xtronics.com
Transtronics, Inc. WEB http://secure.transtronics.com
3209 West 9th Street Ph (785) 841-3089
Lawrence, KS 66049 FAX (785) 841-0434

True wisdom is knowing what we don't know;
There are many things that we can be certain of if we are willing to think, but
true maturity is being comfortable with the idea that there are unknowable things. -KPS



--------------------------------------------------------------------------------

Tshepang Lekhonkhobe

unread,
May 21, 2012, 7:18:52 PM5/21/12
to wa...@googlegroups.com
On Mon, May 21, 2012 at 11:30 PM, Karl Schmidt <ka...@xtronics.com> wrote:
> On 05/21/2012 03:34 PM, Reuben Thomas wrote:
>>
>> Anyone else really fed up with wajig 2.5's bash-completion code (which I
>> wrote, sorry!) which only completes command names to upper case, and
>> only completes after commands which are upper case?
>
>
> Yes - pretty annoying - and require pressing two keys to type the command
> which leads to more typos.

This I don't understand: "require pressing two keys...".

Tshepang Lekhonkhobe

unread,
May 21, 2012, 7:21:01 PM5/21/12
to wa...@googlegroups.com
On Mon, May 21, 2012 at 10:34 PM, Reuben Thomas <r...@sc3d.org> wrote:
> Anyone else really fed up with wajig 2.5's bash-completion code (which I
> wrote, sorry!) which only completes command names to upper case, and only
> completes after commands which are upper case?

Wot does this mean: "only completes after commands which are upper
case"? I can type lower-case and it gets automatically transformed
into upper-case.

Reuben Thomas

unread,
May 22, 2012, 5:41:16 AM5/22/12
to wa...@googlegroups.com
If I type

   wajig install foo[TAB]

then the completion code does not complete the package name, because "install" is all in lower case.

Since I'm a fast typist, used to typing wajig commands, I often type the entire command name instead of using completion.

--
http://rrt.sc3d.org

Tshepang Lekhonkhobe

unread,
May 22, 2012, 5:53:56 AM5/22/12
to wa...@googlegroups.com
Okay. Enough people complained, so will get rid of the madness soon,
hopefully today. Sorry for the pain.


Reuben Thomas

unread,
May 22, 2012, 6:01:01 AM5/22/12
to wa...@googlegroups.com
Would you like me to sort out the completion code?

--
http://rrt.sc3d.org

Tshepang Lekhonkhobe

unread,
May 22, 2012, 6:09:21 AM5/22/12
to wa...@googlegroups.com
Was thinking I'd just revert to old completion code (before the
upper-case thing), but if you can come with something better, that would
be extra kool.


Reuben Thomas

unread,
May 22, 2012, 6:11:26 AM5/22/12
to wa...@googlegroups.com
The advantage of simply switching the case on my current code is that it's more like the code for other packages, hence easier to compare and special case, and if anyone ever wants to make it complete "through" both cases, that's probably easier to add too.

--
http://rrt.sc3d.org

Tshepang Lekhonkhobe

unread,
May 22, 2012, 6:16:11 AM5/22/12
to wa...@googlegroups.com
That's kool. Thanks in advance for the patch then.


Reuben Thomas

unread,
May 22, 2012, 6:16:28 AM5/22/12
to wa...@googlegroups.com
I believe that simply lower-casing all the keywords, as in the attached, should work. (Lightly tested.)
--
http://rrt.sc3d.org
bash-completion

Tshepang Lekhonkhobe

unread,
May 22, 2012, 1:39:48 PM5/22/12
to wa...@googlegroups.com
On Tue, May 22, 2012 at 12:16 PM, Reuben Thomas <r...@sc3d.org> wrote:
> I believe that simply lower-casing all the keywords, as in the attached,
> should work. (Lightly tested.)

Is the section commented "don't complete anything if these options are
found" necessary? It looks useless to me, since that is default
behavior. The comment is also not accurate because filenames are
auto-completed.

Tshepang Lekhonkhobe

unread,
May 22, 2012, 2:22:48 PM5/22/12
to wa...@googlegroups.com
It would in fact be extra nice if there was a way to not actually
auto-complete at all, as is claimed in that section, since
auto-completing something like "wajig update [TAB]" does not make
sense.

Tshepang Lekhonkhobe

unread,
May 22, 2012, 2:34:41 PM5/22/12
to wa...@googlegroups.com
On Tue, May 22, 2012 at 8:22 PM, Tshepang Lekhonkhobe
If you are going to be preparing a patch, please make it against
latest VCS version (I've done some more changes to the bash-completion
script).

Reuben Thomas

unread,
May 23, 2012, 9:48:44 AM5/23/12
to wa...@googlegroups.com
On 22 May 2012 19:34, Tshepang Lekhonkhobe wrote:
> It would in fact be extra nice if there was a way to not actually
> auto-complete at all, as is claimed in that section, since
> auto-completing something like "wajig update [TAB]" does not make
> sense.

If you are going to be preparing a patch, please make it against
latest VCS version (I've done some more changes to the bash-completion
script).

Attached, a patch which should achieve that.

The problem was that complete was called with "-o default", which means that if no completions are returned by the completion code, readline does default completion. I removed this and instead call _filedir for wajig commands which (so far as I can determine) can or must take a file name.

The attached patch also fixes some English in the command docstrings, and adds a comment stanza to bash-completion to set up Emacs or vim for editing.

I have also filed a bug against aptitude, which has the same problem for the same reason (but, since its commands never take a filename, except one case that is already covered, has a simpler fix!).

--
http://rrt.sc3d.org
wajig.patch

Tshepang Lekhonkhobe

unread,
May 23, 2012, 4:55:07 PM5/23/12
to wa...@googlegroups.com
On Wed, May 23, 2012 at 3:48 PM, Reuben Thomas <r...@sc3d.org> wrote:
> On 22 May 2012 19:34, Tshepang Lekhonkhobe wrote:
>>
>> > It would in fact be extra nice if there was a way to not actually
>> > auto-complete at all, as is claimed in that section, since
>> > auto-completing something like "wajig update [TAB]" does not make
>> > sense.
>>
>> If you are going to be preparing a patch, please make it against
>> latest VCS version (I've done some more changes to the bash-completion
>> script).
>
>
> Attached, a patch which should achieve that.
>
> The problem was that complete was called with "-o default", which means that
> if no completions are returned by the completion code, readline does default
> completion. I removed this and instead call _filedir for wajig commands
> which (so far as I can determine) can or must take a file name.
>
> The attached patch also fixes some English in the command docstrings, and
> adds a comment stanza to bash-completion to set up Emacs or vim for editing.

Thanks you so much. It's committed now.
Reply all
Reply to author
Forward
0 new messages