Commit graph

2065 commits

Author SHA1 Message Date
Yagiz Degirmenci
6c98415340
fix(head): check the whether file exists before unwrap (#1858)
closes https://github.com/uutils/coreutils/issues/1800
2021-03-21 21:27:44 +01:00
pedrohjordao
ca8fbc37bf
od: Changes command line parser to clap (#1849) 2021-03-21 16:19:30 +01:00
Yagiz Degirmenci
f60790dd41
chroot: move to clap from getopts (#1792)
+ add tests
2021-03-21 16:18:47 +01:00
Terts Diepraam
25d4a08387
ls: long format author, group and owner (#1850)
This PR adds the options to customize what information is shown in long format regarding author, group & owner. Specifically it adds:
- `--author`: shows the author, which is always the same as the owner. GNU has this feature because GNU/Hurd supports a difference between author and owner, but I don't think Rust supports GNU/Hurd, so I just used the owner.
- `-G` & `--no-group`: hide the group information.
- `-o`: hide the group and use long format (equivalent to `-lG`).
- `-g`: hide the owner and use long format.

The `-o` and `-g` options have some interesting behaviour that I had to account for. Some examples:
- `-og` hides both group and owner.
- `-ol` still hides the group. Same behaviour with variations such as `-o --format=long`, `-gl`, `-g --format=long` and `-ogl`.
- They even retain some information when overridden by another format: `-oCl` (or `-o --format=vertical --format=long`) still hides the group.

My previous solution for handling the behaviour where `-l1` shows the long format did not fit with these additions, so I had to rewrite that as well.

The tests only cover the how many names (author, group and owner) are present in the output, so it can't distinguish between, for example, author & group and group & owner.
2021-03-21 16:18:06 +01:00
Sylvestre Ledru
45acb087b8
Merge pull request #1848 from nomius10/install_bugfix
install: fix bug #1823
2021-03-20 20:53:57 +01:00
Neculai Balaban
f8125a1040 install: match GNU warning output 2021-03-20 16:11:29 +02:00
Neculai Balaban
0f7423dfa6 install: fix bug #1823 2021-03-20 14:49:22 +02:00
nicoo
8b9ac0c7c3
Revert #1571 “perf/factor ~ deduplicate divisors” (#1842)
It was a draft PR, not ready for merging, and its premature inclusion
caused repeated issues, see 368f47381b & friends.

Close #1841.

This reverts commits 3743a3e1e7,
                     ce218e01b6, and
                     b7b0c76b8e.
2021-03-20 11:46:58 +01:00
Alex Lyon
e9adc5067b
cksum: generate CRC table in a const fn (#1744) 2021-03-20 10:33:04 +01:00
Jan Scheer
0e217e202a
tee: move from getopts to clap (#1814) 2021-03-19 22:58:50 +01:00
Sylvestre Ledru
e76ce1e908
Merge pull request #1844 from tertsdiepraam/ls/si
ls: --si flag and more compatible size formatting
2021-03-19 21:18:25 +01:00
Neculai Balaban
c6927d97c8
cp: add support for -x/--one-file-system (#1840) 2021-03-19 21:15:35 +01:00
Terts Diepraam
118b802fe8 ls: --si and more compatible size formatting 2021-03-19 15:14:25 +01:00
Sylvestre Ledru
976fa95ce8 fix(ls): fix a clippy warning
"this `if` has identical blocks"
2021-03-19 14:25:07 +01:00
Sylvestre Ledru
e521b46c09
Merge pull request #1820 from tertsdiepraam/master
ls: move from getopts to clap and structure configuration
2021-03-19 09:55:27 +01:00
Marco Satti
5ec87dc70a
date: Implement setting the date on Unix & Windows (#1798)
* date: implement set date for unix and windows

Parsing the date string is not fully implemented yet, as in it relies
on the internals of chrono - things like "Mon, 14 Aug 2006 02:34:56 -0600"
do not work, nor does "2006-08-14 02:34:56" (no TZ / local time). This
is no different to using the "--date" option however, and will get fixed
when `parse_date` is a bit smarter.

Only supports unix and Windows platforms for now.
2021-03-19 09:54:01 +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
Jan Scheer
58b9372dbe rm: fix for -d to match GNU's output #1769 2021-03-18 14:46:56 +01:00
Sylvestre Ledru
22e22bc074
Merge pull request #1835 from aspenluxxxy/update-nix
Update nix to 0.13 in uu_more
2021-03-18 14:37:54 +01:00
aspen
4e29b693f8
uutils: change every target_os = "macos" to target_vendor = "apple" 2021-03-18 08:42:53 -04:00
aspen
ed7e24c5b0
uu_more: update nix to 0.13 2021-03-18 08:39:06 -04:00
Sylvestre Ledru
99be7a3172
Merge pull request #1810 from jeckersb/nice-clap
nice: move from getopts to clap #1794
2021-03-17 22:03:42 +01:00
Sylvestre Ledru
44a7adc9a0
Merge pull request #1812 from konomith/feature/preserve_timestamps_#1758
install: Implement --preserve-timestamps (-p)
2021-03-17 22:02:54 +01:00
Sylvestre Ledru
a690ffde41
Merge pull request #1821 from deantvv/expand-clap
expand: replace getopts with clap
2021-03-17 22:01:31 +01:00
Sylvestre Ledru
6a109a5069
Merge pull request #1834 from jhscheer/patch-3
rm: add an additional flag -R for --recursive
2021-03-17 21:52:02 +01:00
Sylvestre Ledru
ba55ef166e
Merge pull request #1827 from drocco007/numfmt-delimiter
numfmt: implement --delimiter
2021-03-17 21:50:47 +01:00
Jan Scheer
d9adec3496
add comment 2021-03-17 14:46:25 +01:00
nicoo
955fa74a42
factor::tests: Check that powers of known-factorization numbers are factored correctly (#1831)
* factor::tests::recombines_factors: Minor refactor (skip useless bool)

* factor::tests: Check factorizations of powers of factored numbers

* factor::Factors: Add debug assertions to (Factor ^ Exponent)

* factor::tests: Drop obsoleted tests

`factor_correctly_recombines_prior_test_failures` was replaced with
`factor_2044854919485649` as this was the only test not subsumed.

* factor::tests::2044854919485649: Check the expected factorisation
2021-03-17 13:58:53 +01:00
John Eckersberg
64b8c8aac7 nice: move from getopts to clap #1794 2021-03-17 08:52:13 -04:00
Daniel Rocco
fbb9c50050 tr: process octal escape sequences
closes #1817
2021-03-17 08:04:45 -04:00
Jan Scheer
97f40b0aee
rm: add an additional flag -R for --recursive
make clap support -R in addition to -r
2021-03-17 10:16:31 +01:00
Peter Sherman
e3e5bf0178
Format head.rs 2021-03-15 20:48:49 +00:00
Peter Sherman
13e61c3234 head: add support for -z/--zero-terminated 2021-03-15 15:56:11 +00:00
Daniel Rocco
52f2ab6898 numfmt: implement --delimiter
closes #1454
2021-03-15 11:55:56 -04:00
Daniel Rocco
02e9ffecdd numfmt: split implementation into modules 2021-03-15 11:55:17 -04:00
Hari
406cd865eb
install: run rustfmt
Fix formatting issues based on PR review comments
2021-03-15 11:00:30 -04:00
Dean Li
cd775ed704 Expand: use mod::options 2021-03-15 21:28:47 +08: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
Terts Diepraam
10135dccef ls: fix unused import and improve coverage 2021-03-15 13:46:21 +01:00
Terts Diepraam
20094127c3 ls: --color back on windows as noop 2021-03-15 12:21:08 +01:00
Terts Diepraam
f28d5f4a73 ls: attempt to fix windows sorting issues 2021-03-15 12:07:10 +01:00
Terts Diepraam
a4c79c92ae ls: fix windows issues 2021-03-15 10:24:24 +01:00
Terts Diepraam
01fd207c81 ls: remove list of missing features 2021-03-15 09:53:19 +01:00
Terts Diepraam
5656a717c9 ls: make name sort case insensitive 2021-03-15 09:31:13 +01:00
Terts Diepraam
61a95239ce ls: rename display to format, set arg overrides 2021-03-15 09:30:50 +01:00
Terts Diepraam
7bde2e78a9 ls: simplify --color and remove it on windows 2021-03-14 23:34:52 +01:00
Terts Diepraam
c86c18cbb5 ls: implement -c and -u 2021-03-14 23:11:11 +01:00
Terts Diepraam
c454d2640c ls: structure options some more 2021-03-14 21:32:21 +01:00
Terts Diepraam
5d7a851471 ls: fix --color behaviour 2021-03-14 21:30:21 +01:00
Sylvestre Ledru
10d55c5696
Merge pull request #1796 from ttrunck/fix-busytest
Fix `make busytest`
2021-03-14 20:58:05 +01:00
Dean Li
6829e7f359 expand: replace getopts with clap
expand has one odd behavior that allows two format for tabstop

From expand --help
```
-t, --tabs=N     have tabs N characters apart, not 8
-t, --tabs=LIST  use comma separated list of tab positions
```

This patch use one `value_name("N, LIST")` for tabstop and
deal with above behavior in `parse_tabstop`.

Close #1795
2021-03-14 20:47:53 +08:00
Terts Diepraam
0717a5f301 ls: formatting 2021-03-14 13:32:15 +01:00
Terts Diepraam
8df239a4e2 Merge branch 'master' of github.com:tertsdiepraam/coreutils 2021-03-14 12:22:38 +01:00
Terts Diepraam
7c8e8b2d4c ls: refactor arguments into a config struct 2021-03-14 12:22:32 +01:00
Terts Diepraam
225c1be28d
Merge pull request #1 from uutils/master
Sync
2021-03-13 23:52:42 +01:00
Terts Diepraam
9e98d24f5f ls: move from getopts to clap 2021-03-13 23:43:36 +01:00
Andre Julius
2158b2c5b4
sleep: move from getopts to clap #1735 (#1777)
and Add some sleep test cases #1735
2021-03-13 23:11:11 +01:00
Terts Diepraam
fd5ec099d0
touch: use an ArgGroup for sources and turn macros into functions (#1813)
* touch: use arggroup for sources

* tests/touch: add tests for multiple sources

* touch: turn macros into functions

* test/touch: fmt

* touch: constant for the sources ArgGroup
2021-03-13 17:20:39 +01:00
Terts Diepraam
44c390c290 touch: constant for the sources ArgGroup 2021-03-13 13:52:08 +01:00
Terts Diepraam
86422a70d2 touch: turn macros into functions 2021-03-13 12:47:20 +01:00
Terts Diepraam
5ec1bba5e8 touch: use arggroup for sources 2021-03-13 12:42:52 +01:00
Hari
8471088d6d
Merge branch 'master' of github.com:uutils/coreutils into feature/preserve_timestamps_#1758 2021-03-12 17:47:02 -05:00
Hari
68ec2ed0f3
install: Implement --preserve-timestamps (-p)
Last access and last modify timestamps are extracted from the
existing file metadata and are applied to the newly created file.
2021-03-12 16:51:47 -05:00
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
Ali
5ced3a670b
paste: cleanup multi-stdin support (#1803)
cleaner impl for multi-stdin support
2021-03-12 13:26:09 +01:00
Craig Pastro
3ab114f283
cp: Implement --parents & --parent (#1797) 2021-03-12 13:25:15 +01:00
Theophile Trunck
8bafcbab7a Update the binary usage to match busybox
New tests in busybox are based on the fact that the function
appears in the usage of the busybox binary.
Because the tests are searching for an exact string they don't see
the function defined by coreutils.
By using the exact same string as busybox we can now also run the new
busybox tests
2021-03-10 23:52:33 +01:00
Ali
374a4fde86
paste: support multi-stdin (#1791)
- added `-` as the default input, since `paste` reads stdin if no file
is provided
- `paste` also supports providing `-` multiple times
- added a test for it
2021-03-10 23:19:12 +01:00
Mikadore
734ef0a8a1
uniq: fixed #550 (#1790) 2021-03-10 21:54:31 +01:00
John Eckersberg
08eb56f120 Fix some clippy warnings 2021-03-10 08:42:00 -05:00
Sylvestre Ledru
517b2a6a22
Merge pull request #1767 from FelipeLema/mod_opt
Group OPT_ARGUMENTS into mods
2021-03-09 22:57:30 +01:00
Sylvestre Ledru
955b7ee6d5
Merge pull request #1785 from ali5h/paste-clap
paste: move from getopts to clap
2021-03-09 22:52:16 +01:00
Felipe Lema
d1addc97cc missing OPT_ s 2021-03-09 18:10:04 -03:00
Ali Shariat
54eebebff8 paste: move from getopts to clap
closes #1734
2021-03-09 12:46:27 -08:00
Sylvestre Ledru
a96ca1359e
Merge pull request #1772 from foxbenjaminfox/master
cp: implement --strip-trailing-slashes
2021-03-09 20:10:06 +01:00
Edward Betts
e1a9c19b6f Correct spelling 2021-03-09 15:19:35 +00:00
Benjamin Fox
5446ea2abf cp: implement --strip-trailing-slashes 2021-03-09 12:59:26 +02:00
Daniel Rocco
0e02607dc7 numfmt: implement --field 2021-03-08 10:53:34 -05:00
Felipe Lema
75b3bc02eb uniq 2021-03-08 12:02:46 -03:00
Felipe Lema
3e0a10d732 update wc 2021-03-08 11:50:26 -03:00
Sylvestre Ledru
6ad8528b99 update of the uucore dep to 0.0.7 2021-03-07 11:29:38 +01:00
Sylvestre Ledru
8772d81236 Update to platform-info 0.1 2021-03-07 11:29:38 +01:00
Sylvestre Ledru
6481c5a247 Prepare version 0.0.4 2021-03-07 11:29:38 +01:00
Chad Brewbaker
c820329efd
muted test not for windows and added windows temp file convention (#1748)
* muted test not for windows and added windows temp file convention

* Update mktemp.rs

Revert windows mktmp template difference

Co-authored-by: Chad Brewbaker <chad@flyingdogsolutions.com>
2021-03-06 18:26:55 +01: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
Felipe Lema
e4d9d1868a remove markers
this can be improved in the future. this branch is just the kick-off
2021-03-04 15:38:01 -03:00
Felipe Lema
975e9ea565 separate options into modules for chown 2021-03-04 15:37:27 -03:00
Sylvestre Ledru
c06967a45a rustfmt two files 2021-02-23 20:56:41 +01:00
Alex Lyon
5935876f38
od: remove Vec::set_len() usage in InputDecoder (#1739) 2021-02-23 12:35:17 +01:00
Alex Lyon
7341a1a033
shred: remove usage of Vec::set_len() (#1738)
* shred: use a fixed-size array for BytesGenerator
2021-02-23 12:34:49 +01:00
Chad Brewbaker
bb54669a5d
Fix macOS aarch64 compile errors (#1724) 2021-02-23 10:25:06 +01:00
Alex Lyon
5431e947bc
uucore: process: fix exit status processing (#1743)
* uucore: process: fix exit status processing

* tests: timeout: check whether subcommand exit codes are returned
2021-02-23 10:21:01 +01:00
Alex Lyon
7e5d9ee32d
factor, stdbuf, timeout, uname, uptime: update dependencies (#1746) 2021-02-22 15:07:51 +01:00
Alex Lyon
c8977a78a4
uucore: fix potential use-after-free in utmpx iterator (#1737) 2021-02-19 08:38:57 +01:00
Alex Lyon
15eaaa9473
Merge pull request #1731 from jaggededgedjustice/seq-check-for-zero-step
Do not allow seq to run with an increment of zero
2021-02-18 18:28:35 -08:00
James Robson
0dbed0fd59 Do not allow seq to run with an increment of zero 2021-02-18 21:10:53 +00:00
Sylvestre Ledru
4bdd7a5e42 trivial(truncate): remove old comments 2021-02-18 22:05:11 +01:00
Alex Lyon
39d62c6c1f
od: remove potential unsoundness and an allocation in PartialReader (#1730) 2021-02-18 08:23:13 +01:00
Daniel Rocco
e2b58051e6
yes: correct a typo (#1727)
Improve readability by fixing an inadvertent rename during a performance
enhancement (b46e228).
2021-02-16 23:40:23 +01:00
Daniel Rocco
f595164063 numfmt: prohibit --header=0 to align with GNU
Adjust header option handling to prohibit passing a value of 0 to align
with GNU numfmt. Also report header option parse errors as GNU does.

closes #1708
2021-02-15 08:14:44 +01:00
Daniel Rocco
f8006f47df
numfmt: handle leading whitespace & implied padding (#1721)
Align with GNU numfmt by trimming leading whitespace from supplied values.
If the user did not specify a padding, calculate an implied padding from
the leading whitespace and the value.

Also track closer to GNU numfmt’s error message format.
2021-02-14 09:04:29 +01:00
Sylvestre Ledru
bd6b958655 Moved to atty 2021-02-12 11:37:32 +01:00
Kevin Burke
26aa1f346e ls: only print colors if stdout is a tty
Previously if no --color argument was input, we would always print
colors in the output. This breaks `configure` scripts which run `ls`
and then compare the output against what they expect to see, since the
left side has ANSI escape sequences and the right side doesn't.

Instead, only print escape sequences if a TTY is present, or if
`--color=always` is specified.

Fixes #1638.
2021-02-12 11:37:32 +01:00
Daniel Rocco
9081e120d6
numfmt: replace getopts with clap (#1717) 2021-02-11 23:58:26 +01:00
Felipe Lema
35a7f01d15
Refactor(split) - migrate from getopts to clap (#1712) 2021-02-11 20:45:23 +01:00
Sylvestre Ledru
51383e10e6
Fix: install /dev/null target (#1646)
* fix(install): workaround the /dev/null bug

Caused by a limitation of fs::copy in rust. see:
https://github.com/rust-lang/rust/issues/79390
2021-02-11 15:59:58 +01:00
Sylvestre Ledru
6c8af26e7f
fix(cp) - make "cp /dev/null target" work (#1674) 2021-02-11 15:59:20 +01:00
Sylvestre Ledru
b8987f3d5f
fix(mktemp) - Make mktemp --tempdir foo.XXXXXX works (#1716)
Used by apt-key
2021-02-11 00:03:23 +01:00
Chad Brewbaker
6c2bca110d
Fixed wc -L no end of line LF bug (#1714) 2021-02-08 21:54:48 +01:00
Sylvestre Ledru
beda329a21 Fix some clippy warnings 2021-02-07 15:12:15 +01:00
Sylvestre Ledru
2bb9a85dde bug(tee) - needs libc from uucore 2021-02-02 09:23:01 +01:00
Sylvestre Ledru
858ea108ce bug(ln) - needs fs from uucore too 2021-02-02 00:18:46 +01:00
Sylvestre Ledru
d7a6bfa76c bug(install) - needs entries from uucore too 2021-02-02 00:09:25 +01:00
Sylvestre Ledru
262b508b89 update the dep to uucore 0.0.6 2021-02-01 23:55:43 +01:00
Sylvestre Ledru
87428b9c32 update uucore to 0.0.6 2021-02-01 23:53:17 +01:00
Sylvestre Ledru
f0b302d716 refactor(fmt) move to clap 2021-01-25 21:48:52 +01:00
Sylvestre Ledru
cacaf0cde8 bug(fmt): just like the GNU version, fails when -W is bigger than 2500
Closes: #1704
2021-01-25 08:45:33 +01:00
Sylvestre Ledru
992c113f09 Remove some old code 2021-01-22 09:40:38 +01:00
Sylvestre Ledru
a807fc623a Update to version 0.0.3 2021-01-22 09:40:38 +01:00
nicoo
ea20b22d12 factor::numeric::gcd: Refactor divisor test
Should be clearer; does not handle the `gcd(0, 0)` case, which is already
covered by the `zero` test.
2021-01-21 15:28:28 +01:00
nicoo
42b048d316
factor: Get rid of the custom OverflowingAdd trait (#1697)
* factor: Confine knowledge of num_traits to numeric::traits

This should make it easier to deal with API changes of num_traits,
or eventually switching to an abstraction provided in the stdlib.
2021-01-21 15:27:22 +01:00
Sylvestre Ledru
9f7259b986 refactor(realpath): move to clap 2021-01-19 20:56:27 +01:00
Sylvestre Ledru
e331186fee
unbreak build with rustc 1.32: force tempfile 3.1.0 (#1695) 2021-01-19 08:15:53 +01:00
Sylvestre Ledru
013bb285cd
bug(chmod): chmod on symlink pointing to non existing file is failing (#1694) 2021-01-18 23:09:00 +01:00
Felipe Lema
88911be6e0
--filter argument for split (#1681) 2021-01-18 14:42:44 +01:00
Gaurang Tandon
ac7cac2910
tail: moving to clap from getopt (#1689) 2021-01-12 17:44:11 +01:00
Sylvestre Ledru
04b92f3e94
Replaces failure by thiserror. (#1688)
Failure isn't maintained anymore:
https://github.com/rust-lang-nursery/failure/pull/347
https://rustsec.org/advisories/RUSTSEC-2020-0036.html
2021-01-11 22:01:14 +01:00
Sylvestre Ledru
b8e886ad1a bump the minimal version of uucore & uucore_procs 2021-01-10 18:27:20 +01:00
Sylvestre Ledru
57e24c9118 also update uucore & uucore_procs versions to 0.0.5 2021-01-10 18:24:43 +01:00
Sylvestre Ledru
d9ae043a05
update of the version 0.0.1 => 0.0.2 (#1686) 2021-01-10 18:16:04 +01:00
Sylvestre Ledru
d9580c2f3a
ls: move from isatty (deprecated) to atty (#1685) 2021-01-09 21:21:02 +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
Sylvestre Ledru
4a23a1a218 feature(ln): Implement -n 2021-01-03 18:55:53 +01:00
Sylvestre Ledru
7f1d47b77a refactor(ln): move to clap 2021-01-02 22:35:21 +01:00
Sylvestre Ledru
105e2cb26f feature(mktemp): implement -t
Deprecated but used in various places:
https://sources.debian.org/src/libreoffice/1:7.0.4-1/solenv/gbuild/platform/solaris.mk/?hl=22#L22
https://sources.debian.org/src/glibc/2.31-6/malloc/memusage.sh/?hl=225#L225
https://sources.debian.org/src/sbox-dtc/1.11.7-1/debian/postinst/?hl=20#L20
2021-01-02 13:07:27 +01:00
Sylvestre Ledru
66b503a77e refactor(mktemp): move to clap 2021-01-02 09:40:40 +01:00
Sylvestre Ledru
7942a64231 Remove 'extern crate'
Not necessary anymore. See:
https://doc.rust-lang.org/edition-guide/rust-2018/module-system/path-clarity.html#no-more-extern-crate
2020-12-31 15:44:00 +01:00
Sylvestre Ledru
bc4c82b132 Fix some clippy warnings 2020-12-29 00:47:59 +01:00
Sylvestre Ledru
7955d346a8 csplit - rustfmt 2020-12-28 17:22:46 +01:00
Sylvestre Ledru
3a1eb1e05f Various fixes before landing csplit 2020-12-28 17:22:02 +01:00
Stéphane Campinas
89bf7a726e csplit: refresh of the previous PR 2020-12-28 17:21:29 +01:00
Kevin Burke
10cd480a01
rm: allow "-f" to be specified multiple times (#1667)
This matches the behavior of GNU rm.

Fixes #1663.

Co-authored-by: Kevin Burke <kevin@burke.dev>
2020-12-25 12:41:48 +01:00
Sylvestre Ledru
36d903e611
number-prefix: Move from 0.2 to 0.4 (#1670) 2020-12-22 13:53:20 +01:00
Diego Magdaleno
8b12686888
ls: On Windows don't display files hidden by NTFS (#1662)
This little check, allows us to hide the files that
shouldn't be shown on the listing on Windows operating
systems.

Just like the "dot" in UNIX based operating systems
Windows uses its own file attributes to determine if a file
is hidden or not.

The lack of support for this option is normally an annoyance
for many users, this commit adds full support for this feature
2020-12-19 17:54:28 +01:00
Sylvestre Ledru
469abf2427 bug(seq) - Allow 'seq 6 -1 0'
Was failing with
```
Found argument '-1' which wasn't expected, or isn't valid in this context
```
otherwise
2020-12-19 11:55:43 +01:00
Sylvestre Ledru
dbc716546b fix(mkdir) - Add --parent as alias of --parents
It is used this way sometimes:
https://sources.debian.org/src/php-symfony-polyfill/1.21.0-2/debian/rules/?hl=49#L49
https://sources.debian.org/src/firebird3.0/3.0.7.33374.ds4-1/debian/functions.sh/?hl=24#L24
https://sources.debian.org/src/postfix/3.5.6-1/debian/configure-instance.sh/?hl=67#L67
2020-12-18 14:41:59 +01:00
Sylvestre Ledru
718695d541 fix(install) - Install was failing with '-m 0333'
The parse_numeric was getting ' 0333' as input
and showing 'mode is too large ( 0333 > 7777) as error

Syntax used: https://sources.debian.org/src/firebird3.0/3.0.7.33374.ds4-1/debian/functions.sh/?hl=145#L145
2020-12-18 13:36:55 +01:00
Sylvestre Ledru
c506b5402b fix clippy warnings 2020-12-17 21:34:10 +01:00
Sylvestre Ledru
5a62dcafaa bug(cp): like gnu/cp, don't show any message when --no-clobber is used
Simple example:
touch bar
rm -rf /tmp/foo
mkdir -p /tmp/foo
cp -pnL -v bar /tmp/foo
echo $?
cp -pnL -v bar /tmp/foo
echo $?

rm -rf /tmp/foo
mkdir -p /tmp/foo
./target/debug/coreutils cp -pnL -v bar /tmp/foo
echo $?
./target/debug/coreutils cp -pnL bar /tmp/foo
echo $?
2020-12-17 20:50:38 +01:00
Sylvestre Ledru
1e9820a7c4
Merge pull request #1659 from sylvestre/base-non-utf8
base32/base64: tolerate non-utf8 encoded inputs
2020-12-16 08:46:48 +01:00
Gabriel Ganne
607b70a896 base32/base64: tolerate non-utf8 encoded inputs
For inputs that are valid base64 but that encode non-utf8 strings (like
garbage), base64 panicks when trying to unwrap the result from
String::from_utf8().
Instead of interpreting the byte stream as utf8, simply dump the raw
bytes to stdout.

Since the test assert that all io is valid utf8, this does not come with
a unit test. See run() in tests/common/utils.rs.

Eg.
"gD63hSj3ScS+wuOeGrubXlq35N1c5Lby/S+T7MNTjxo=" -> ">(Iľ^Z\/S"
2020-12-16 00:14:18 +01:00
Hiroki Noda
2916e8d811 tee: implement ignore-interrupts option 2020-12-15 23:50:43 +01:00
Sylvestre Ledru
d9cf0374be fix(sync) - Remove 'unused import' on mac 2020-12-13 18:02:33 +01:00
Sylvestre Ledru
ba126afe54 fix(ls): follow the display of GNU ls 2020-12-13 12:12:19 +01:00
Sylvestre Ledru
8a1628cf89 fix(ls): When a file doesn't exist, exit early and fails ls
Currently, running
$ ls doesntexist
will return 0
while it should return 1

Ditto for
$ ls doesntexist a
2020-12-13 12:12:19 +01:00
Sylvestre Ledru
f287309b72 perms: add some docs 2020-12-12 14:43:56 +01:00
Sylvestre Ledru
dca1f28085 install: various improvements in output & tests 2020-12-12 14:36:23 +01:00
Sylvestre Ledru
3024ade071 refactor(chgrp, install): Show the error in the program instead of the lib 2020-12-12 14:28:50 +01:00
Sylvestre Ledru
55c660b986 feature(install): move chown functions into uucore and have install owner support use it 2020-12-12 14:27:59 +01:00
Sylvestre Ledru
015e18731f feature(install): install group support 2020-12-12 14:27:03 +01:00
Sylvestre Ledru
763de90fda refactor(chgrp): move chgrp perms function into the uucore to reuse it into install
Will move chown later
2020-12-12 14:26:32 +01:00
Sylvestre Ledru
431a4e9f2f cosmetic: consistency in the clap cargo declaration 2020-12-12 13:12:13 +01:00
Sylvestre Ledru
e19010e9fe cosmetic: consistency in the walkdir cargo declaration 2020-12-12 13:10:57 +01:00
Sylvestre Ledru
d8e345df0a
refactor(whoami): only use advapi32/winapi on Windows (#1653) 2020-12-12 11:04:39 +01:00
Sylvestre Ledru
576aa29f0f
refactor(chmod): move from walker to walkdir, simplify the code and add tests (#1645) 2020-12-12 10:31:12 +01:00
Sylvestre Ledru
49b32ea68d
refactor(chown): move to clap & add tests (#1648) 2020-12-12 00:14:00 +01:00
Sylvestre Ledru
068fee2ebd
feature(uname): Implement -p & -i (#1649)
Just return 'unknown' for both

Closes: #1636
2020-12-11 22:46:36 +01:00
Sylvestre Ledru
516839e081
refactor(mv): move to clap (#1652) 2020-12-10 22:28:17 +01:00
Piyush Jaipuriayar
3ca8ba997c
hashsum: added blake2 as a hashing algorithm (#1651) 2020-12-08 23:32:02 +01:00
Sylvestre Ledru
d21acc4621
cosmetic(cp): use the variable instead of the string 2020-12-08 23:19:51 +01:00
Sylvestre Ledru
0cfb83a040
Merge pull request #1580 from sylvestre/archive3
feature(cp): implement archive & -L
2020-12-06 17:15:56 +01:00
Sylvestre Ledru
5f47d1249d use the same version of clap everywhere 2020-12-01 22:59:14 +01:00
Sylvestre Ledru
c483fa501b feature(cp): also implement --dereference/-L 2020-11-29 20:48:29 +01:00
Sylvestre Ledru
f76a0ec972 feature(cp): implement archive + add missing tests 2020-11-29 20:48:23 +01:00
Sylvestre Ledru
b07f496b70 fix(install): 'install file_a file_b' should just copy the file 2020-11-29 16:33:46 +01:00
Sylvestre Ledru
261b4e24d6 feature(install): remove a duplicate check.
Already done in is_new_file_path
2020-11-29 16:33:46 +01:00
Sylvestre Ledru
11ecf80a25
feature(sync): add --data & --file-system (#1639) 2020-11-29 16:32:21 +01:00
Sylvestre Ledru
89f8624936
bug(install) - install -d can be run on an existing directory (#1643)
GNU:
$ install -d foo
$ install -d foo

Rust:
$ install -d foo
$ install -d foo
install: cannot create directory 'foo': File exists
install: foo: File exists (os error 17)
2020-11-29 16:31:26 +01:00
Sylvestre Ledru
8ef7f394c1
address some new clippy warnings (#1642) 2020-11-29 16:26:38 +01:00
Sylvestre Ledru
adc9b12f32 install: fix a typo 2020-11-25 13:09:28 +01:00
Sylvestre Ledru
bfba889f8e
refactor(touch): Move to clap + add a test (#1629) 2020-11-21 09:53:13 +01:00
Sylvestre Ledru
5efaa0bf32
refactor(id) - move to clap and add more tests (#1628) 2020-11-21 09:52:50 +01:00
Sylvestre Ledru
41ba5ed913
refactor(uniq): Move to clap + add a test (#1626) 2020-11-21 09:52:40 +01:00
Sylvestre Ledru
7bbb4c98e8
Merge pull request #1623 from sylvestre/clap-pwd
refactor(pwd): move to clap + add a test
2020-11-21 00:49:30 +01:00
Sylvestre Ledru
6870d81b33
Merge pull request #1631 from sylvestre/clap-version
Remove version mgmt, it is done by clap
2020-11-20 10:02:33 +01:00
Sylvestre Ledru
6fc4129daf
Merge pull request #1624 from sylvestre/uptime-refresh
refactor(uptime): some minor improvements
2020-11-20 10:02:13 +01:00
Sylvestre Ledru
641aba5bd7 maint/hostname: Fix a clippy warning 'single_char_push_str' 2020-11-19 23:16:31 +01:00
Sylvestre Ledru
8271faf3a2
Merge branch 'master' into clap-pwd 2020-11-19 22:32:02 +01:00
Sylvestre Ledru
252f527b55
Merge branch 'master' into uptime-refresh 2020-11-19 22:30:33 +01:00
Sylvestre Ledru
62265656b4
Merge pull request #1630 from sylvestre/clap-mkdir
refactor(mkdir): Move to clap + add a test
2020-11-17 13:01:09 +01:00
Sylvestre Ledru
5eaab5327c
Merge pull request #1632 from sylvestre/clap-rm
refactor(rm): Move to clap + add a test
2020-11-17 13:00:35 +01:00
Sylvestre Ledru
eada6e58e5
Merge pull request #1637 from sylvestre/clap-install
refactor(install): move to clap
2020-11-17 13:00:04 +01:00
Sylvestre Ledru
27d5256cb6
Use the correct syntax to define the mode 2020-11-16 22:02:06 +01:00
Sylvestre Ledru
55221a18b4
change order + remove useless import 2020-11-15 22:53:49 +01:00
Sylvestre Ledru
f55d8a22ec
remove useless mut
Co-authored-by: Roy Ivy III <rivy.dev@gmail.com>
2020-11-15 22:49:26 +01:00
Sylvestre Ledru
5718af023b
use the OPT_VERBOSE
Co-authored-by: Roy Ivy III <rivy.dev@gmail.com>
2020-11-15 22:49:01 +01:00
Sylvestre Ledru
4fec824421
change the position of the TODO
Co-authored-by: Roy Ivy III <rivy.dev@gmail.com>
2020-11-15 22:48:39 +01:00
Sylvestre Ledru
d268bda28e
Merge pull request #1635 from sylvestre/clap-sync
refactor(sync): Move to clap + add tests
2020-11-15 22:40:46 +01:00
Sylvestre Ledru
2edfe32c48 refactor(install): move to clap 2020-11-13 18:21:56 +01:00