bug#46060: Offer ls --limit=...

2021-01-24 Thread 積丹尼 Dan Jacobson
> "PE" == Paul Eggert writes: PE> That argument would apply to any program, no? "cat", "diff", "sh", PE> "node", PE> Not sure why "ls" needs a convenience flag that would complicate the PE> documentation and maintenance and be so rarely useful. OK, then I'll close the bug then.

bug#46060: Offer ls --limit=...

2021-01-24 Thread Paul Eggert
On 1/23/21 1:13 PM, 積丹尼 Dan Jacobson wrote: And any database command already has a --limit option these days, and does not rely on a second program to trim its output because it can't control itself. Indeed, on some remote connections one would only want to launch one program, not two. That

bug#46060: Offer ls --limit=...

2021-01-24 Thread 積丹尼 Dan Jacobson
E.g., "What is API pagination? Some APIs, such as Contacts can return millions of results. We obviously can't return all of them at once, so we need to return a subset - or a page - at a time. This technique is called paging and is common to most APIs. Paging can be implemented in many different

bug#46060: Offer ls --limit=...

2021-01-24 Thread 積丹尼 Dan Jacobson
Sure, it is against the https://en.wikipedia.org/wiki/Unix_philosophy, but just like SQL has LIMIT, and $ unicode --help -m MAXCOUNT, --max=MAXCOUNT Maximal number of codepoints to display... Just like "we want to stop pollution at the source", not always "clean up after

bug#46060: Offer ls --limit=...

2021-01-24 Thread Erik Auerswald
Hi Dan, On 23.01.21 22:13, 積丹尼 Dan Jacobson wrote: I hereby propose "ls --limit=..." $ ls --limit=1 # Would only print one result item: A You might say: "Jacobson, just use "ls|sed q". Closed: Worksforme." Ah, but I am talking about items, not lines: You can use the ls option '-1' to print

bug#46060: Offer ls --limit=...

2021-01-23 Thread 積丹尼 Dan Jacobson
I hereby propose "ls --limit=..." $ ls --limit=1 # Would only print one result item: A You might say: "Jacobson, just use "ls|sed q". Closed: Worksforme." Ah, but I am talking about items, not lines: $ ls A B C D E F G H I J K L $ ls -C|sed 2q A B C D E F G H $ ls -C --limit=2 A