ndd7xv
3842ecb1b4
dd: status=progress rewrites once/sec
2022-02-06 17:56:08 -05:00
Jeffrey Finkelstein
fec662a623
dd: show warning when using 0x size multiplier
...
Show a warning when a block size includes "0x" since this is
ambiguous: the user may have meant "multiply the next number by zero"
or they may have meant "the following characters should be interpreted
as a hexadecimal number".
2022-02-06 17:13:15 -05:00
Sylvestre Ledru
1f7c08d87b
Merge pull request #3028 from jfinkels/dd-multipliers
...
dd: add support for 'b' and 'x' multipliers in numeric arguments
2022-02-06 22:03:54 +01:00
Sylvestre Ledru
1ac45c9961
Merge pull request #3044 from water-ghosts/cp-dir-vs-file
...
cp: Fail when copying a directory to a file
2022-02-06 22:01:37 +01:00
Sylvestre Ledru
57cf3a533f
Merge pull request #3067 from ndd7xv/printf-clap-defaults
...
printf: use clap default help and version
2022-02-05 22:16:44 +01:00
Jeffrey Finkelstein
1af709f642
dd: truncate to specified seek length
...
When specifying `seek=N` and *not* specifying `conv=notrunc`, truncate
the output file to `N` blocks instead of truncating it to zero before
starting to write output. For example
$ printf "abc" > outfile
$ printf "123" | dd bs=1 skip=1 seek=1 count=1 status=noxfer of=outfile
1+0 records in
1+0 records out
$ cat outfile
a2
Fixes #3068 .
2022-02-05 16:07:44 -05:00
Sylvestre Ledru
ebf33d775e
Merge pull request #3023 from RishiKumarRay/main
...
basenc, base64 and base32 have an ABOUT that's formatted differently than the other utils
2022-02-05 14:40:03 +01:00
Sylvestre Ledru
252e30c839
Merge pull request #3046 from hbina/hbina-tail-head-dont-use-is-numeric-to-check-digits
...
tail&head: dont use is_numeric to check for digits
2022-02-05 10:08:01 +01:00
ndd7xv
5e790918ef
printf: use clap default help and version
2022-02-04 22:07:31 -05:00
Allan Silva
6a6875012e
wc: implement files0-from option
...
When this option is present, the files argument is not processed. This option processes the file list from provided file, splitting them by the ascii NUL (\0) character. When files0-from is '-', the file list is processed from stdin.
2022-02-04 10:12:08 -03:00
Sylvestre Ledru
572a505119
Merge pull request #3024 from ndd7xv/printf-version-documentation
...
printf: add description and version
2022-02-04 10:45:28 +01:00
Guilherme Augusto de Souza
ae755bb9bd
test: add version and about ( #3011 )
2022-02-04 10:28:15 +01:00
Sylvestre Ledru
033fd62f6a
Merge pull request #3047 from hbina/hbina-touch-better-msg-when-no-args
...
touch: Better error messages when no args is provided
2022-02-04 10:27:01 +01:00
Jeffrey Finkelstein
639971e520
df: refactor function for parsing CLI args
...
Add a `Options::from()` function to collect the code for parsing an
`Options` object from the `clap::ArgMatches` object.
2022-02-03 23:19:14 -05:00
Jeffrey Finkelstein
3fbaa79359
dd: add support for 'b' and 'x' multipliers
...
Support the suffix 'b' (multiply by 512) and 'x' (multiply by an
arbitrary amount) when specifying numeric arguments to dd.
2022-02-03 21:56:13 -05:00
snobee
f7e31f6008
stat: allow formatting of negative numbers
2022-02-03 16:01:19 -08:00
Hanif Ariffin
861437addf
Fix small clippy issue
...
Signed-off-by: Hanif Ariffin <hanif.ariffin.4326@gmail.com>
2022-02-03 21:45:02 +08:00
Hanif Bin Ariffin
3586465917
dont use is_numeric to check for digits
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.43262@gmail.com>
2022-02-03 21:42:22 +08:00
snobee
ee721ebf4e
head: handle multibyte numeric utf-8 chars
2022-02-03 21:42:22 +08:00
Hanif Ariffin
ff8a83b256
touch: Better error message when no args is given
...
Matches the behavior of GNU touch
```shell
hbina@akarin ~/g/uutils (hbina-realpath-absolute-symlinks)> touch > /dev/null
touch: missing file operand
Try 'touch --help' for more information.
hbina@akarin ~/g/uutils (hbina-realpath-absolute-symlinks) [1]> cargo run --quiet -- touch > /dev/null
touch: missing file operand
Try 'touch --help' for more information.
hbina@akarin ~/g/uutils (hbina-realpath-absolute-symlinks) [1]> cargo run --quiet -- touch 2> /dev/null
hbina@akarin ~/g/uutils (hbina-realpath-absolute-symlinks) [1]> touch 2> /dev/null
```
Signed-off-by: Hanif Ariffin <hanif.ariffin.4326@gmail.com>
2022-02-03 21:10:39 +08:00
Sylvestre Ledru
2d3b8db9ed
Merge pull request #3012 from shoriminimoe/2951-truncate
...
truncate: change cli error return code
2022-02-03 10:43:16 +01:00
Eli Youngs
d50c9c3e77
Fail when copying a directory to a file
2022-02-02 23:59:32 -08:00
Sylvestre Ledru
b411d91fac
Merge pull request #3014 from HeroicKatora/main
...
Make true return false less frequently
2022-02-02 21:43:21 +01:00
DevSaab
773ceb5534
Include ABOUT for shuf
2022-02-02 10:08:48 -05:00
Sylvestre Ledru
57231e6543
Merge pull request #3030 from rahulkadukar/hostid-description
...
hostid: added description in documentation
2022-02-02 10:29:26 +01:00
Sylvestre Ledru
64f3cd748d
Merge pull request #2976 from danieleades/lint
...
add additional lints
2022-02-02 09:55:57 +01:00
Rahul Kadukar
7e32b6ba17
Added description for hostid
2022-02-01 23:51:48 -05:00
Nathan
29b613a852
printf: resolve formatting nit in LONGHELP strings
...
Removed 1 preceeding space for LONGHELP_LEAD and 2 preceeding spaces for LONGHELP_BODY
2022-02-01 22:36:10 -05:00
Nathan
f6174dd946
printf: add description and version
...
Adds a version number and brief description to the printf utility in the user documentation
2022-02-01 19:28:39 -05:00
Sam Caldwell
39f8329222
truncate: use map_err
instead of unwrap_or_else
2022-02-01 14:13:52 -07:00
Rishi Kumar Ray
f117fd8dd6
added correct format to ABOUT
2022-02-02 02:40:59 +05:30
Terts Diepraam
87e582b5e0
Merge pull request #2977 from Dr-Emann/echo_octal_nul
...
echo: Allow echo with escapes to work with `\0`
2022-02-01 20:13:53 +01:00
Andreas Molzer
c6d5eccf6c
false,true: Resolve formatting nit in About
2022-02-01 19:53:25 +01:00
Andreas Molzer
23a544c485
false,true: Implement custom help, version
...
This avoids hacking around the short options of these command line
arguments that have been introduced by clap. Additionally, we test and
correctly handle the combination of both version and help. The GNU
binary will ignore both arguments in this case while clap would perform
the first one. A test for this edge case was added.
2022-02-01 14:29:26 +01:00
Andreas Molzer
c1e108933f
false,true: Align behavior of short flags to GNU
2022-02-01 13:02:22 +01:00
Andreas Molzer
dcf177f908
false: Align behavior to true and GNU
2022-02-01 12:04:23 +01:00
Andreas Molzer
b29e219e4d
true: Rework to return true more often
...
Now treats recognized command line options and ignores unrecognized
command line options instead of returning a special exit status for
them.
There is one point of interest, which is related to an implementation
detail in GNU `true`. It may return a non-true exit status (in
particular EXIT_FAIL) if writing the diagnostics of a GNU specific
option fails. For example `true --version > /dev/full` would fail and
have exit status 1.
This behavior was acknowledged in gnu in commit
<9a6a486e6503520fd2581f2d3356b7149f1b225d>. No further
justification provided for keeping this quirk.
POSIX knows no such options, and requires an exit status of 0 in all
cases. We replicate GNU here which is a consistency improvement over the
prior implementation. Adds documentation to clarify the intended
behavior more properly.
2022-02-01 09:13:00 +01:00
Sam Caldwell
e1f7c774d8
Remove redundant import
2022-01-31 22:59:10 -07:00
Sam Caldwell
6f24166c63
[truncate] handle unused_must_use warning
2022-01-31 22:25:59 -07:00
Sam Caldwell
cd1b5c5748
[truncate] change cli error return code
...
Exit with status code 1 for argument parsing errors in `truncate`. When
`clap` encounters an error during argument parsing, it exits with status
code 2. This causes some GNU tests to fail since they expect status code
1.
2022-01-31 22:08:59 -07:00
Narasimha Prasanna HN
1194a8ce53
Fix: Update quick-error crate version from 1.2.3 to 2.0.1 in src/uu/cp ( #2947 )
...
fix: update quick-error crate from 1.2.3 to 2.0.1 for src/uu/cp tool, fixes: #2941
2022-01-31 21:56:47 +01:00
Terts Diepraam
7fc82cd376
Merge pull request #2902 from jtracey/join-non-unicode-sep
...
join: add support for non-unicode field separators
2022-01-31 21:54:56 +01:00
Terts Diepraam
7477761428
Merge pull request #2882 from jtracey/join-bigfields-compat
...
join: "support" field numbers larger than usize::MAX
2022-01-31 21:52:13 +01:00
Daniel Eades
4f8d1c5fcf
add additional lints
2022-01-31 20:40:47 +01:00
Sylvestre Ledru
dfc661e8b5
Merge pull request #2975 from douglaz/sha_update
...
Updated sha libraries
2022-01-31 08:26:49 +01:00
Zachary Dremann
ad4c5d3357
paste: Use a single buffer
2022-01-30 23:01:15 -05:00
Zachary Dremann
85a81d328a
paste: Create vec with capacity
2022-01-30 23:01:11 -05:00
Zachary Dremann
ff14f25c34
paste: Reuse output
allocation
2022-01-30 23:01:05 -05:00
Zachary Dremann
8905d52279
paste: Write to a locked stdout
2022-01-30 23:01:01 -05:00
Zachary Dremann
c6ec4f8f17
paste: Store delimiters as chars, rather than strings
2022-01-30 23:00:56 -05:00
Zachary Dremann
fa44957a63
paste: Handle unicode delimiters
2022-01-30 23:00:49 -05:00
Jeffrey Finkelstein
b9c2066ee9
uucore: move lines.rs to be a uucore feature
...
Refactor the `lines.rs` module to be a feature in `uucore`. It was
common to both `head` and `tail`.
2022-01-30 22:15:35 -05:00
Jeffrey Finkelstein
cba0696b90
head: don't add trailing newline to end of file
...
Prevent `head` from adding a trailing newline to the end of a file
that did not originally have one when using `head --lines=-0`.
2022-01-30 22:04:19 -05:00
Jeffrey Finkelstein
371278e043
truncate: fix typo in docs: "the any" -> "any"
2022-01-30 22:03:13 -05:00
Jeffrey Finkelstein
fe5b537f56
truncate: error when trying to truncate a fifo
...
Terminate the `truncate` program with an error message when trying to
truncate a named pipe (also known as a fifo).
2022-01-30 22:03:12 -05:00
Jeffrey Finkelstein
83eac9c0a8
head: incorporate "all but last" option into Mode
...
Refactor the `Mode` enum in the `head.rs` module so that it includes
not only the mode type---lines or bytes---but also whether to read the
first NUM items of that type or all but the last NUM. Before this
commit, these two pieces of information were stored separately. This
made it difficult to read the code through several function calls and
understand at a glance which strategy was being employed.
2022-01-30 22:01:25 -05:00
Justin Tracey
58d65fb953
join: add support for non-unicode field separators
...
This allows for `-t` to take invalid unicode (but still single-byte) values
on unix-like platforms. Other platforms, which as of the time of this commit
do not support `OsStr::as_bytes()`, could possibly be supported in the future,
but would require design decisions as to what that means.
2022-01-30 20:04:22 -05:00
Zachary Dremann
d6a0b3c920
Allow echo with escapes to work with \0
...
Testing with gecho on macos outputs a nul character for a \0
2022-01-30 17:24:29 -05:00
Terts Diepraam
7b3cfcf708
Merge pull request #2868 from jfinkels/split-filename-iterator
...
split: use iterator to produce filenames
2022-01-30 22:37:37 +01:00
Allan Douglas R. de Oliveira
f22051a4e1
Updated sha libraries
2022-01-30 17:23:02 -03:00
Daniel Eades
41e2197188
squash some repeated match blocks
2022-01-30 18:32:09 +01:00
Sylvestre Ledru
de07df5992
Merge pull request #2963 from danieleades/refactor/code-quality
...
Refactor/code quality
2022-01-30 18:26:16 +01:00
Jeffrey Finkelstein
a5b435da58
split: use iterator to produce filenames
...
Replace the `FilenameFactory` with `FilenameIterator` and calls to
`FilenameFactory::make()` with calls to `FilenameIterator::next()`. We
did not need the fully generality of being able to produce the
filename for an arbitrary chunk index. Instead we need only iterate
over filenames one after another. This allows for a less
mathematically dense algorithm that is easier to understand and
maintain. Furthermore, it can be connected to some familiar concepts
from the representation of numbers as a sequence of digits.
This does not change the behavior of the `split` program, just the
implementation of how filenames are produced.
Co-authored-by: Terts Diepraam <terts.diepraam@gmail.com>
2022-01-30 11:18:58 -05:00
Daniel Eades
ba45fe312a
use 'Self' and derive 'Default' where possible
2022-01-30 15:08:26 +01:00
Daniel Eades
2f85610cc3
remove explicit iter loops
2022-01-30 15:08:26 +01:00
Daniel Eades
cf24620d3d
remove 'let and return'
2022-01-30 15:08:26 +01:00
Daniel Eades
784f2e2ea1
use semicolons if nothing returned
2022-01-30 15:08:26 +01:00
Daniel Eades
a2d5f06be4
remove needless pass by value
2022-01-30 15:08:26 +01:00
Daniel Eades
8bb6c4effa
use pointer args
2022-01-30 14:01:21 +01:00
Daniel Eades
f2074140ec
use 'char' instead of 'str' for single character patterns
2022-01-30 14:01:21 +01:00
Daniel Eades
5af66753af
remove needless borrows
2022-01-30 14:01:21 +01:00
Sylvestre Ledru
2f6f6867c5
Merge branch 'main' into 2940
2022-01-30 13:33:35 +01:00
Sylvestre Ledru
57dc11e586
Merge pull request #2871 from jfinkels/split-settings-methods
...
split: add a method to convert ArgMatches to Settings
2022-01-30 11:31:58 +01:00
Sylvestre Ledru
81b2a240e6
Merge pull request #2960 from water-ghosts/fix-cp-a-panic
...
Don't panic when calling cp -a with a nonexistent file
2022-01-30 11:30:56 +01:00
Sylvestre Ledru
bfa2d8b7da
Merge pull request #2875 from kimono-koans/ls_bad_fd_2
...
ls: Fix display of bad file descriptor errors
2022-01-30 09:59:58 +01:00
Sylvestre Ledru
7c1abdb7d9
Merge pull request #2866 from jfinkels/split-number-2
...
split: implement -n option
2022-01-30 09:58:04 +01:00
Sylvestre Ledru
b8b642101f
Merge pull request #2898 from jfinkels/tail-lines-zero-terminated
...
tail: support zero-terminated lines in streams
2022-01-30 09:44:04 +01:00
Eli Youngs
680e9081fe
Don't panic when calling cp -a with a nonexistent file
2022-01-29 22:59:53 -08:00
Dan Klose
bb7f37e8b4
fix: update itertools 0.8.0 -> 0.10.0
...
Targets https://github.com/uutils/coreutils/issues/2940
* since versions were mxing versions of x.y and x.y.z I changed all to x.y.z
* minor whitespace formatting
2022-01-29 22:35:51 +00:00
Terts Diepraam
eb82015b23
all: change macros
...
- Change the main! proc_macro to a bin! macro_rules macro.
- Reexport uucore_procs from uucore
- Make utils to not import uucore_procs directly
- Remove the `syn` dependency and don't parse proc_macro input (hopefully for faster compile times)
2022-01-29 15:26:32 +01:00
Sylvestre Ledru
1dcd3b2c24
Merge pull request #2943 from jfinkels/truncate-no-such-dir
...
truncate: better error msg when dir does not exist
2022-01-29 12:25:38 +01:00
Sylvestre Ledru
52ab6325a0
Merge pull request #2881 from jtracey/join-null-field-sep
...
join: add support for `-t '\0'`
2022-01-29 10:55:04 +01:00
Sylvestre Ledru
196a7a921c
Merge pull request #2877 from jfinkels/head-use-uucore-error-handling
...
head: use uucore error handling instead of custom
2022-01-29 10:53:48 +01:00
Sylvestre Ledru
24744ca42b
Merge pull request #2911 from jfinkels/dd-seek-stdout
...
dd: support seek=N when destination is stdout
2022-01-29 10:47:17 +01:00
Sylvestre Ledru
57ee6b5302
Merge branch 'main' into truncate-no-such-dir
2022-01-29 09:58:17 +01:00
Sylvestre Ledru
cbc7da3d7d
Merge pull request #2936 from tertsdiepraam/clap-infer-long-args
...
all: enable infer long arguments in clap
2022-01-29 09:57:15 +01:00
Sylvestre Ledru
bd44c59043
Merge pull request #2945 from jfinkels/truncate-reduce-underflow
...
truncate: prevent underflow when reducing size
2022-01-29 09:55:29 +01:00
Sylvestre Ledru
52b7a725ed
Merge pull request #2938 from sylvestre/selinux-dep
...
selinux: add consistency in the dep declaration
2022-01-29 09:46:16 +01:00
Jeffrey Finkelstein
0454d3b243
truncate: prevent underflow when reducing size
...
Prevent usize underflow when reducing the size of a file by more than
its current size. For example, if `f` is a file with 3 bytes, then
truncate -s-5 f
will now set the size of the file to 0 instead of causing a panic.
2022-01-28 22:44:07 -05:00
Jeffrey Finkelstein
c780c96e17
truncate: better error msg when dir does not exist
...
Improve the error message that gets printed when a directory does not
exist. After this commit, the error message is
truncate: cannot open '{file}' for writing: No such file or directory
where `{file}` is the name of a file in a directory that does not
exist.
2022-01-28 21:21:37 -05:00
Terts Diepraam
5f1933a89f
df: no longer override help
2022-01-29 02:06:32 +01:00
Terts Diepraam
9c8e865b55
all: enable infer long arguments in clap
2022-01-29 02:06:29 +01:00
Sylvestre Ledru
96584027e5
selinux: add consistency in the dep declaration
2022-01-29 01:31:17 +01:00
Sylvestre Ledru
f1d72018d7
Merge pull request #2923 from jfinkels/seq-error-zero-increment-value
...
seq: correct error message for zero increment
2022-01-29 01:25:57 +01:00
Sylvestre Ledru
c702154a84
Merge pull request #2934 from jfinkels/truncate-division-by-zero
...
truncate: add a division by zero error
2022-01-29 01:25:10 +01:00
Sylvestre Ledru
fed5ca4ba9
Merge pull request #2935 from tertsdiepraam/wc-unusual-files
...
wc: fix counting files from pseudo-filesystem
2022-01-29 01:09:02 +01:00
Sylvestre Ledru
b94bd96bc6
ignore spelling issue
2022-01-29 00:35:16 +01:00
Sylvestre Ledru
7f79fef2cd
fix various doc warnings
2022-01-29 00:09:09 +01:00
Terts Diepraam
dd311b294b
wc: fix counting files from pseudo-filesystem
2022-01-28 19:08:44 +01:00
electricboogie
72c53219e3
Prevent potential unwrap on a None value
2022-01-27 22:07:07 -06:00