Shell resolution on sub-directories
SquidDev opened this issue · 4 comments
When you have a program in a sub-directory, the shell auto-complete does not include it (unless you give the absolute path). This can be reproduced as follows:
mkdir test
edit test/program
and save- Type
test
in the shell. Note that it does not auto complete totest/program
.
The reason for this is that shell.programs
does not include sub-directories. For most directories on the path this makes sense. However, for the current directory, it is rather annoying.
It's also worth nothing that running turtle/excavate 10
on a normal computer will actually work, as so far as the program will start. This doesn't seem like desired behaviour, though I guess it could be useful.
The first point can be "fixed" by adding fs.complete
to this branch of completeProgram
. This does feel rather ugly as you're special casing a specific element of the path. Instead, I propose the following rules to shell.resolveProgram
and completeProgram
:
- If a program contains
/
then resolve and complete relative to the file system root. This includes paths starting with/
as well as./
,../
andtest/
. - Otherwise, resolve using the path. Auto-completion should attempt to use both the path and the current directory. So
tes
would still complete totest/program
.
There is an argument for removing the current directory from the path and requiring ./
. This bug - which is triggered by moving to the /rom/help
directory and being unable to get out as cd
resolves to /rom/help/cd
- does surface relatively regularly. I don't think it should be changed, but it is something worth bearing in mind.
@Wilma456 I noticed you've reacted to this issue, just wondering why? I mainly created this issue to get other people's thoughts on the matter, so I'd really like to know your opinion too :).
@SquidDev Sorry, I misunderstand you. I had thought that you mean, that all programs in Subdirectories are added that shellpath. I had read that Issue late in the evening.
I'd like to suggest that instead of removing "." from the path, it should be later in the list (allowing programs in the current dir called by name but also prevents the /rom/help command override situation)