Hi, I’m in the process of developing a drop in replacement for a tool; for that I need long options. I searched through the archives (hare-dev, hare-users) and tickets for ’getopt’ and ’getopt long’ without success. I assume the decision to not support GNU style long options is intentional to keep everything as concise as possible. Is this assumption correct? Or would an extension to support this be welcome? I’m going to write this anyway, the question is - just as module, as ext-lib or in stdlib? kind regards, Tom
Yes, this is intentional.
The getopt module is compatible with POSIX. An argument parser supporting long options would mkae for a good external library, but not in the extlib, just in the broader ecosystem at large.
On Wed Nov 23, 2022 at 5:02 AM EST, Drew DeVault wrote: > The getopt module is compatible with POSIX. Why is POSIX compatibility relevent in this case, and what does compatibility mean exactly in this context? It is good for C programs to write to POSIX standards to ensure interoperability between platforms. But Hare programs only need to worry about writing to the standard library, which (presumably) is going to be the same on every platform it is present. The way that the getopt module is used is already very different from how getopt(3p) is used. There may be an argument for keeping the getopt module minimal, but I don't think that "POSIX compatibility" is one of them.
We like having a standard to point at to establish some kind of precedent. The CLI interface it describes is still something that we can (and do) conform to, but Hare is not C so naturally the Hare API need not resemble the C API.