Open wooster0 opened 3 years ago
@fitzgen I'd be happy to submit a PR for this if you agree that it should check for being a symlink. But perhaps it should check to see if the symlink target exists and is a file?
Looking further, the std::fs::metadata
already should be peeking at the target file, not the actual symlink itself.
For my usecase when I wrote this crate, I would have been fine with following symlinks and essentially answering whether the thing that the symlink points to was executable or not. I realize that may or may not be what other users want. Maybe makes sense to have it configurable.
This is
is_executable
ofis_executable
: https://github.com/fitzgen/is_executable/blob/master/src/lib.rs#L90-L97 This isis_executable
ofnushell
: https://github.com/nushell/nushell/blob/b39dda05500d92b627685b8251bfe416dc621c08/crates/nu-completion/src/command.rs#L73-L86 If you compare them you will notice that nushell has an additionalis_symlink()
check butis_executable
'sis_executable
does not. Is this intentional or is there potentially an unintended omission?