(courtesy of @iology in #102)
Consider this directory tree:
> tree
.
โโโ dir1
โย ย โโโ file1
โย ย โโโ file2
โโโ dir2
โโโ file3
โโโ file4
2 directories, 4 files
Now, go to dir1 and perform a search in the parent directory:
> cd dir1
> fd '' ..
.
../dir2
../dir2/file3
../dir2/file4
file1
file2
The results are correct, but it would be more helpful if the output would look like this (in some order):
> cd dir1
> fd '' ..
../dir1
../dir2
../dir2/file3
../dir2/file4
../dir1/file1
../dir1/file2
How about making this a flag like --tree? That would allow the tree structure when wanted but then it will default to the original output by default. It's often easier to work with the default output when scripting.
@Doxterpepper: It's often easier to work with the default output when scripting.
Examples?
Normally when I'm searching for a file I am intending to do something with it such as edit it with a text editor. If the output is like the original output it is easier to copy and paste into the next command, or to include it in a script to perform some action on each file. A crude example would be:
for file in $(fd 'foo.txt' .)
do
echo 'some change' >> $file
done
I think the tree output is great for humans to read, perhaps the tree output could be default unless something like --plain is given. In either case the option for basic output would be good in my opinion.
@Doxterpepper I still don't see why you don't want "../dir1/file1" (instead of "file1"), while you still tolerate "../dir2/file3". And to copy/paste "file1" is just a double click.
NOTE: Your example use ".", not "..".
I think I misunderstood the description, I thought the suggestion was to include tree style output with ascii decorators and all. Disregard my comments above.
understanding the requirements better now, would anyone oppose me taking this on?
No problem, I haven't started on this one.
Ooops, while fixing #82, I inadvertently implemented this feature. :P
Ooops, while fixing #82, I inadvertently implemented this feature. :P
Sounds good :smile:. Would you like to open a PR for that?
Sounds good ๐. Would you like to open a PR for that?
Some superfluous slashes and dots in the output is giving me a headache, #112 only solves part of the problem. (Linux) I need to fix that first. ๐ค
Most helpful comment
Ooops, while fixing #82, I inadvertently implemented this feature. :P