opt --sort-files-mtime #211

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

fayland commented Feb 26, 2013

sort based on modified time. Thanks

Owner

What is the use case for this? When would you want to sort the files that ack searches by mtime? Or is this something that you'd only use with -f and getting a list of files, so you want to see all the files of a certain type with the most recently touched ones first?

fayland commented Feb 26, 2013

well, just sometimes I want to see the most recent changed files with ack results. is there any other way to archive it?

Thanks

Owner

When you say "ack results", are you talking about actual search results, or just using -f for a list of filenames?

When is a case that you want to see most recent first, and why?

I'm just trying to get my head around the problem that you're trying to solve. Your patch might be the way to do it, and it might not.

fayland commented Feb 26, 2013

"ack results" is actual search results, not using -f for the list of filenames.

but yes, you're right. -f is also working.

my usage is basically very simple and it might be OK that we can do it with -f and combine with other linux command.
for example, I'm searching 'story=' in my git repos and I want to know which file is the most recent, that I can copy it as a template for another new file.

so something like
ack -f 'story=' . | other_linux_command_sort_files_on_mtime_should_also_work

Thanks

Owner

But as I understand the patch, it's not going to actually sort all the files in mtime order. It's going to sort the files in each directory in mtime order, and it's going to sort the directories that it goes through in mtime order. If you have a tree of 1000 files, it's not going to sort all 1000 files. It's only going to sort per directory.

fayland commented Feb 26, 2013

I admit that I didn't think about subdirectories.

but yes, you're correct. it's not right. it needs more fixes. I'll check it and fix it tomorrow since it's a bit later today.

Thanks

@petdance petdance closed this Apr 17, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment