Commit graph

80 commits

Author SHA1 Message Date
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
Á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
Sylvestre Ledru
bf1944271c remove .DS_Store 2021-04-10 21:57:03 +02: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
electricboogie
e5113ad00e
Sort: Various fixes and performance improvements (#2057)
* Various fixes and performance improvements

* fix a typo

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

Co-authored-by: Sylvestre Ledru <sledru@mozilla.com>
Co-authored-by: Michael Debertol <michael.debertol@gmail.com>
2021-04-10 11:56:20 +02:00
Sivachandran
ee070028e4
install: implement stripping symbol table (#2047) 2021-04-10 11:53:29 +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
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
Yagiz Degirmenci
cbe07c93c6
cksum: add tests and fixtures (#1923) 2021-04-05 22:21:21 +02:00
Daniel Rocco
e5c61a28be fold: variable width tabs, guard treating tab as whitespace
Treat tab chars as advancing to the next tab stop rather than having a fixed
8-column width.

Also treat tab as a whitespace split target only when splitting on word
boundaries.
2021-04-05 08:55:07 -04:00
Chirag Jadwani
19c6a42de5 uniq: implement group option 2021-04-04 15:22:17 +05:30
Paul Otten
7859bf885f Consistency with GNU version of du when doing du -h on an empty file 2021-04-01 19:42:43 -04:00
Mikadore
8320b1ec5f
Rewrote head (#1911)
See https://github.com/uutils/coreutils/pull/1911
for the details
2021-03-29 13:08:48 +02:00
jaggededgedjustice
88d0bb01c0
Add shuf tests (#1958)
* Add tests for shuf

* Fixup GNU tests for shuf
2021-03-28 17:52:01 +02:00
Yagiz Degirmenci
545fe7d887
feat(unexpand): move from getopts to clap (#1883)
* feat: move unexpand to clap

* chore: allow muliple files

* test: add test fixture, test reading from a file

* test: fix typo on file name, add test for multiple inputs

* chore: use 'success()' instead of asserting

* chore: delete unused variables

* chore: use help instead of long_help, break long line
2021-03-23 09:42:05 +01:00
Neculai Balaban
c6927d97c8
cp: add support for -x/--one-file-system (#1840) 2021-03-19 21:15:35 +01:00
Sylvestre Ledru
fcccc2a973
Merge pull request #1826 from pfnsec/master
head: add support for -z/--zero-terminated
2021-03-18 21:37:12 +01:00
Peter Sherman
13e61c3234 head: add support for -z/--zero-terminated 2021-03-15 15:56:11 +00:00
Chirag Jadwani
116e253cc0 uniq: Fix skip fields
Current implementation of the skip fields logic does not handle
multibyte code points correctly. It assumes each code point (`char`) is
one byte. If the skipped part of the input line has any multibyte code
points then this can cause fields not being skipped correctly (field
start index is calculated to be before it actually starts).
2021-03-15 18:48:54 +05:30
Chirag Jadwani
ce4342d12e uniq: Fix panic on invalid utf-8 input 2021-03-15 18:48:54 +05:30
Michael Kefeder
e1626b8c64
ptx: ignore empty regex (#1808)
* ptx: ignore empty -W regex

* ptx: test to verify empty -W regex is ignored

* tests/ptx: verify word regexp from cmd-line is used
2021-03-12 21:52:37 +01:00
Daniel Rocco
0e02607dc7 numfmt: implement --field 2021-03-08 10:53:34 -05:00
Daniel Rocco
d06f91fbe2
numfmt: align format output values with GNU (#1745)
When converting to SI or IEC, produce values that align with the conventions
used by GNU numfmt.

- values > 10 are represented without a decimal place, so 10000 becomes 10K
  instead of 10.0K

- when truncating, take the ceiling of the value, so 100001 becomes 101K

- values < 10 are truncated to the highest tenth, so 1001 becomes 1.1K

closes #1726
2021-03-06 18:26:05 +01:00
Chad Brewbaker
05d8cc59c4
bug(wc): Add a test for unexpected behavior (#1723) 2021-02-16 13:36:49 +01:00
jaggededgedjustice
18c39daed7
fold: Handle input with newlines (#1680)
The read_line function appends to the given buffer which is never
cleared. This leads to lines being duplicated.
2021-01-05 09:10:01 +01:00
Stéphane Campinas
89bf7a726e csplit: refresh of the previous PR 2020-12-28 17:21:29 +01:00
Piyush Jaipuriayar
3ca8ba997c
hashsum: added blake2 as a hashing algorithm (#1651) 2020-12-08 23:32:02 +01:00
Sylvestre Ledru
601690b079 test(expand): Add some tests for expand (#1505) 2020-05-15 18:09:10 -05:00
Roy Ivy III
7b96432eff
Merge pull request #1504 from sylvestre/fmt
test(fmt): add some small initial tests
2020-05-10 12:25:18 -05:00
elgris
71ba8b3fd6 sort: add "dictionary-order" flag.
The flag makes 'sort' command ignore non-dictionary symbols
(non-alphanumeric and non-spaces). The only difference with GNU sort is
that it takes ALL alphanumeric symbols, not only ASCII ones.
2020-05-07 23:08:24 +02:00
Sylvestre Ledru
9b0129716f test(fmt): Add some tests for fmt
Even if it is a bit broken for now
2020-05-06 00:38:22 +02:00
Roy Ivy III
31655fc004 env: add support for new '--file' option (includes testing)
.# Discussion

This commit adds support for a '-f'/'--file' option which reads "KEY=VALUE" lines from
a config (or ini) style text file and sets the corresponding environment key. This is
modeled after the same option in the `dotenv` and `godotenv` commands. Notably, this
commit does *not* add automatic loading of ".env" configuration files.

The environment variables set by reading the configuration file are set prior to any
unset (eg, `-u BAR`) or set (eg, `FOO=bar`) actions. Files are loaded in order with
later files overwriting any overlapping environment variables, then, unset actions (in
command line order) are executed, then, finally, set actions (in command line order)
are executed.

[1] [`dotenv`](https://github.com/bkeepers/dotenv)
[2] [`godotenv`](https://github.com/joho/godotenv)
2019-04-29 09:50:22 -05:00
Julio Rincon
29c6ad5f6a tests: untrimmed stdout assertion (fix #1235) 2019-02-08 07:54:48 +11:00
xplorld
47f5f12759 sort: treat "NaN" as string in numeric sort 2018-09-03 22:28:18 -07:00
Konstantin Pospelov
e9fd9d623d join: implement option to suppress joined lines 2018-06-09 12:11:58 +03:00
Konstantin Pospelov
4b8d4bfc05 join: fix autoformat
There was an issue with autoformat when the files had a different
number of columns in the first line. This commit fixes the issue and
extends the related test to cover this case.
2018-04-15 17:42:52 +03:00
Konstantin Pospelov
7dc8ff62cc join: support headers 2018-04-11 22:55:44 +03:00
bootandy
ea504bf0ec du: add test for -d flag 2018-03-20 17:55:31 -04:00
bootandy
e253406026 du: Fix incorrect block size assumption.
du and other tools like stat assume a 512 byte block. ls is the only
tool to use 1024.

Add Simple set of tests
2018-03-20 16:59:29 -04:00
Konstantin Pospelov
128a38965e join: support custom empty filler 2018-01-17 23:26:00 +03:00
Konstantin Pospelov
12c5c951fb join: implement the -o option 2018-01-06 22:49:07 +03:00
Konstantin Pospelov
4e0a0cf7bb join: implement the -t option 2017-12-24 16:22:48 +03:00
Konstantin Pospelov
b33ce67d91 join: implement basic functionality
The basic implementation of join with some tests. The supported
options: -1, -2, -j, -a, -i.
2017-12-14 00:02:42 +03:00
shutefan
bf2a591b0a tail: suppress headers when --quiet flag is used 2017-10-05 21:25:21 +02:00
Joshua Miller
7dafb649d5 implement many copy flags
- Refactored towards extensibility
2017-07-16 19:20:07 -05:00
Jian Zeng
daba29b832 Merge pull request #1026 from evestera/cat-numlines-notrailing
cat: fix for numbered lines w/ no trailing newline
2017-01-23 06:39:31 -06:00
Erik Vesteraas
81996915df cat: fix for numbered lines w/ no trailing newline
Make at_line_start persist between printing each file. This fixes an
issue when numbering lines in the output and one of the input files
does not have a trailing newline.
2017-01-23 03:34:47 +01:00
Anthony Deschamps
6dc1eb54c0 sort: Implement ignore-case
Test included.
2017-01-21 13:30:22 -05:00
Wim Hueskes
2f12b06ba1 od: implement --traditional 2016-09-02 21:24:29 +02:00