mgunyho / tere

Terminal file explorer
European Union Public License 1.2
1.68k stars 38 forks source link

Add Nushell integration snippet #89

Closed kubouch closed 1 year ago

kubouch commented 1 year ago

Adds a code snippet to integrate tere with Nushell.

mgunyho commented 1 year ago

Thanks! Does this work with options, like tere --ignore-case? And does it ignore stderr, i.e., does tere --version or tere --help work as expected?

kubouch commented 1 year ago

Actually, the arg passing wouldn't work with this. We have a way for passing the args, but it wouldn't preserve the cd change outside the scope, we'd need to update this.

Not sure why ignoring stderr is necessary. The original tere --version or tere --help will print the stuff as expected, exiting with 1.

mgunyho commented 1 year ago

Not sure why ignoring stderr is necessary. The original tere --version or tere --help will print the stuff as expected, exiting with 1.

Ah, so the exit code of 1 returns from the function and prevents it from trying to go inside the if statement? The point is that the output of --help and --version go to stderr, so that stdout is empty, and we don't try to do cd <output of --version>. But if --version works and it doesn't print something like cd: folder 'tere 1.4.0' not found then all is good.

I am not familiar at all with Nushell, so I don't know how to make the argument passing work.

kubouch commented 1 year ago

Currently, we have simple argument passing which could be used here but currently, it wouldn't be able to preserve the changed directory, we'd need to fix that. I'll close this PR then until it's done.