Closed sharkdp closed 6 years ago
For proper "drop-in" replacement, one should be able to ln -s /path/to/bat /usr/bin/cat
without any existing stuff breaking significantly. Currently there's a few things missing that prevent replacing e.g. scripted usage.
-b, --number-nonblank
: number non-empty output lines only; overrides -n
is currently unsupported
cat
doesn't handle Windows line endings (CRLF, \r\n
), but this seems like a cat
issue as POSIX is in no way unclear about respecting system line ends.-E, --show-ends
: display $ for line ends-T, --show-tabs
: display TAB as ^I
-s, --squeeze-blank
: skip repeated empty lines-v, --show-nonprinting
: uses ^ and M- notation, but does not print Linefeed and TAB
-e
: -vE
shorthand-t
: -vT
shorthandbat
does support -A
: -vET
shorthandAs for the XBD Utility Syntax Guidelines I can find some non-compliant behavior for guidelines 3, 10, and 11
--list-themes
, --diagnostic
, and --acknowledgements
are not treated as terminators for option reading
--list-themes --diagnostic --acknowledgements
dumps diagnostic info and ignores the preceeding option--acknowledgements --list-themes
prints all themes and does not list acknowledgementsAs for the "Environment variables" section, that refers to the XBD Environment Variables solely for internationalization. This is a missed opportunity in my opinion, as the same document includes things like $HOME
and other common variables that may also influence where to search for config files. Coincidentally, this affects things like reading config in an MSYS2 environment which is now telling me that $HOME/.config/bat/config
is being ignored entirely. I'll make a separate trackable issue for that.
Getting back to the 8.2 specification bit, these are used for printing messages (including errors) in the user's system locale. Not opting to utilize those should not be an issue as any system errors are propagated from the user-defined language the system already runs in, which is very rarely different from user preferences anyway.
A lot of people complain that this project is called a "cat(1) clone" [1] [2] [3] [4].
While I disagree with some of these comments, I am wondering how far we actually are from a fully POSIX-compliant cat implementation - because we have already implemented quite a lot of the missing features.
The page about
cat
in the current POSIX standard seems to imply the following things:-u
(Write bytes from the input file to the standard output without delay as each is read.)" => We follow GNUcat
here and simply ignore this option (we do not buffer anyways).file
(A pathname of an input file)"-
"Comments
cat
provides (-n
,-v
,-T
, etc.) are not part of the POSIX standard.Links
cat
cat
cat
cat
cat