Commit graph

332 commits

Author SHA1 Message Date
electricboogie
42da444f40 Remove unused deps 2021-04-18 13:49:11 -05:00
electricboogie
d7b7ce52bc Vendored ext_sorter, removed unstable, created a byte buffer sized vector instead of a numbered capacity vector 2021-04-18 11:54:18 -05:00
electricboogie
acfe0681d4 Merge branch 'master' of https://github.com/uutils/coreutils 2021-04-17 11:54:45 -05:00
electricboogie
a76d452f75
Sort: More small fixes (#2065)
* Various fixes and performance improvements

* fix a typo

Co-authored-by: Michael Debertol <michael.debertol@gmail.com>

* Fix month parse for months with leading whitespace

* Implement test for months whitespace fix

* Confirm human numeric works as expected with whitespace with a test

* Correct arg help value name for --parallel

* Fix SemVer non version lines/empty line sorting with a test

Co-authored-by: Sylvestre Ledru <sledru@mozilla.com>
Co-authored-by: Michael Debertol <michael.debertol@gmail.com>
2021-04-17 10:06:19 +02:00
electricboogie
e6c195a675 ExtSort 2021-04-12 14:24:22 -05:00
Árni Dagur
eb4971e6f4
cat: Unrevert splice patch (#2020)
* cat: Unrevert splice patch

* cat: Add fifo test

* cat: Add tests for error cases

* cat: Add tests for character devices

* wc: Make sure we handle short splice writes

* cat: Fix tests for 1.40.0 compiler

* cat: Run rustfmt on test_cat.rs

* Run 'cargo +1.40.0 update'
2021-04-10 22:19:53 +02:00
electricboogie
77411f3fb5 Implement test for months whitespace fix 2021-04-10 13:36:57 -05:00
Michael Debertol
69f4410a8a
sort: dedup using compare_by (#2064)
compare_by is the function used for sorting, we should use it for dedup
as well.
2021-04-10 19:49:10 +02:00
Michael Debertol
49c9d8c901
sort: implement -k and -t support (#1996)
* sort: implement basic -k and -t support

This allows to specify keys after the -k flag and a custom field
separator using -t.

Support for options for specific keys is still missing, and the -b flag
is not passed down correctly.

* sort: implement support for key options

* remove unstable feature use

* don't pipe in input when we expect a failure

* only tokenize when needed, remove a clone()

* improve comments

* fix clippy lints

* re-add test

* buffer writes to stdout

* fix ignore_non_printing

and make the test fail in case it is broken :)

* move attribute to the right position

* add more tests

* add my name to the copyright section

* disallow dead code

* move a comment

* re-add a loc

* use smallvec for a perf improvement in the common case

* add BENCHMARKING.md

* add ignore_case to benchmarks
2021-04-10 14:54:58 +02:00
Sylvestre Ledru
e1221ef3f8
Merge pull request #2036 from joppich/issue1930
stdbuf: move from getopts to clap
2021-04-10 11:58:01 +02:00
Nicolas Thery
698924a20a
unlink: move from getopts to clap (#2052) (#2058) 2021-04-10 11:50:21 +02:00
joppich
c54b5f2d82 stdbuf: move from getopts to clap 2021-04-10 00:39:12 +02:00
electricboogie
8474249e5f
Sort: Implement stable sort, ignore non-printing, month sort dedup, auto parallel sort through rayon, zero terminated sort, check silent (#2008) 2021-04-08 22:07:09 +02:00
Sylvestre Ledru
717b875b5d
Merge pull request #2046 from ricardoaiglesias/timeout-clap
timeout: Moved argument parsing to clap
2021-04-07 23:19:36 +02:00
paulotten
52706372aa
Replace outdated time 0.1 dependancy with latest version of chrono (#2044)
* Replace outdated time 0.1 dependancy with latest version of chrono

I also noticed that times are being miscalculated on linux, so I fixed that.

* Add time test for issue #2042

* Cleanup use declarations

* Tie time test to `touch` feature
- if we compile with the right OS feature flag then we should have it,
  even on Windows
2021-04-07 08:41:04 +02:00
Ricardo Iglesias
ea0ead6a2e Ran cargo lock update command. 2021-04-06 22:16:52 -07:00
Yagiz Degirmenci
c965effe07
fold: move to clap, add tests (#2015) 2021-04-06 22:51:27 +02:00
Sylvestre Ledru
f57eb0fdfa
Merge pull request #1993 from cbjadwani/master
uniq: Implement --group option
2021-04-05 22:33:04 +02:00
Sylvestre Ledru
7cdeb18dff
Merge pull request #2026 from tertsdiepraam/ls/hide_and_ignore
ls: --hide and --ignore
2021-04-05 22:31:23 +02:00
Terts Diepraam
d68959d696 ls: update cargo.lock with globset 2021-04-05 10:12:23 +02:00
Terts Diepraam
bbb27800c9 ls: fix windows tests and commit lock 2021-04-04 23:14:55 +02:00
Sylvestre Ledru
c196f4ae8b
Merge pull request #2023 from ycd/cut
cut: move to clap, add gnu like error messages + tests
2021-04-04 14:47:15 +02:00
Chirag Jadwani
19c6a42de5 uniq: implement group option 2021-04-04 15:22:17 +05:30
Yagiz Degirmenci
cfc3d52be4 cut: move to clap 2021-04-03 20:19:30 +03:00
Yagiz Degirmenci
b940b2d79c dirname: move to clap, simplify code 2021-04-03 18:24:39 +03:00
Sylvestre Ledru
f37284129e new release 0.0.6 to address the cat issue 2021-04-03 16:06:58 +02:00
Sylvestre Ledru
a852574745 Fix bug #2017 - cat isn't working
Revert "cat: Improve performance on Linux (#1978)"

This reverts commit 7a947cfe46.
2021-04-03 15:50:59 +02:00
Sylvestre Ledru
ac031dffa4 new release 0.0.5 2021-04-03 10:30:07 +02:00
Sylvestre Ledru
f10de40ab8 refresh cargo.lock with recent updates 2021-04-02 23:30:24 +02:00
ReggaeMuffin
2eb32d845e
chores: run cargo +1.40.0 fmt
Apparently fmt from 1.40.0 is a bit more strict in some places

Let me know if this is worthwhile merging :)
2021-04-02 10:56:49 +01:00
Sylvestre Ledru
9c2cd81b11 refresh cargo.lock with recent updates 2021-04-01 23:18:57 +02:00
paulotten
090d29496a
Issue #1622 port du to windows (#1788)
* Issue #1622 port `du` to windows

* Attempt to support Rust 1.32

Old version was getting "attributes are not yet allowed on `if`
expressions" on Rust 1.32

* Less #[cfg]

* Less duplicate code.

I need the return and the semicolon after if otherwise the second #[cfg]
leads to unexpected token complilation error

* More accurate size on disk calculations for windows

* Expect the same output on windows as with WSL

* Better matches output from du on WSL

* In the absence of feedback I'm disabling these tests on Windows.
They require `ln`. Windows does not ship with this utility.

* Use the coreutils version of `ln` to test `du`

`fn ccmd` is courtesy of @Artoria2e5

* Look up inodes (file ids) on Windows

* One more #[cfg(windows)] to prevent unreachable statement warning on linux
2021-04-01 23:16:47 +02:00
Árni Dagur
7a947cfe46
cat: Improve performance on Linux (#1978)
* cat: Improve performance, especially on Linux

* cat: Don't use io::copy for splice fallback

On my MacBook Pro 2020, it is around 25% faster to not use io::copy.

* cat: Only fall back to generic copy if first splice fails

* cat: Don't double buffer stdout

* cat: Don't use experimental or-pattern syntax

* cat: Remove nix symbol use from non-Linux
2021-04-01 23:08:48 +02:00
Aleksandar Janicijevic
cf4970f083
shred: Replaced eprintln with show_error (#1992) 2021-04-01 08:53:48 +02:00
Yagiz Degirmenci
e958864bd9
tac: exit with proper code, move from getopts to clap, add test for invalid inputs (#1957) 2021-03-31 21:21:10 +02:00
Aleksandar Janicijevic
751ae6a8f8
shred: use clap for argument management (#1961) 2021-03-31 21:19:04 +02:00
Sylvestre Ledru
da18ffa496 refresh cargo.lock with recent updates 2021-03-30 20:54:25 +02:00
Árni Dagur
698dab12a6
wc: Don't read() if we only need to count number of bytes (Version 2) (#1851)
* wc: Don't read() if we only need to count number of bytes

* Resolve a few code review comments

* Use write macros instead of print

* Fix wc tests in case only one thing is printed

* wc: Fix style

* wc: Use return value of first splice rather than second

* wc: Make main loop more readable

* wc: Don't unwrap on failed write to stdout

* wc: Increment error count when stats fail to print

* Re-add Cargo.lock
2021-03-30 20:53:02 +02:00
Sylvestre Ledru
32ddef9b9e
refresh cargo.lock with recent updates (#1964) 2021-03-29 14:35:12 +02:00
electricboogie
da5f2f3a6c
sort: Add a GNU-style Random Sorter (#1922) 2021-03-29 13:05:52 +02:00
Yagiz Degirmenci
8cc7a90d7c
sum: fix crash on invalid inputs, move to clap, add tests (#1952) 2021-03-29 13:03:56 +02:00
Raymond Wang
ab5b6dd844
tr: move from getopts to claps #1929 (#1954) 2021-03-29 13:03:24 +02:00
Craig Pastro
6d4f70ccb2
shuf: move from getopts to clap (#1950) 2021-03-28 15:08:37 +02:00
Sylvestre Ledru
1bfea356a6 refresh cargo.lock with recent updates 2021-03-28 10:36:44 +02:00
Sylvestre Ledru
ab32fd2ba6 refresh cargo.lock with recent updates 2021-03-27 20:03:47 +01:00
Yagiz Degirmenci
f66a188414
mkfifo: general refactor, move to clap, add tests (#1945)
* mkfifo: general refactor, move to clap, add unimplemented flags

* chore: update Cargo.lock

* chore: delete unused variables, simplify multiple lines with crash

* test: add tests

* chore: revert the use of crash

* test: use even more invalid mod mode
2021-03-27 20:00:59 +01:00
Yagiz Degirmenci
ac7edcc4fa
ptx: delete getopts dependency (#1942)
* chore: delete getopts dependency

* deps: update Cargo.lock
2021-03-27 13:31:06 +01:00
Sylvestre Ledru
e1439dd199
refresh cargo.lock with recent updates (#1924)
Updating memoffset v0.6.1 -> v0.6.2
    Updating syn v1.0.64 -> v1.0.65
2021-03-27 10:06:22 +01:00
Antonio Gurgel
35675fdfe7
install: implement -C / --compare (#1811)
* install: implement `-C` / `--compare`

GNU coreutils [1] checks the following: whether
- either file is nonexistent,
- there's a sticky bit or set[ug]id bit in play,
- either file isn't a regular file,
- the sizes of both files mismatch,
- the destination file's owner differs from intended, or
- the contents of both files mismatch.

[1] https://git.savannah.gnu.org/cgit/coreutils.git/tree/src/install.c?h=v8.32#n174

* Add test: non-regular files

* Forgot a #[test]

* Give up on non-regular file test

* `cargo fmt` install.rs
2021-03-27 09:18:47 +01:00
Sylvestre Ledru
f431f58dd8
Bump min rustc to 1.40 (#1909) 2021-03-25 15:28:47 -07:00