rockcarver / frodo-cli

A CLI to manage ForgeRock platform deployments supporting Identity Cloud tenants, ForgeOps deployments, and classic deployments.
MIT License
17 stars 14 forks source link

DRAFT: Demo of using command differently #383

Closed ashleyfrieze closed 1 month ago

ashleyfrieze commented 3 months ago

@vscheuber - this is not for merging. This is a POC to illustrate an alternative approach to building out the network of cli commands. You want it to be modularised, but by modularising it by using a spread of files with naming conventions and a lot of separate sub-programs, there are some disadvantages.

It's a long refactor to move to an alternative, especially given the core behaviour of FrodoCommand, but this is an example of how things could be done differently, which I think would survive webpacks and pkgs better. Though it would need some serious legwork to complete it.

View it with the hide whitespace changes mode set in GitHub.

Let me know if you think it has legs.

I think I prefer the coupling by function name to by file naming convention that this introduces, along with how it splits the responsibilities slightly better between the files - i.e. the command name is chosen by the command itself in its own file.

vscheuber commented 1 month ago

@ashleyfrieze thank you so much for this sample PR! We have adopted your proposal and merged #389 earlier this week, applying those changes to all commands. Closing this PR.