ugexe / zef

Raku Module Management
Artistic License 2.0
207 stars 44 forks source link

Feature request: `zef config` subcommands for debugging #519

Open dontlaugh opened 1 year ago

dontlaugh commented 1 year ago

I'm looking into running Blin, and it relies on paring --help to find Zef's JSON config.

https://github.com/Raku/Blin/blob/253df4c042a1fb8cd0fd92ccedf9ce3fb9bcca70/lib/Blin/Tester/Zef.rakumod#L26-L27

It's understandable that parsing is required, since the automatic config paths seem volatile. Here's mine, for instance

CONFIGURATION /home/coleman/.raku/resources/2761BB503396E2B6CC3A6AC77C63CC0B8F2A7233.json

I propose a new subcommand namespace, config (or maybe zef debug could work), that simply evaluates/merges config sources, and prints them to stdout.

Blin's use case could then be accomplished with something like

zef config show --format=json | jq '.Repository[][].options.mirrors'

Prior art: kubectl config view, lxc config show, and more.

This is also an alternative to changing the bemavior of --help per #477

ugexe commented 1 year ago

Command line flags override configuration, so there isn't a merged configuration so to speak yet. We use the pattern of setting command line flag defaults from configuration. For instance: https://github.com/ugexe/zef/blob/710034fe3537826548d7f5c8983b3fb2db1e17de/lib/Zef/CLI.rakumod#L415 with the problem there being there is not yet a centralized mapping of environment variables to a single configuration object.