]> git.proxmox.com Git - pve-xtermjs.git/commit
termproxy: switch from clap to pico-args for CLI argument handling
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 20 Oct 2023 04:08:47 +0000 (06:08 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 20 Oct 2023 06:06:09 +0000 (08:06 +0200)
commit24d707d0506b120a085b06b5f2b6000696879a1e
tree1835d16caf3a28b08ec2d2392af1d6a91fd12859
parent749ebb0907293a9f1cf0f5074e0a240f39f94f6f
termproxy: switch from clap to pico-args for CLI argument handling

Not that clap is bad or anything the like, but for one it's rather
over engineered, and it has to be as long as it wants to provide a
dozen wildly different way to do things.
And the second, more important reason: it's still undergoing a lot of
churn every year or so.  Each upgrade to a major version needs like
two hours of understanding what's going on, at least if one wants to
Do It Rightâ„¢.

Termproxy, otoh., is a small and internal tool that doesn't need an
overly fancy CLI targetting humans, as it will be only called by the
API anyway.

So, to reduce the time required to constantly catch up, and remove
some complexity, switch over to pico-args. That one provides a few
small interfaces for the most common things, does it right and uses
OsString as main type and has exactly zero dependencies on its own.
In other words, perfect for such internal tools (and possibly also
most others).

Copy over the help output from the clap based tool for convenience,
pico-args really doesn't bother with such things, and introduce an
Options struct to have a, well, more structured way of handling CLI
arguments/options.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
termproxy/Cargo.toml
termproxy/src/main.rs