Commit graph

941 commits

Author SHA1 Message Date
Jan Scheer
db3ee61742 du/sort/od/stdbuf: make error handling of SIZE/BYTES/MODE arguments more consistent
* od: add stderr info for not yet implemented '--strings' flag
2021-06-03 21:00:03 +02:00
Jan Scheer
ad26b7a042 head/tail/split: make error handling of NUM/SIZE arguments more
consistent

* add tests for each flag that takes NUM/SIZE arguments
* fix bug in tail where 'quiet' and 'verbose' flags did not override each other POSIX style
2021-06-03 20:37:29 +02:00
Jan Scheer
5898b99627 truncate: add error handling for SIZE argument
* add tests for SIZE argument
* fix clap argument handling for --size and --reference
2021-06-02 22:08:42 +02:00
Jan Scheer
2f5f7c6fa1 split: use "parse_size" from uucore
* make stderr of parsing SIZE/NUMBER argument consistent with GNU's behavior
* add error handling
* add tests
2021-06-02 21:32:41 +02:00
Jan Scheer
6b8de1dd8b sort: use "parse_size" from uucore
* make parsing of SIZE argument consistent with GNU's behavior
* add error handling
* add tests
2021-06-02 05:13:57 +02:00
Jan Scheer
cc659c8572 Merge branch 'master' of github.com:uutils/coreutils into refactoring_parse_size 2021-06-01 12:35:48 +02:00
Jan Scheer
3c7175f00d head/tail: add fixes and tests for bytes/lines NUM arg (undocumented sign)
* change tail bytes/lines clap parsing to fix posix override behavior
* change tail bytes/lines NUM parsing logic to be consistent with head
2021-06-01 12:17:11 +02:00
Jan Scheer
84f2bff778 head: use "parse_size" from uucore 2021-06-01 09:30:43 +02:00
Sylvestre Ledru
a017c1b589
Merge pull request #2323 from miDeb/maint/spellcheck-all
maint: actually run spellcheck on all files
2021-05-31 23:36:56 +02:00
Sylvestre Ledru
8618771f2e
Merge pull request #2322 from miDeb/seq/improvements
seq: improve compatibility
2021-05-31 23:09:13 +02:00
Michael Debertol
41878f1bf4 refactor/pr: polish spelling 2021-05-31 22:46:01 +02:00
Sylvestre Ledru
7b7185f916 Fix clippy warnings in the pr tests 2021-05-31 21:20:55 +02:00
Michael Debertol
4cf18e96f3 seq: change default value for -t and remove dubious escape sequences
GNU seq does not support -t, but always outputs a newline at the end.
Therefore, our default for -t should be \n.

Also removes support for escape sequences (interpreting a literal "\n"
as a newline). This is not what GNU seq is doing, and unexpected.
2021-05-31 21:20:19 +02:00
Michael Debertol
6ccc305513 seq: implement integer sequences
If we notice that we can represent all arguments as BigInts, take a
different code path. Just like GNU seq this means we can print an
infinite amount of numbers in this case.
2021-05-31 21:20:12 +02:00
Sylvestre Ledru
badf7aacb7
Merge pull request #2300 from tertsdiepraam/pr
Implement `pr` (resurrection of the resurrected PR)
2021-05-31 21:14:57 +02:00
Sylvestre Ledru
15da98d84e
Merge pull request #2315 from rivy/maint.fmt+spell
Spell check and correct the project
2021-05-31 21:00:04 +02:00
Jan Scheer
8bf1e33b5d Merge branch 'master' of github.com:uutils/coreutils into refactoring_parse_size
* truncate: use "parse_size" from uucore
* workaround fix for "test_reference"
2021-05-31 19:11:06 +02:00
Sylvestre Ledru
8d714b0ab0
Merge pull request #2317 from deantvv/fix-touch-parse-date
Fix touch parse date error
2021-05-31 18:18:44 +02:00
Dean Li
9d8e7b9acb
Fix touch parse date error
Now it can parse `touch -d 2000-01-23 file` and add test for parse date
error.

Related to #2311
2021-05-31 22:04:03 +08:00
Roy Ivy III
3f35e0a421 refactor ~ cargo make format 2021-05-31 08:23:58 -05:00
Roy Ivy III
4e20dedf58 tests ~ refactor/polish spelling (comments, names, and exceptions) 2021-05-31 08:23:57 -05:00
Terts Diepraam
7690dc018f Merge branch 'master' into pr 2021-05-31 15:23:06 +02:00
Sylvestre Ledru
13fd02862c
Merge pull request #2316 from deantvv/rmdir-match-gnu-error
rmdir: match GNU error output
2021-05-31 15:23:03 +02:00
Jan Scheer
f9a088cecf du: use "parse_size" from uucore
* fix stderr to be the same than GNU's `du` in case of invalid SIZE
2021-05-31 15:22:37 +02:00
Dean Li
9f1deb2df6
rmdir: match GNU error output
Related to #2258
2021-05-31 19:30:54 +08:00
Sylvestre Ledru
8c5dcd0765
Merge branch 'master' into implement-more 2021-05-31 10:17:15 +02:00
Jan Scheer
1c41efd732 stdbuf: use "parse_size" from uucore 2021-05-31 09:35:46 +02:00
Terts Diepraam
99fb2c5aac
Merge pull request #2310 from sylvestre/clippy2
Fix a clippy warning
2021-05-30 23:06:10 +02:00
Sylvestre Ledru
69850942b6 fix a clippy warning
WARNING: `cargo clippy`: single-character string constant used as pattern
2021-05-30 16:26:03 +02:00
Anup Mahindre
898d325aea ls: Fix minor output mismatch
When a single directory is passed to ls in recursive mode, uutils ls
won't print the directory name
======================
GNU ls:
z:
======================
======================
uutils ls:
======================

This commit fixes this minor inconsistency and adds corresponding test.
2021-05-30 18:00:52 +05:30
Sylvestre Ledru
3913731222
Revert "rmdir: match GNU error output" 2021-05-30 09:55:02 +02:00
Dean Li
5b417e251d
rmdir: match GNU error output
Related to #2258
2021-05-30 10:45:54 +08:00
Michael Debertol
dc63133f14
sort: correctly inherit global flags for keys (#2302)
Closes #2254. We should only inherit global settings for keys when there
are absolutely no options attached to the key.

The default key (matching the whole line) is implicitly added only if no
keys are supplied.

Improved some error messages by including more context.
2021-05-29 23:25:56 +02:00
Michael Debertol
d821719c67
expr: support arbitrary precision integers (#2271)
* expr: support arbitrary precision integers

Instead of i64s we now use BigInts for integer operations. This means
that no result or input can be out of range.
The representation of integer flags was changed from i64 to u8 to make
their intention clearer.

* expr: allow big numbers as arguments as well

Also adds some tests

* expr: use num-traits to check bigints for 0 and 1

* expr: remove obsolete refs

match ergonomics made these avoidable.

* formatting

Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
2021-05-29 23:25:23 +02:00
Terts Diepraam
b0bf3e7e0f pr: rustfmt test_pr.rs and utils.rs 2021-05-29 19:34:17 +02:00
Terts Diepraam
bc1870c0a7 Merge branch 'master' into pr 2021-05-29 19:21:31 +02:00
Jeffrey Finkelstein
4e73b919e9 truncate: add test for -r and -s options together
Add a test for when the reference file is not found and both `-r` and
`-s` options are given on the command-line.
2021-05-29 15:11:27 +02:00
Gilad Naaman
17b0939dee Moved factor to use clap
Issue: https://github.com/uutils/coreutils/issues/2121
2021-05-29 15:11:27 +02:00
Jan Scheer
e4aa8ee159 users: fix long_help text and clippy warning 2021-05-29 15:11:27 +02:00
Jan Scheer
3aeccfd802 fix a lot of clippy warnings 2021-05-29 15:11:22 +02:00
Terts Diepraam
0487360507 pr: make tests compile again 2021-05-29 14:30:30 +02:00
Sylvestre Ledru
3d42d41a72
Merge pull request #2247 from jfinkels/truncate-split-three-functions
truncate: re-organize truncate() into one function for each mode of operation
2021-05-29 10:31:02 +02:00
Sylvestre Ledru
0746b3e1e6
Merge pull request #2292 from Gilnaa/2121-factor-clap
Moved factor to use clap
2021-05-29 10:30:06 +02:00
Jan Scheer
714661774b users: fix long_help text and clippy warning 2021-05-29 02:34:43 +02:00
Michael Debertol
bb268d1500
sort: crash when failing to open an input file (#2265)
* sort: crash when failing to open an input file

Instead of ignoring files we fail to open, crash.
The error message does not exactly match gnu, but that would require
more effort.

* use split_whitespace instead of a manual implementation

* fix expected error on windows

* sort: update expected error message
2021-05-28 22:39:33 +02:00
Michael Debertol
e9656a6c32
sort: make GNU test sort-debug-keys pass (#2269)
* sort: disable support for thousand separators

In order to be compatible with GNU, we have to disable thousands
separators. GNU does not enable them for the C locale, either.

Once we add support for locales we can add this feature back.

* sort: delete unused fixtures

* sort: compare -0 and 0 equal

I must have misunderstood this when implementing, but GNU considers
-0, 0, and invalid numbers to be equal.

* sort: strip blanks before applying the char index

* sort: don't crash when key start is after key end

* sort: add "no match" for months at the first non-whitespace char

We should put the "^ no match for key" indicator at the first
non-whitespace character of a field.

* sort: improve support for e notation

* sort: use maches! macros
2021-05-28 22:38:29 +02:00
Sylvestre Ledru
9442f26fdb
Merge pull request #2283 from Mikadore/master
Closing #1916 - Concluding the test refactor
2021-05-28 22:36:47 +02:00
Jan Scheer
0bf14da490 tail: use "parse_size" from uucore 2021-05-28 22:21:03 +02:00
Sylvestre Ledru
fe42808e9b
Merge branch 'master' into implement-more 2021-05-28 19:49:48 +02:00
Gilad Naaman
6a9ffee548 Moved factor to use clap
Issue: https://github.com/uutils/coreutils/issues/2121
2021-05-28 19:48:28 +03:00