Gilnaa / globwalk

MIT License
47 stars 14 forks source link

Should globwalk return only files by default? #12

Closed epage closed 4 years ago

epage commented 6 years ago

In a lot of cases, people will do globs like *.rs which 99% of the time will only return files. In this case, if they then refactor and switch to *, they can now start to get directories.

imo it seems less surprising if globwalk only returned files by default.

I could see having a .file_type(globwalk.FileType::File | globwalk.FileType::Dir || globwalk.FileType::SymLink) to give users control over what is returned.

Gilnaa commented 6 years ago

Having a file type filter sounds like aa great idea. Not sure about the default, though.

I'm partially against it since it is not what I would have expected my shell to produce; I believe the default behavior should emulate a shell as much as possible.

@killercup

killercup commented 6 years ago

I wouldn't restrict it to files by default.

I could see having a .file_type(globwalk.FileType::File | globwalk.FileType::Dir || globwalk.FileType::SymLink) to give users control over what is returned.

That sounds like a good idea to me. Maybe also add a files_only() shorthand.

Gilnaa commented 4 years ago

Solved in a timely manner in v0.8.0