HeyPuter / phoenix

🔥 Puter's pure-javascript shell
https://puter.com/app/terminal
GNU Affero General Public License v3.0
90 stars 15 forks source link

Add standard command line options to wc #29

Closed AtkinsSJ closed 7 months ago

AtkinsSJ commented 7 months ago

-c: count bytes -m: count characters (overrides -c) -l: count newlines -w: count words

AtkinsSJ commented 7 months ago

So, there's a little bit of inconsistency here, that I'm uncertain about. The spec says about -m:

If the -m option is specified, the number of characters shall replace the field in this format.

This makes it sound like -c and -m are mutually exclusive, but the GNU coreutils implementation of wc (which is what's on my Linux machine) will output both if both are present. It says:

The counts are printed in this order: newlines, words, characters, bytes, maximum line length.

So, should our wc behave that way instead? I think I've just persuaded myself that it should.

KernelDeimos commented 7 months ago

I agree, we should follow the GNU behavior in this case; it makes a lot more sense.