GrayJack / coreutils

Core utils re-implementation for UNIX/UNIX-like systems written in Rust
Mozilla Public License 2.0
106 stars 40 forks source link

Implement sort #129

Closed allevo closed 3 years ago

allevo commented 3 years ago

In this PR there's the first implementation of sort command ( #46 )

We need to discuss about:

GrayJack commented 3 years ago

what happen when a files doesn't exists: sort ignores it or fails?

It should fail if I'm not mistaken

which flags should we implement? No one is implemented here.

All tools should be POSIX compatible, that means that for a tool to be considered complete, it has to implement all POSIX flags.

Since it's not always that people have the time to implement all flags and options or understand what all flags and options do, so when that happens, just let me know updating the PR message with what flags were implemented so we can open issues and update the tracker issue about it status.

Regardless if POSIX-complete or not, remember to update the README tool status table.

You can find the POSIX standard for sort here

for the time being, the implementation is in memory and no temp file technique is implemented shall we support stdin as input?

Yes, if I remember the standard correctly, it is specified that stdin has to be supported and is the default if no FILE is given

for test purpose, use println! macro is not a good choice: what we can use instead?

I think you can use write! macro instead, you can use it specifying anything that implements io::Write trait

write! docs here

marcospb19 commented 3 years ago

I'll link to uniq for reference in some of the questions:

allevo commented 3 years ago

Hi! sorry for the delay. I've updated the code using Read and Write trait for better test. I have also added some tests.

allevo commented 3 years ago

for time being I have implemented only -m and -o flags and the stdin support.

If for you is ok I would like to merge this before going to add other feature.

Can you add the hacktoberfest-accepted label too?

GrayJack commented 3 years ago

Bors r+

bors[bot] commented 3 years ago

Build succeeded: