Is it expected that it doesn't recognize paths without / or .?
kergoth opened this issue · 2 comments
I'm guessing this is expected, otherwise every word would be seen as a file, but I just noticed the output of ls | pe
wasn't what I would have expected :) Presumably one could alter the output to prefix such paths with ./
to force them to be seen as paths, i.e. ls -l ./*
or so? Is that the recommended way to handle such cases?
If you are only looking for folders and not files ls -F
would work.
If you would like to get all filenames from ls
, you can use ls -1
which outputs the filenames only (including folders). You then do not need pe at all.
For your question, indeed, if we matched words that do not contain a /
or a .
, we would match any word.
You could also do
ls -1 | xargs readlink -e {}
to get the full filepath.
I'd like to keep the "feature" of not touching the filesystem at all, because someone might have to look at a list of file that he doesn't have on his computer.
They are also other unix utilities to check if a filepath exists, for example readlink.
Maybe we could add an option to read what filepaths are good candidates for filenames, even if they don't look like standard filenames.
You could for example do :
ag --files-with-matches > file_candidates.txt # get all files that are in the current dir recursively
ls | pe --candidates file_candidates.txt
I'm still a bit reluctant to adding this (it adds a lot of complexity to this simple project), but will think about it.