Comment

Comment by martinflack

> enumerate -r 1 10 -- 'printf "%02d\n" {}'

The printf zero-padding should be a built-in feature, as dealing with lots of filename structures and date structures needs zero-padding.

I often end up doing things like "for i in $(seq -w 1 100); do.." in bash.

My preference would actually be that -r does automatic zero-padding to fit the widest number that will come out of the range, and another variant like -R would suppress that behavior; but it could also be an optional switch.

It might also be nice to have the code recognize when start is greater than end, like -r 10 1, and support backwards-counting.

parent martinflack 3 months ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton