Commit graph

2013 commits

Author SHA1 Message Date
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
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
Nathan Ross
fae1e92767 tests/common: more communicative assertion failure messages
often when stdout is wrong, differences in stderr are
more useful for determining the cause
2016-08-08 02:54:22 -04:00
Nathan Ross
ea6b0e55ad cut: provide original-work help message and option descriptions 2016-08-07 23:16:15 -04:00
Nathan Ross
77bd2887c2 Merge pull request #948 from pthariensflame/patch-1
Allow choice of `install` program
2016-08-07 22:10:10 -04:00
Alexander Altman
1543199b50 Allow choice of install program
This permits the use of, *e.g.*, `ginstall` or `uu-install`.
2016-08-07 18:46:43 -07:00
Nathan Ross
1880c46acd Merge pull request #946 from ChrisNikkel/feature/zero_terminated
uniq: add -z option to allow for zero terminated input and output
2016-08-06 22:49:10 -04:00
Chris Nikkel
cdfdc3a2bd uniq: add command line option -z for zero terminated input and output 2016-08-06 18:41:47 -07:00
Chris Nikkel
c0b2da7c01 uniq: add test for zero terminated input and output 2016-08-06 18:41:39 -07:00
mpkh
b290ab2ca5 Merge pull request #944 from nathanross/tests-cut-incr-feature-coverage
tests/cut: positive testcases for feature complete
2016-08-07 02:06:52 +04:00
Nathan Ross
cb6f84e3d8 tests/cut: positive testcases for feature complete 2016-08-06 17:11:54 -04:00
Jian Zeng
7ff57d6b66 Merge pull request #942 from nathanross/fix-appveyor
ci: fix appveyor cargo test call
2016-08-07 02:28:58 +08:00
Jian Zeng
8cb6b141f1 Update README 2016-08-07 02:02:52 +08:00
Nathan Ross
3048b5d551 ci: fix appveyor cargo test call 2016-08-06 13:52:57 -04:00
mpkh
b85b8dc18c Merge pull request #940 from knight42/cleanup-tests
Cleanup tests
2016-08-06 21:51:30 +04:00
Knight
a23f1a13e7 Remove useless crates 2016-08-07 01:23:49 +08:00
Knight
cfc28ebc05 tests: extern crates in separated test modules 2016-08-07 01:12:19 +08:00
Nathan Ross
2eeb7b77cc Merge pull request #939 from knight42/base32
Implement base32 & unify base64
2016-08-06 13:03:48 -04:00