nushell / engine-q

MIT License
58 stars 40 forks source link

Commands run but throw` io_error: not a directory` after `enter`ing a structured file #730

Closed rbpatt2019 closed 2 years ago

rbpatt2019 commented 2 years ago

I was playing around with engine-q to get a sense of the differences between it and nushell, and came across some odd behaviour for enter. I recognise that engine-q is making quite a few changes in how it handles things, but the below behaviour still seems, well, odd!

On nushell, one could enter a structured file and then use commands like ls within that shell, as in the below image (within a local clone of the engine-q repo).

Screenshot 2022-01-13 at 08 42 10

When I do the same in engine-q, I can successfully enter the shell and then things get wonky. Every command returns a nu::shell::io_error, but they all still run. shell still lists the newly created shell, I can ls (more on that shortly), and exit.

Screenshot 2022-01-13 at 08 44 12

I suspect this is related to how the path in the shell is being set. When I compare the output of shell, nu shell creates a "fake" root path at the entry to the file - hence, everything is detected as a directory. engine-q doesn't seem to do this. The path for the shell is just the file name, so everything fails after enter because it's not a directory. I suspect that this is also why ls returns no data.

If every command after entering a shell is going to error as it's not a directory, then I think it makes a bit more sense to have the enter command error and prevent this. If engine-q is still going to allow entering a file, then I think the allow inputs probably need to be changed so every command doesn't error. In either case, I would expect that commands that error should also run.

rbpatt2019 commented 2 years ago

That a bit long and probably sounds a bit more cranky than I meant I meant it to! I've fallen head over heels for nutshell and would be happy to help, where possible, but my knowledge of Rust is limited, at best.

Thanks for the great tool!

fdncred commented 2 years ago

I'm shocked that you can enter into a file in engine-q. atm I'm not sure we're going to support value shells and only have filesystem shells. value shell is our term for entering files like a Cargo.toml.

Is that a deal-breaker for you? I'm interested in thoughts people have about value shells.

rbpatt2019 commented 2 years ago

Not at all! I've always thought this feature was a little esoteric. Given the strength of the table support, I was never sure what benefit, if any, there was to the value shells. The usual open file | where ... etc. always seemed more logical. There should be one, and preferably only one, obvious way to do it 😆 and open seems far more intuitive for files to me.