diff options
| author | Pádraig Brady <P@draigBrady.com> | 2022-06-26 00:27:06 +0100 |
|---|---|---|
| committer | Pádraig Brady <P@draigBrady.com> | 2022-09-26 15:04:56 +0100 |
| commit | ce2b875cd725d8d64aae5b1f250382f3fa987593 (patch) | |
| tree | 981b8a836395a7879424c83348037418346cbbf8 /scripts/git-hooks/commit-msg | |
| parent | maint: use enums to make dir_status code easier to read (diff) | |
| download | coreutils-ce2b875cd725d8d64aae5b1f250382f3fa987593.tar.gz coreutils-ce2b875cd725d8d64aae5b1f250382f3fa987593.zip | |
wc: add --total={auto,never,always,only} option
without this option, control of when the total is output
is quite awkward. Consider trying to suppress the total line,
which could be achieved with something like:
wc-no-total() { wc "$@" /dev/null | head -n-2; }
As well as being non obvious, it's also non general.
It would give a non failure, but zero count if passed a file on stdin.
Also it doesn't work in conjunction with the --files0-from option,
which would need to be handled differently with something like:
{ find files -print0; printf '%s\0' /dev/null; } |
wc --files0-from=- |
head -n2
Also getting just the total can be awkward as file names
are only suppressed when processing stdin, and
also a total line is only printed if processing more than one file.
For completness this might be achieved currently with:
wc-only-total() {
wc "$@" |
tail -n1 |
sed 's/^ *//; s/ [^ 0-9]*$//'
}
* src/wc.c: Add new --total option.
* tests/misc/wc-total.sh: New test suite for the new option.
* tests/local.mk: Reference the new test.
* doc/coreutils.texi (wc invocation): Document the new option.
* THANKS.in: Add suggestor.
* NEWS: Mention the new feature.
Diffstat (limited to 'scripts/git-hooks/commit-msg')
0 files changed, 0 insertions, 0 deletions
