Commit graph

61 commits

Author SHA1 Message Date
Anup Mahindre
7d2b051866
Implement Total size feature (#2170)
* ls: Implement total size feature

- Implement total size reporting that was missing
- Fix minor formatting / readability nits

* tests: Add tests for ls total sizes feature

* ls: Fix MSRV build errors due to unsupported attributes for if blocks

* ls: Add windows support for total sizes feature

- Add windows support (defaults to file size as block sizes related
infromation is not avialable on windows)
- Renamed some functions
2021-05-05 23:03:25 +02:00
Sylvestre Ledru
f8ec4a554c
Merge pull request #2161 from tertsdiepraam/ls/sort_order_and_subdirectory_listing
`ls`: C sort order and fix subdirectory listing
2021-05-02 17:21:56 +02:00
Terts Diepraam
fba245b176 ls: add -1 to tests to separate names with \n on windows 2021-05-02 14:26:23 +02:00
Terts Diepraam
361408cbe5 ls: remove case-insensitivity and leading period of name sort 2021-05-02 10:04:11 +02:00
Terts Diepraam
28c7800f73 ls: fix subdirectory name 2021-05-02 10:03:01 +02:00
Terts Diepraam
11f387dc93 ls: fix style test 2021-05-01 17:29:00 +02:00
Sylvestre Ledru
308bdd7fc9
ignore test_ls_order_birthtime too 2021-05-01 15:55:58 +02:00
Sylvestre Ledru
e1cc434c24
ignore the test_ls_styles 2021-05-01 15:27:54 +02:00
Terts Diepraam
d300895d28 ls: add birth time for windows and attampt to fix test 2021-04-29 22:23:04 +02:00
Rein F
a60fd07bc3
ls: improvements on time handling (#1986)
* ls: added creation time

* ls: Added most time features

Missing support for posix-,Format+, translating via locales. Also required more tests

* ls: rustfmt

* ls: Additional changes and fixes

Fixed the argument order, fixed a wrong iso format.

* ls: additional tests for styles

* ls: perfected arg parsing on time styles

* fix birthime test

* ls: Use 'stdout_str' in new tests

* ls: Disabled birthtime test for windows

* ls: removed indoc as a dependency

* ls: birthime test, sync first created file

* ls: birthime test, add comment explaining sync

* Removed ruby testfile birth_test.rb

This accidentally got commited in a merge
2021-04-28 20:54:27 +02:00
Terts Diepraam
a0eb4a0283 ls: add test for color grid alignment 2021-04-26 14:42:42 +02:00
Sylvestre Ledru
7dcc8c2960
Merge pull request #1968 from alstolten/feat2
ls: Implements extension sorting
2021-04-26 09:03:06 +02:00
Sylvestre Ledru
f8e7fe4c27
Update to use stdout_str() 2021-04-25 23:33:19 +02:00
Ricardo Iglesias
c3d7358df6
ls: ignore leading period when sorting by name (#2112)
* ls: ignore leading period when sorting by name

ls now behaves like GNU ls with respect to sorting files by ignoring
leading periods when sorting by main.

Added tests to ensure "touch a .a b .b ; ls" returns ".a  a  .b  b"

* Replaced clone/collect calls.
2021-04-25 21:08:05 +02:00
Alessandro Stoltenberg
bbcca3eefd ls: Implements https://github.com/uutils/coreutils/issues/1880 extension sorting. 2021-04-25 19:45:59 +02:00
Sylvestre Ledru
fb6394554e
Merge pull request #2096 from tertsdiepraam/ls/fix_backslash_escape
ls: improve code cov
2021-04-24 10:05:32 +02:00
Terts Diepraam
ea10647a62 Merge remote-tracking branch 'upstream/master' into ls/fix_backslash_escape 2021-04-22 14:23:35 +02:00
Terts Diepraam
b9f4964a96 ls: bring up to date with recent changes 2021-04-22 11:39:08 +02:00
Terts Diepraam
cd1514bd57 Merge branch 'master' into ls/cross_platform_colors 2021-04-22 11:30:26 +02:00
Terts Diepraam
4e4c3aba00 ls: don't color symlink target 2021-04-22 11:16:33 +02:00
Anup Mahindre
8554cdf35b
Optimize recursive ls (#2083)
* ls: Remove allocations by eliminating collect/clones

* ls: Introduce PathData structure

- PathData will hold Path related metadata / strings that are required
frequently in subsequent functions
- All data is precomputed and cached and subsequent functions just
use cached data

* ls: Cache more data related to paths

- Cache filename and sort by filename instead of full path
- Cache uid->usr and gid->grp mappings
https://github.com/uutils/coreutils/pull/2099/files
* ls: Add BENCHMARKING.md

* ls: Document PathData structure

* tests/ls: Add testcase for error paths with width option

* ls: Fix unused import warning

cached will be only used for unix currently as current use of
caching gid/uid mappings is only relevant on unix

* ls: Suggest checking syscall count in BENCHMARKING.md

* ls: Remove mentions of sort in BENCHMARKING.md

* ls: Remove dependency on cached

Implement caching using HashMap and lazy_static

* ls: Fix MSRV error related to map_or

Rust 1.40 did not support map_or for result types
2021-04-22 09:19:17 +02:00
Terts Diepraam
ff39538375 ls: further refactor --color and classification 2021-04-21 18:00:43 +02:00
Terts Diepraam
e382f7fa83 ls: fix test warnings on Windows 2021-04-21 17:43:57 +02:00
Terts Diepraam
34a824af71 ls: use lscolors crate 2021-04-21 17:35:02 +02:00
Terts Diepraam
f34c992932 ls: always quote backslash in shell style 2021-04-21 12:45:21 +02:00
Terts Diepraam
fd54614130 Merge branch 'master' into ls/fix_backslash_escape 2021-04-21 12:06:54 +02:00
Terts Diepraam
bee9156764 tests/ls: improve code cov 2021-04-21 12:03:48 +02:00
Terts Diepraam
f84f23ddfe tests/ls: add coverage for special shell character after escaped char 2021-04-21 11:22:10 +02:00
Terts Diepraam
795d89f11d ls: don't escape backslash in shell style quoting 2021-04-21 11:08:40 +02:00
Terts Diepraam
685493f72b ls: make path platform independent 2021-04-16 23:48:35 +02:00
Terts Diepraam
2c130ae7c0 ls: take -l into account with dereference-command-line 2021-04-14 14:42:14 +02:00
Terts Diepraam
5c28ac1b0d ls: dereference command line 2021-04-14 14:12:00 +02:00
Terts Diepraam
2997413d64 ls: refactor tests 2021-04-07 11:48:01 +02:00
Sylvestre Ledru
7cdeb18dff
Merge pull request #2026 from tertsdiepraam/ls/hide_and_ignore
ls: --hide and --ignore
2021-04-05 22:31:23 +02:00
Terts Diepraam
a50eae76a4 ls: some more tests for ignore & hide 2021-04-05 12:17:42 +02:00
Terts Diepraam
bbb27800c9 ls: fix windows tests and commit lock 2021-04-04 23:14:55 +02:00
Terts Diepraam
76308dbec9 ls: tests for invalid patterns for hide and ignore 2021-04-04 22:35:22 +02:00
Terts Diepraam
fa4272a19b ls: --hide and --ignore 2021-04-04 19:19:56 +02:00
Terts Diepraam
54e9cb09da ls: add tests for --hide-control-chars 2021-04-03 16:44:12 +02:00
Terts Diepraam
9cb0fc2945 ls: forgot to push updated tests 2021-04-03 13:15:19 +02:00
Terts Diepraam
2941dfd698
ls: quoting style (#1989) 2021-04-01 22:50:13 +02:00
Ricardo Iglesias
5f17719a59
Implemented --indicator-style flag on ls. (#1907)
* Implemented --indicator-style flag on ls.

* Rust fmt

* Grouped indicator_style args.

* Added tests for sockets and pipes.

Needed to modify util.rs to add support for pipes (aka FIFOs).

* Updated util.rs to remove FIFO operations on Windows

* Fixed slight error in specifying (not(windows))

* Fixed style violations and added indicator_style test for non-unix systems
2021-03-29 13:10:13 +02:00
Terts Diepraam
955c547adf
ls: overrideable -n option (#1917) 2021-03-26 19:12:01 +01:00
Terts Diepraam
23b70001a8
ls: version sort (#1898) 2021-03-25 20:24:53 +01:00
Terts Diepraam
de3f9b8186
ls: across & commas formats and width parameter (#1869) 2021-03-22 18:24:23 +01:00
Terts Diepraam
b9662c78a5
ls: possible fix for access time tests (#1866) 2021-03-22 10:14:59 +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
Terts Diepraam
39b07f670f tests/ls: adapt tests to --si and new size formats 2021-03-19 15:15:24 +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
aspen
4e29b693f8
uutils: change every target_os = "macos" to target_vendor = "apple" 2021-03-18 08:42:53 -04:00