Commit graph

5497 commits

Author SHA1 Message Date
Sylvestre Ledru
91078cfcb3
Merge pull request #2445 from syukronrm/du-inodes
du: add `--inodes`
2021-07-04 11:28:03 +02:00
Sylvestre Ledru
010919a9a9
Merge pull request #2460 from miDeb/completions-errors
coreutils: better errors for invalid args for completions
2021-07-04 11:27:26 +02:00
Sylvestre Ledru
d3652cc3c0
Merge pull request #2457 from Funky185540/install-implement-backup
install: implement --backup, -b and -S
2021-07-04 09:57:45 +02:00
Terts Diepraam
e46ce2947e add usage error 2021-07-02 19:31:16 +02:00
353fc443
23f5f55560
Added UResult for dirname 2021-07-02 12:14:24 +00:00
353fc443
f66f10c4ed
Added UResult for hostid 2021-07-02 12:03:14 +00:00
353fc443
330db2eb3e
Added UResult for hostname 2021-07-02 08:19:33 +00:00
Terts Diepraam
5a40148602
Merge pull request #2463 from miDeb/wrap-help
all utils: enable wrap_help
2021-07-01 13:18:32 +02:00
Terts Diepraam
7a0a7aecc4
Merge pull request #2461 from miDeb/sort/check-no-out
sort: disable -o with -C and -c
2021-07-01 13:07:05 +02:00
Terts Diepraam
6213a2a967
Merge pull request #2462 from miDeb/sort/version
sort/ls: implement version cmp matching GNU spec
2021-07-01 13:02:59 +02:00
Sylvestre Ledru
2020df5dd7
Merge pull request #2469 from deantvv/arch-match-gnu-error
arch: match GNU error
2021-06-30 23:10:28 +02:00
Dean Li
b21e01bcb0
arch: match GNU error
Follow up for #2466 as suggested by @miDeb
2021-06-30 22:32:59 +08:00
Sylvestre Ledru
01f687f09f
Merge pull request #2466 from deantvv/arch-uresult
arch: use UResult
2021-06-29 22:29:19 +02:00
Dean Li
92bfaea3fa
arch: use UResult 2021-06-29 19:48:20 +08:00
Michael Debertol
cd83aed89c test: go into '[' mode when executable ends with [
This makes [ work even when installed with a custom prefix, e.g. as uu-[.
2021-06-29 00:28:01 +02:00
Michael Debertol
97d14893a1 [: install test as [ as well 2021-06-29 00:27:58 +02:00
Sylvestre Ledru
2428a1ccfb
Merge pull request #2355 from tertsdiepraam/improve-error-handling
Improve error handling with `UResult`
2021-06-28 15:46:14 +02:00
Terts Diepraam
0cfaaeceda touch: adapt to standardized error handling 2021-06-28 13:55:55 +02:00
Terts Diepraam
73a7ead857 mktemp: adapt to standardized error handling 2021-06-28 13:55:55 +02:00
Terts Diepraam
8c5052fcb7 mkdir: adapt to standardized error handling 2021-06-28 13:55:37 +02:00
Terts Diepraam
e4eac825fb ls: adapt to standardized error handling 2021-06-28 13:49:57 +02:00
Terts Diepraam
60e4621c3b uucore_procs: add temporary proc macro gen_uumain for standardized error handling 2021-06-28 13:49:56 +02:00
Terts Diepraam
43bfec7170 uucore/error: add macros for standardized error handling 2021-06-28 13:49:45 +02:00
Terts Diepraam
66b1ac019d uucore/error: add standardized error handling (adds UResult & UError) 2021-06-28 13:49:35 +02:00
Syukron Rifail M
27e0507844 du: more tests 2021-06-28 07:51:17 +07:00
Syukron Rifail M
d8a33da5b3 du: add --inodes 2021-06-28 07:51:17 +07:00
Andreas Hartmann
1a43a94e31 install: Apply rustfmt 2021-06-27 17:59:04 +02:00
Michael Debertol
d3732e08c4 sort: disable -o with -C and -c 2021-06-27 16:21:18 +02:00
Michael Debertol
2ebca384c6 all utils: enable wrap_help
This makes clap wrap the help text according to the terminal width,
which improves readability for terminal widths < 120 chars,
because clap defaults to a width of 120 chars without this feature.
2021-06-27 16:17:10 +02:00
Michael Debertol
0dda72eb60 coreutils: better errors for invalid args for completions
Use clap to extract command line arguments. This generates much better
error messages.
2021-06-27 16:07:43 +02:00
Michael Debertol
233a778963 sort/ls: implement version cmp matching GNU spec
This reimplements version_cmp, which is used in sort and ls to sort
according to versions.
However, it is not bug-for-bug identical with GNU's implementation.
I reported a bug with GNU here:
https://lists.gnu.org/archive/html/bug-coreutils/2021-06/msg00045.html
This implementation does not contain the bugs regarding the handling of
file extensions and null bytes.
2021-06-27 15:29:17 +02:00
Andreas Hartmann
69e8838b27 tests: install: Add tests for '--backup'
Tests the '--backup' option for the install utility. Most of the code is
adapted from the respective tests for 'mv'.
2021-06-27 09:55:10 +02:00
Andreas Hartmann
df41fed640 install: Mark '-S', '-b' and '--backup' as implemented
Removes the "unimplemented" notice from the respective help texts. Stop
printing errors if the options are supplied via CLI.
2021-06-27 09:54:55 +02:00
Andreas Hartmann
5437985705 install: Implement '--backup' and '-b'
Adds the ability to perform file backups before installing newer files on top
of existing ones. Adds a status message about backups to stdout if running in
verbose mode.
2021-06-27 09:54:17 +02:00
Andreas Hartmann
49a9f359bb install: Make use of 'backup_controls' for '--backup' opts
Use the methods and types offered by the 'backup_controls' module to implement
the logic for backing up files instead of overwriting.
2021-06-27 09:54:07 +02:00
Hanif Bin Ariffin
4778a64989 ls: Refactored options and other long constants to fix formatting
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>

Keep one of the texts in-place

Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>

Reduced the fix to just formatting changes

Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-06-27 14:55:55 +08:00
Sylvestre Ledru
5fce7ecbaa
Merge pull request #2414 from miDeb/completions2
uutils: implement shell completions
2021-06-26 21:26:23 +02:00
Andreas Hartmann
a85adf3c3f install: Internally rename short '-b' option
Rename from OPT_BACKUP_2 to a more descriptive name "OPT_BACKUP_NO_ARGS".
2021-06-26 00:27:08 +02:00
Andreas Hartmann
3155cd510f install: Fix argument parsing for '--backup'
The '--backup' option would previously accept arguments separated from the
option either by a space or an equals sign. The GNU implementation strictly
requires an "equals" for argument separation.

As the argument to '--backup' is optional, the equals sign mustn't be ommited
as otherwise there is no way to tell a file argument apart from an argument
that's meant for the '--backup' option. This ensures that if '--backup' is
present it either has no further associated arguments (i.e. fallback to the
default), or the arguments are separated by an equals sign.
2021-06-26 00:27:08 +02:00
Andreas Hartmann
211af9a3ea backup_control: Add todo for gnu compliant behavior
The logic behind the file-backup implementation currently doesn't comply 100%
with what the GNU manual [1] describes. Adds a TODO so it isn't forgotten.

[1]: https://www.gnu.org/software/coreutils/manual/html_node/Backup-options.html
2021-06-26 00:27:08 +02:00
Michael Debertol
9b8150d283 uutils: document completions in the readme 2021-06-25 21:23:45 +02:00
Michael Debertol
a87538b77d uutils: uninstall shell completions 2021-06-25 21:23:45 +02:00
Michael Debertol
73cfcc27e7 cp: insert some spaces into the help text 2021-06-25 21:23:45 +02:00
Michael Debertol
2e027bf45d true, false: enable --help and --version 2021-06-25 21:23:45 +02:00
Michael Debertol
0fec449de3 mkfifo: make rustfmt work 2021-06-25 21:23:45 +02:00
Michael Debertol
a8d62b9b23 fmt: fix indentation for help 2021-06-25 21:23:45 +02:00
Michael Debertol
a9e79c72c7 uutils: enable shell completions
This adds a hidden `completion` subcommand to coreutils. When invoked with
`coreutils completion <utility> <shell>` a completion file will be printed
to stdout. When running `make install` those files will be created for all
utilities and copied to the appropriate locations.
`make install` will install completions for zsh, fish and bash; however,
clap also supports generating completions for powershell and elvish.

With this patch all utilities are required to have a publich uu_app function
that returns a clap::App in addition to the uumain function.
2021-06-25 21:23:45 +02:00
Michael Debertol
0531153fa6 uutils: move clap::App creation to separate functions 2021-06-25 21:23:45 +02:00
Sylvestre Ledru
5981351222
Merge pull request #2455 from miDeb/sort/human-numeric
sort: compatibility of human-numeric sort
2021-06-25 21:22:21 +02:00
Michael Debertol
004b5d1b38 format: formatting 2021-06-25 19:35:33 +02:00