sharkdp / bat

A cat(1) clone with wings.
Apache License 2.0
49.69k stars 1.25k forks source link

Checklist: POSIX-compliance #134

Closed sharkdp closed 6 years ago

sharkdp commented 6 years ago

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:

Comments

Links

RivenSkaye commented 5 months 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.

As for the XBD Utility Syntax Guidelines I can find some non-compliant behavior for guidelines 3, 10, and 11

  1. --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 acknowledgements
    • other orderings behave as they should, by virtue of order of processing.
  2. Not all options are available as a single alphanumeric, though this seems to be the case with more coreutils, so I wouldn't get hung up on this

As 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.