Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Glob sort specifier ideas



Here are 2 ideas for new glob sort specifiers:

ou for "unsorted" directory order (like "-U" in GNU ls(1)).

oe:string: to run "string" as shell code, like the e:: glob specifier.
This would allow user code to hook into the glob sort system.  It
would work like sort and the "cmp" or "<=>" operators in perl, taking
2 files as arguments, returning -1, 0 or 1 file1 is "less than",
"equal to" or "greater than" file2 in the sort order.

An example use for the oe:string: specifier would be this.  I recently
had a set of patches that shipped as ARJ files.  I needed to extract
them in time stamp order on top of an existing directory hierarchy.
The ARJ files all had the same mtime, but the ARJ header stores a time
stamp when the archive is created.  I created a function to extract
the time stamp from each of the files, and sorted them on that.  It
would be cool to be able to do something like:

  for x in *.arj(oe:myfunc:); do arj x base_dir $x; done

Where myfunc would get called repeatedly as "myfunc file1.arj
file2.arj", returning -1, 0 or 1 to the glob sort system (or whatever)
that would allow it to sort the file list into order.

Thanks,

-Jonathan Hankins

-- 
+------------------+-----------------------------------------------------+
|Jonathan Hankins  | 		       	 jonathan-hankins@xxxxxxxxxxxxxx |
+------------------+-----------------------------------------------------+



Messages sorted by: Reverse Date, Date, Thread, Author