You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue will track the tasks for migrating Lighthouse from clap builder to derive.
Clap derive offers some nice features including
type casted flag definitions, no need to do any post processing to the flag values i.e. converting strings to other types
easier to read flag definitions
Clap derive is a bit less flexible than the builder, but its possible to combine the builder with derive if needed. All of our flag definitions today are fairly "standard", so derive shouldn't cause any issues.
Another nice bonus with clap derive is it should make ingesting a config at startup easy. Its fairly trivial to map a json,yaml,whatever file to a struct. And the clap derive flag definitions are structs. An example might make things a bit clearer.
Take this function that parses cli arguments and returns some config that Lighthouse then uses to do stuff
It then becomes straight foward to write some code that maps a provided yaml,json,etc file to an instance of DatabaseManager and feed that into the same parse_client_config function. Were now re-using the same code paths that ingest cli params from the command line to ingest cli params from a file.
This issue will track the tasks for migrating Lighthouse from clap builder to derive.
Clap derive offers some nice features including
Clap derive is a bit less flexible than the builder, but its possible to combine the builder with derive if needed. All of our flag definitions today are fairly "standard", so derive shouldn't cause any issues.
Another nice bonus with clap derive is it should make ingesting a config at startup easy. Its fairly trivial to map a json,yaml,whatever file to a struct. And the clap derive flag definitions are structs. An example might make things a bit clearer.
Take this function that parses cli arguments and returns some config that Lighthouse then uses to do stuff
With clap derive, instead of passing in the cli args, we pass in the struct that defines those cli args
It then becomes straight foward to write some code that maps a provided yaml,json,etc file to an instance of
DatabaseManager
and feed that into the sameparse_client_config
function. Were now re-using the same code paths that ingest cli params from the command line to ingest cli params from a file.Tasks
main
to deriveThe text was updated successfully, but these errors were encountered: