bottlerocket icon indicating copy to clipboard operation
bottlerocket copied to clipboard

Be consistent with command line parsing by standardizing on the `argh` crate.

Open stmcginnis opened this issue 1 year ago • 2 comments

What I'd like:

Most of our CLIs use the argh crate for parsing command line input. But some are using clap instead.

It would be good to convert these over to argh so we are consistent across our code and avoid importing two different crates that provide the same functionality.

Any alternatives you've considered:

Could keep them as is since there is no conflict between using the mix of the two, but not a real reason not to just use one or the other.

stmcginnis avatar Aug 23 '22 21:08 stmcginnis

I would like to take this. Does this concern with the testsys repo as well? https://github.com/bottlerocket-os/bottlerocket-test-system/issues/535

alok-sin avatar Sep 11 '22 03:09 alok-sin

Awesome, that would be great @alok-sin!

I'm not 100% on the bottlerocket-test-system changes yet. There has been some talk of removing some of that code, so I don't want to suggest you make changes there only to have it all be removed.

If you could start in this repo that would be ideal. Then we can hopefully have a little better understanding if anything should be updated in the other repo once that is done.

Thanks a lot!

stmcginnis avatar Sep 11 '22 22:09 stmcginnis

How did you arrive at standardizing on argh instead of clap? I think clap is becoming the de-facto standard crate for this.

webern avatar Oct 10 '22 22:10 webern

@bcressey had expressed a desire to go with argh over clap. If clap is becoming the standard for this, then perhaps we should reevaluate that position. I am fine either way - I would just like to see us using one or the other.

stmcginnis avatar Oct 10 '22 23:10 stmcginnis

I don't feel as strongly about "only one" but I definitely don't want to add clap to the binaries shipped in the OS image, and would prefer that the mix of custom / structopt / argh that is currently shipped get trimmed down to just argh.

That's primarily for reasons of code size. It's not a huge factor for existing builds, but there are some use cases (like a microVM guest) where size is a concern. I don't like the idea of spending 10+ MiB of space for arg parsing that no one will ever see.

bcressey avatar Oct 11 '22 14:10 bcressey

I don't feel as strongly about "only one"

I also don't feel strongly about "only one" and would hate to see us go from clap -> argh in places where we are using clap now.

Have you checked the size of the compiled code of clap vs argh? Just curious if it's a big contributor to binary size.

webern avatar Oct 11 '22 17:10 webern