coreutils icon indicating copy to clipboard operation
coreutils copied to clipboard

Implement tac cmd.

Open andreas-hofmann opened this issue 2 years ago • 5 comments

andreas-hofmann avatar Dec 28 '21 19:12 andreas-hofmann

Thanks for the PR!

I do have a few suggestions, to make the code more closely match the other tools in this repo.

When adding a new tool, don't forget to increment the number completed in the README.

Your code can also be made shorter by taking further advantage of the common module. For example, -h,--help and --version are already handled, and will output those things in a style that matches the rest of the utils.

You should call fp.finalize() to make certain everything is closed properly. It will return any remaining arguments, which should be the filenames entered on the command line.

It looks like you try to read from stdin if no files were given, which is good, but the user could also enter and actual - on the command line (which also means read from stdin). That will have to be handled the same as if no filenames were given at all.

JalonSolov avatar Dec 28 '21 20:12 JalonSolov

Thanks for your feedback, highly appreciated! Just dipping my toes into V, so please bear with me. I've taken care of the issues you mentioned, but actually the regex-setting is currently still without effect. Please feel free to hold back the merge until I've added this functionality, too.

andreas-hofmann avatar Dec 30 '21 19:12 andreas-hofmann

Alright, I'll hold until you say it's ready. In the meantime, I'll approve so the CI runs, in case that find something.

JalonSolov avatar Jan 01 '22 19:01 JalonSolov

So it did find one thing... need to run v fmt -w tac.v :-)

JalonSolov avatar Jan 04 '22 20:01 JalonSolov

Any progress?

JalonSolov avatar Jun 22 '22 00:06 JalonSolov

This is the first utility I checked, so I might be wrong. But shouldn't we actually make these streaming utilities actually stream the data?

Reading them whole into memory is IMHO the worst solution in the times of major I/O gains by io_uring in Linux and similar APIs on other OSes.

dumblob avatar May 25 '23 13:05 dumblob

The guiding principle should always be "Make it work, first, then optimize."

JalonSolov avatar May 25 '23 13:05 JalonSolov

Any objections to closing this (superseded by PR #128)?

syrmel avatar Feb 16 '24 22:02 syrmel