Primo
primo is a library and command-line tool to sort files like UNIX’s sort.
Unlike sort, however, it interprets series of digits as full numbers:
# input
# sort
# primo
Note this is my first ever Rust program so the code might not be the best.
Usage
Command-Line
primo [<filename>]
It reads on stdin or from the provided file and print the sorted version on
stdout.
Library
extern crate primo;
Known Issues
- The sort is quite slow for now because the parsing function is called multiple times on each string
- Chars are treated as numbers, so
"abc"will sort after"25bc"and before"27bc"because'a'’si32value is26.
FAQ
What about sort’s -V option?
The GNU coreutils package has a sort implementation that supports primo’s
main use-case with its -V option. I unfortunately learnt about this option
after writing primo.