|
|
Log in / Subscribe / Register

Vetting the cargo

Vetting the cargo

Posted Jun 13, 2022 19:38 UTC (Mon) by fratti (subscriber, #105722)
In reply to: Vetting the cargo by khim
Parent article: Vetting the cargo

Okay, so you don't want isatty() in a standard library because its current non-standard-library implementation is bad, but you happily will rely on it for everything that parses command line arguments even on platforms where POSIX isatty() would be enough because clap is the recommended crate for this and pulls it in. Gotcha.


to post comments

Vetting the cargo

Posted Jun 14, 2022 14:53 UTC (Tue) by khim (subscriber, #9252) [Link]

Yes. If I use library for the firmware development then I don't want to ever deal with then fact that isatty is not implementable there in principle, but then I wouldn't need command-line parsing or clap there either.

And if I develop “normal” app and only care about “usual suspects” (GNU/Linux, macOS, Windows) then I would pull clap and that mess with “msys” and “pty”.

May not be an ideal solution, but from practical POV it's the best I can expect.

Maybe, just maybe, having that mess as part of clap would be better… since I couldn't imagine an app which needs to know if it needs to enable colors or not and yet doesn't parse the command line… but probably not by much.

Vetting the cargo

Posted Jun 14, 2022 16:18 UTC (Tue) by excors (subscriber, #95769) [Link]

atty is an optional dependency of clap, so it's only pulled in if you enable the "color" feature (which is enabled by default, but if you care about trusting dependencies then I think you should always be disabling default features and only choosing the ones you really need).

With default-features=false, clap has 7 transitive dependencies (and one of those is owned by the clap project), which doesn't sound like a crazy amount to be vetted. The default features add another 4 transitive dependencies. But if you turn on all the stable optional features, it goes up to about 28, which does sound more like a crazy amount.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds