toumorokoshi / tome

convert any directory of scripts into your own fully-featured command.
MIT License
38 stars 2 forks source link

Autocompletion completes non-executable files #15

Closed zph closed 2 years ago

zph commented 3 years ago

With the folder layout of:

script1
script2
non-executable-file

Autocomplete shows all of them.

Do we want to filter down to only things set as executable? Non-executables won't work when the exec happens and might be an invalid format like markdown.

Currently these are selected based on presence in folder and excluded if in ignore list, but we could potentially stat each one to find only the ones with +x set.

toumorokoshi commented 3 years ago

It's a good question. I think it makes sense to not show the file in completion, because:

As long as we handle the edge case of no executable files in the directory, I think it's fine.

toumorokoshi commented 2 years ago

After reviewing a bit, I've landed for now on not adding this functionality.

To help hide files, the user can prefix the file with a dot (.). This helps keeps the behavior easier to reason about to.

Happy to re-open if anyone feels differently and wants to discuss.