Skip to main content

cosmofy fs ls: emulating GNU ls #

How much of GNU ls should I emulate in Python?

Previously: pythonoid, baton

When I was designing the low-level zip file manipulation tools for cosmofy, I wanted an easy way to see the contents of the bundle. We're so used to using ls for looking into directories that I thought it would be cool to emulate as much of ls as I could.

But then it turned out that ls has a crazy number of options. I actually went through them all and tried to figure out if it was possible to support them.

But then I realized this was insane. First, many of the options are just aliases for slightly more explicit options. Charlie Marsh would never have a -t that was an alias for --sort=time. Why should I?

In the end I decided to go with the most common options (sorting, list view), a couple that were easy to implement, and a few longer-form ones that cover most of the aliases.

I'm pretty happy with the way it turned out.