pyline
pyline copied to clipboard
BUG,DOC: sorting appears to be broken
Test Cases:
- Sorting by column (ascending)
- Sorting by column (descending)
- Sorting by column (regex groups - ascending)
- Sorting by column (regex groups - descending)
Solutions:
A. Fix sorting B. Remove sorting functionality
Meanwhile:
- Sort by (rearranging columns and) piping to https://en.wikipedia.org/wiki/GNU_Core_Utilities https://en.wikipedia.org/wiki/Sort_(Unix) (and then re-rearrange columns)
So, to clarify with test cases:
# this sorts by the third (0, 1, 2) character of
# the default expression ``line`` (with ``unicode``)
./pyline.py -v -s 2
# these all sort by the third word (0, 1, 2) of
# the expression ``words`` (as ``unicode``)
./pyline.py -v -s 2 w
./pyline.py -v -s 2 'w'
./pyline.py -v -s 2 words
./pyline.py -v -s 2 'words'
# this sorts by the third word (0, 1, 2) as an integer
# and raises ValueError if the cast to integer raises an exception
./pyline.py -v -s 2 'words' --cols='2::int'
./pyline.py -v -s 2 'words' --cols='2::xsd:integer'