jovanbulck / jsh

A basic UNIX shell implementation in C
GNU General Public License v3.0
30 stars 10 forks source link

cd autocompletion: we must go deeper. #50

Open GijsTimmers opened 9 years ago

GijsTimmers commented 9 years ago

Take, for example, this directory structure:

[gijs@therion /tmp]$ tree
.
├── Appels
├── Bramen
├── Clementijnen
├── Druiven
└── Groenten
    ├── Bloemkool
    ├── Bonen
    ├── Broccoli
    └── Paprika

Note that the current working directory is still /tmp. Typing cd BloemTab should yield: cd Groenten/Bloemkool/.

In other words, when we cd to a directory, jsh should make a list of subdirectory's subdirectories (got it?). We should also look into the possibility of autocompleting parent directories:

[gijs@therion /tmp]$ cd Groenten/          
[gijs@therion Groenten]$ pwd
/tmp/Groenten

Now, pressing cd DruiTab should yield: cd ../Druiven

We should test whether this is feasible. We should make sure that jsh stays snappy. We could limit the number of subdirectories / levels if necessary.

jovanbulck commented 9 years ago

This is possible, but we should first fix cd autocompletion in the current directory instead. This is now still very primitive. See also issues #16 and #35

It's probably best to group all feature requests for cd autocompletion in a separate issue #51 so we don't drown in cd feature requests :p

I think this one is for the long run, since there is still a lot of 'basic' cd work...

I'll lock this one, so discussion happens at a central place: issue #51 Feel free to open an issue for "future cd work" that discusses more advanced cd work. This way issue #51 won't overflow now, I think.