|
From: | Dragan Simic |
Subject: | Re: du enhancement |
Date: | Fri, 20 Oct 2023 18:51:50 +0200 |
On 2023-10-20 17:47, Pádraig Brady wrote:
On 20/10/2023 15:05, Dragan Simic wrote:On 2023-10-20 15:55, Arsen Arsenović wrote:Dragan Simic <dsimic@manjaro.org> writes:On 2023-10-20 15:18, Pádraig Brady wrote:On 20/10/2023 00:22, Rusty Duplessis wrote:Would be nice to have an option to append a / to the end of directory names,so that you can distinguish between a file and directory when using-a. Something like -F option to ls.It's a good suggestion. I generally only use du with single files / dirs, or otherwise I use a wrapper that makes dirs obvious (though coloring): http://www.pixelbeat.org/scripts/dutop I.e. the default output from du -a is hard to parse.How about making the output of du(1) colored the same way as it currently is in ls(1)? I'd be willing to work on implementing that.I was about to post the same. I see no reason why du couldn't (or shouldn't) do that based on normal coloring logic already present in ls.Yes coloring is a plausible addition to du, and would make sense to follow the same options, env vars as ls.
Great, I'm glad that you agree. I was thinking about basically reusing the LS_COLORS environment variable, unless DU_COLORS is defined using the same syntax. That way the users would be able to define the colors separately, if desired so, while the already established logic and the variable would be reused.
On a somewhat unrelated note, I've been thinking already about addingcoloring to md5sum(1) and the related utilities, green for "OK" and redfor any errors.Something similar was suggested and discounted at: https://lists.gnu.org/archive/html/coreutils/2013-12/msg00152.html I would think coloring of OK, FAILED is less of a requirement than coloring in du, as it can be easily determined from the exit status of the command. For example, see "Highlighting status of whole command line" at: https://www.pixelbeat.org/docs/terminal_colours/ Also it's trivial to color OK/FAILED by piping the output. For example you could use a simplified variation of this script: https://www.pixelbeat.org/scripts/idiff
I agree that coloring of OK and FAILED is lower on the priority list, and I already use and display the exit statuses of the commands in my environment. However, I still think that having OK and FAILED colored green and red, respectively, with no need to use external scripting, if implemented properly of course, would provide measurable value when running md5sum(1) and its friends manually.
[Prev in Thread] | Current Thread | [Next in Thread] |