Commit graph

2040 commits

Author SHA1 Message Date
Knight
270290efe6 whoami: use uucore::entries 2016-08-20 03:10:36 +08:00
Knight
99f0114450 stat: use uucore::entries 2016-08-20 03:10:36 +08:00
Knight
40e6c5a397 pinky: use uucore::entries 2016-08-20 03:10:36 +08:00
Knight
f66aaa8b78 ls: use uucore::entries 2016-08-20 03:10:36 +08:00
Knight
40e01b94f3 chown: use uucore::entries 2016-08-20 03:10:36 +08:00
Knight
799804e455 Add uucore::entries 2016-08-20 03:10:36 +08:00
Knight
c2fb66dfcb uucore::utmpx: fix doctest errors 2016-08-20 02:55:17 +08:00
mpkh
2dd816739f Merge pull request #970 from knight42/remove-vec-map
tr: use HashMap in stdlib instead of vec_map
2016-08-19 18:54:10 +00:00
Knight
bc61634dba tr: use HashMap in stdlib instead of vec_map 2016-08-20 02:25:55 +08:00
Jian Zeng
69e64e6c51 Merge pull request #967 from nathanross/cleanup-tests-squashed
tests: normalize around chaining asserts
2016-08-14 13:01:00 +08:00
Nathan Ross
99b39e4237 tests: normalize around chaining asserts
Although for some tests this adds characters
we still use them there because the
brevity cost is now worth the benefit in
terms of instant, natural-language readability
and recognizability for people not familiar
with this tests of this module or even the project
2016-08-13 17:59:21 -04:00
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