Nathan Ross
edc3bf7c08
impl: dryer use of coreopts
2016-08-20 10:07:24 -04:00
Nathan Ross
ee3aaa017f
uucore: allow 'wrong number of arguments' macro to be more precise
2016-08-20 10:07:08 -04:00
Nathan Ross
268b691881
uucore: add support for optflagopt to coreopts
2016-08-20 05:58:36 -04:00
Nathan Ross
cb1b32cda1
uucore: fix utility name in coreopts parsing error messages
2016-08-20 05:58:36 -04:00
Nathan Ross
d0b5b9a9fd
Merge pull request #971 from knight42/remove-unnecessary-ctypes
...
Remove unnecessary c_types
2016-08-20 00:41:59 -04:00
Knight
9ecf899e3d
Remove uucore::c_types
2016-08-20 12:12:49 +08:00
Knight
ddf47fab31
groups: use uucore::entries::get_groups instead
2016-08-20 11:59:58 +08:00
Knight
f49ee5b58b
uname: use utsname in libc instead
2016-08-20 11:59:58 +08:00
Knight
ac6bc5886b
arch: use utsname in libc instead
2016-08-20 11:59:58 +08:00
Knight
c63aa19cd1
Add uucore::utsname to get system info
2016-08-20 11:59:58 +08:00
mpkh
8781df81fb
Merge pull request #968 from knight42/uucore-entries
...
Add uucore::entries to get passwd/group file entry
2016-08-19 21:10:50 +00:00
Knight
b6c864b7f3
uucore::process: add functions to obtain uid/gid, euid/egid
2016-08-20 03:24:23 +08:00
Knight
369c2c2d83
id: use uucore::entries
2016-08-20 03:24:23 +08:00
Knight
2b96f8f0c1
chroot: use uucore::entries
2016-08-20 03:10:37 +08:00
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