yorukot / superfile

Pretty fancy and modern terminal file manager
https://superfile.netlify.app
MIT License
5.4k stars 117 forks source link

Add parameter `--print-last-dir` #274

Open MrPandir opened 1 month ago

MrPandir commented 1 month ago

The part you want to Enhancement

I suggest adding the --print-last-dir parameter. If it was added at startup, then when exiting the superfile, write the absolute path to the standard stdout.

Why it is necessary to enhancement

This makes it easy to use the cd_on_quit function with an alternate implementation. Since in most shells you will need to do something like this:

spf () {
    cd "$(command spf --print-last-dir "$@")"
}

This is easily portable from one system to another, since we are not tied to the file path. And much more intuitive and understandable than scripts are now.

Additional context

You can also copy shell scripts using this method from lf. Need files with cd in the name. Also note that it uses only one hyphen for the argument, which is not quite right. Two hyphens should be used.

yorukot commented 1 month ago

i think this is a great idea!