Re: Completing the command line using 'all' as the option to command.complete

  • From: Adam Krolnik <adam.krolnik@xxxxxxxxxxxxxxx>
  • To: emelfm2@xxxxxxxxxxxxx
  • Date: Fri, 01 Aug 2008 13:20:45 -0500


Here's what I was doing...

sh>ls -lt | head  (32747)
stty: standard input: Invalid argument
total 41168
-rw-rw-r-- 1 krolnik zsp    12268 Aug  1 13:13 Misc_hw_stuff.ods
-rw-rw-r-- 1 krolnik zsp     2107 Jul 31 17:26 x2z_full.txt
-rw-rw-r-- 1 krolnik zsp   119808 Jul 31 11:41 sdram_newconfig.xls
-rw-rw-r-- 1 krolnik zsp      367 Jul 30 15:27 craigslist.search
-rw-rw-r-- 1 krolnik zsp    10481 Jul 29 17:03 zsim520_sdram.resource


With complete "files"

%  ls x2z<tab>            -- Will complete the filename as x2z_full.txt

With complete "all"

%  ls x2z<tab>            -- Will complete the filename as x2z_full.txt

Here's the difference.

With complete "files" and  starting in one directory up.

% ls doc/x2z<tab>         -- Will complete the filename as doc/x2z_full.txt

With complete "all" and starting in one directory up.

% ls doc/x2z<tab>         -- No completion being done.

It would be good if this could work as tcsh and complete the filename, path included.

  Thanks.




tpgww@xxxxxxxxxxx wrote:
On Thu, 31 Jul 2008 15:14:00 -0500
Adam Krolnik <adam.krolnik@xxxxxxxxxxxxxxx> wrote:

It appears that configuring the key binding 'Tab' for the command line to complete 'all' (types) does not complete files.

Strangely, it will complete executable files (rwx...) and list them (as if they are a directory.) But files without a execute permission do not get completed. If I set the complete option to 'files'
it will complete them though.

I have not tried completing the mount type.
Adam,

I'm not sure exactly what you did, but it's intended to work like this:

comm<Tab> (i.e. no whitespace) is expected to be completion of a command name, 
and will retrieve executable files only.

command <Tab> is essentially useless but will work like the previous case

command arg<Tab> will complete arg taking full account of the config-specified 
completion argument, defaulting to 'all' if there's no such argument.

command arg <Tab> is essentially useless but will work like the previous case.

However when doing 'all' and match(es) exist in a specific category e.g. mounts 
or dirs or files, it stops scanning (no more categories). I'm not sure why this 
behaviour was implemented. Need to think about it.

Regards
Tom



--
   Soli Deo Gloria
   Adam Krolnik
   Director of Design Verification
   VeriSilicon Inc.
   Plano TX. 75074
   Co-author "Assertion-Based Design", "Creating Assertion-Based IP"

Other related posts: