Nathan Ross
9d2616442a
Merge pull request #963 from alsuren/sort--merge
...
Implement sort --merge
2016-08-12 20:42:30 -04:00
David Laban
cf93826eee
sort --check refactor to use iterator
...
This allows us to check files without bringing them entirely into
memory. Also makes it easier to find the disorder in
(seq 9; echo 0) | sort --check
(points at the end of the file, where our previous version would
point at the start of the file)
Itertools' .coalesce() was the most useful helper that I could find
for comparing adjacent values in an iterator. It is designed for
implementing things like .dedup(), so the resulting code is a little
unintuitive.
2016-08-13 00:42:44 +01:00
David Laban
87daf9dd8d
sort: use stdout_only_fixture in tests
2016-08-13 00:42:44 +01:00
David Laban
3531c46fb8
sort --merge --unique
...
This uses Itertools' dedup() rather than Vec::dedup(). There is probably
a cleaner, more polymorphic way to do this. Suggestions welcome.
2016-08-13 00:42:44 +01:00
David Laban
e1af1520e7
sort: make compare_by honour settings.reverse
...
This allows sort --merge --reverse to work as well.
2016-08-13 00:42:43 +01:00
David Laban
8a8319a337
sort --merge works, but ignores --unique and --reverse
...
FileMerger receives Lines Iterables of the pre-sorted input files
via push_file() It implements Iterator, which yields lines from the
input files in (merged) sorted order. If the input files are not sorted,
then the behavior is undefined.
Internally, FileMerger uses a
std::collections::BinaryHeap<MergeableFile>.
MergeableFile is an internal helper that implements Ord in a way that
BinaryHeap can use (note that we want smallest-first, but BinaryHeap
returns largest first, so MergeableFile::cmp() calls reverse() on
whatever compare_by() returns.
2016-08-13 00:42:43 +01:00
David Laban
76abc7e51d
sort: refactor compare_fns into Settings
...
Also split out a compare_by(a, b, settings) helper function,
which may be used by --merge, later.
2016-08-13 00:26:20 +01:00
mpkh
1c05100cd5
Merge pull request #964 from knight42/uniq-add-tests
...
Uniq: add tests
2016-08-12 18:46:59 +00:00
Knight
6d7937b0dd
README: make it more encouraging
2016-08-13 02:13:42 +08:00
Knight
f19d361013
uniq: add test for case-insensitive comparison
2016-08-13 02:04:19 +08:00
Knight
0ea5314ea1
uucore: make libc optional
2016-08-13 02:00:20 +08:00
mpkh
96e8748336
Merge pull request #945 from nathanross/cut-fix-chars-ranges
...
cut: make chars mode use byte mode behavior
2016-08-12 04:56:47 +00:00
Jian Zeng
9b82387960
Merge pull request #961 from nathanross/coreopts-further-refinement
...
Coreopts further refinement
2016-08-12 12:00:20 +08:00
nathanross
f2dc230d0e
uucore: coreopts alignment, spacing, and optional usage
2016-08-11 23:20:39 -04:00
Jian Zeng
143183dc68
Merge pull request #962 from nathanross/tests-echo-complete-tests
...
tests/echo: complete tests except for --help and --version
2016-08-12 10:52:11 +08:00
Nathan Ross
4a2532fc12
cut: chars mode has same behavior as byte mode
2016-08-11 18:49:20 -04:00
nathanross
bf2260ead6
tests/echo: complete tests excepting help, version
2016-08-11 18:00:09 -04:00
Nathan Ross
2e41535d69
pinky: switch to using new coreopts syntax
2016-08-11 14:37:26 -04:00
Nathan Ross
6ecf9ecf66
who: switch to using new coreopts syntax
2016-08-11 14:37:25 -04:00
Nathan Ross
617e8ca682
arch: switch to using new coreopts syntax
2016-08-11 14:37:25 -04:00
Nathan Ross
e019b2657e
cut: switch to using new coreopts syntax
2016-08-11 14:37:24 -04:00
Nathan Ross
f8509240df
uucore: require version; syntax; summary; longhelp
2016-08-11 14:37:16 -04:00
Jian Zeng
8632e19b44
Merge pull request #960 from knight42/who
...
Implement who
2016-08-11 16:26:56 +08:00
Knight
87894dedca
who: implemented
2016-08-11 15:41:28 +08:00
Knight
18da533538
uucore::utmpx: change API and fix error
2016-08-11 15:41:12 +08:00
Knight
7637115e51
who: add tests
2016-08-11 15:37:39 +08:00
Knight
8c6cd72848
who: add entries
2016-08-11 00:19:26 +08:00
Jian Zeng
548b58a09e
Merge pull request #958 from knight42/improve-utmpx
...
Improve utmpx
2016-08-10 16:37:42 +08:00
Knight
963ab9d321
users: use uucore::utmpx
2016-08-10 15:24:55 +08:00
Knight
f4c50921d8
uptime: use uucore::utmpx
2016-08-10 15:24:45 +08:00
Knight
77ef1580c2
pinky: use uucore::utmpx
2016-08-10 15:24:29 +08:00
Knight
301a240b73
uucore::utmpx: refine implementation
2016-08-10 15:23:07 +08:00
Knight
163a3a2540
coreopts: fix error when using msg_wrong_number_of_arguments
macro
2016-08-10 13:59:30 +08:00
Knight
23979542af
uucore: conditional enable different features
2016-08-10 13:57:40 +08:00
Knight
c9dde462c7
uucore: export latest libc
2016-08-10 01:00:39 +08:00
mpkh
ab345f133a
Merge pull request #957 from knight42/fix-message-template
...
coreopts: display package name instead of module path
2016-08-09 20:59:39 +04:00
Knight
7d5a4dbf20
coreopts: display package name instead of module path
2016-08-10 00:16:06 +08:00
mpkh
588b4e2718
Merge pull request #956 from nathanross/tests-common-communicative-assertions
...
tests/common: more communicative assertion failure messages
2016-08-09 14:11:24 +04:00
mpkh
6d2bc03e47
Merge pull request #954 from nathanross/tests-basename-use-chaining
...
tests/basename: use chaining for brevity and consistency
2016-08-09 08:15:21 +04:00
Jian Zeng
9b3fadff64
Merge pull request #953 from pthariensflame/fix/shellcheck
...
Make installation more robust
2016-08-09 10:25:22 +08:00
Jian Zeng
a681f1bf9c
Merge pull request #952 from nathanross/cut-impl-zero-terminated
...
cut: implement zero-terminated option
2016-08-09 10:22:56 +08:00
Alexander Ronald Altman
9394b9da08
Make installation more robust
...
This fixes a few problems I was having with installing on Mac.
2016-08-08 18:51:24 -07:00
Nathan Ross
ffb801c893
tests/basename: use chaining for brevity and consistency
2016-08-08 21:12:58 -04:00
Nathan Ross
5aaff02195
cut: implement zero-terminated option
...
no changes to char mode because removal
of specialized char mode behavior is pending
2016-08-08 20:15:53 -04:00
mpkh
3618d9df94
Merge pull request #951 from nathanross/message-templates
...
Add Message templates
2016-08-08 14:34:56 +04:00
Nathan Ross
1bf2c82520
arch: use message templates for consistent, original-work error handling
2016-08-08 04:36:33 -04:00
Nathan Ross
d56389aca0
cut: use message templates for consistent error UX
2016-08-08 04:32:48 -04:00
Nathan Ross
3eb9bbf4b5
uucore: CoreOptions error and version message templates
2016-08-08 04:29:11 -04:00
Nathan Ross
c91fd51197
uucore: add message templates
2016-08-08 03:05:36 -04:00
mpkh
c48f6cefc6
Merge pull request #950 from nathanross/cut-original-help-and-usage
...
cut: provide original-work help message and option descriptions
2016-08-08 10:55:10 +04:00