LyonSyonII/hunt-rs

auto-detect path type specified in cli command invocation and use the same for the output results

Closed this issue · 3 comments

Firstly, I wanted to say the performance of hunt is outstanding. What took me 2 minutes 8 seconds in find, took 10 seconds in hunt. You should be getting more stars.

The issue I have is with the simple output displaying the full path of the filename when a full path was not described in the cli command.
In other words, please have hunt auto-detect explicit path or relative path usage in the cli command and adjust the results output accordingly to use the same path type(relative path or full explicit path).

find using a relative path(the dot .). Please notice the result also uses a relative path since it auto-detected it:

time find . -type f -name "SCP_173 -print > ../allFindResults.txt
./rooms/room-999/SCP_173

hunt using a relative path(the dot .). Please notice the result contained full explicit path, but that was undesired since the cli command never used a full explicit path. Also note it creates much bigger results since each line in the result has a longer full path.

time hunt -c -h -t f -s -e SCP_173 . > ../allHuntExactResults.txt
/mnt/someremotedrive/a/b/c/d/thispathcouldbeverylong/andtheresultfilewillbemuchlarger/rooms/room-999/SCP_173

The change request is to achieve a similar looking result file and exact same file size as find, but using hunt.

time hunt -c -h -t f -s -e SCP_173 . > ../allHuntExactResults.txt
./rooms/room-999/SCP_173

Thank you for listening.

Could you maybe pipe the results through sed and whatever to achieve this?

I'm glad you found hunt useful!

Regarding the issue, I personally prefer to always have the canonicalized version of each path, but I think it will be pretty straightforward to add this feature as a flag.

Is this sufficient for your use-case?

xeruf commented

I think the default should be to show the (relative) path as described here, with a flag to show the canonicalized path, because the default should be handy, which the current default is not.