fermyon / spin

Spin is the open source developer tool for building and running serverless applications powered by WebAssembly.
https://developer.fermyon.com/spin
Apache License 2.0
5.47k stars 255 forks source link

Update to clap 4 #2851

Closed rylev closed 1 month ago

rylev commented 1 month ago

On the heels of #2847, this updates to Clap 4 which gets rid of some duplicate dependencies in the dependency tree. I did some light testing, but I'm not sure the best way to verify that this is functionally equivalent to the previous version.

itowlson commented 1 month ago

A couple of things I noticed while testing:

image

and with clap 4:

image

The way clap 4 leaves line wrapping to the terminal, especially combined with the removal of colour highlighting, seems like a step backward. I don't know if clap 4 provides us with any knobs to control this behaviour though.

rylev commented 1 month ago

@itowlson I've addressed your feedback. Unfortunately, I've run into the same issue found in this previous attempt: https://github.com/fermyon/spin/pull/1198. It seems clap 4 doesn't lazily evaluate args like clap 3 did, and once it discovers an arg that can only go into the trigger_args bucket of otherwise unknown args, it starts slurping up everything else and putting it into trigger_args.

This means the following used to work but no longer does:

spin up --some-arg-meant-for-the-trigger --env "foo=bar"

This does not work because as soon as --some-arg-meant-for-the-trigger is seen, everything gets lumped into trigger_args. If --env is put first, than things work as expected.