So while I was working on the last project to "Factory Out" Modules w/ Plaster, it dawned on me: why stop there?
Having a standard script outline, that's a template in VS Code, over and over the same steps to make the current script unique -- editing in just the "right places" seems cumbersome when, down the road, you have to update/add functionality, remembering where everything is in this already giant script.
All of this to say:
- Start with a scaffold 'main.ps1' script, that is never touched.
- Create a unique or 'functions.ps1' script file that is the meat of what needs to be done.
The "old way" was to create the new script file and jumble it all together. What I've found is that this is no different (really) in using the "proper" Begin/Process structure - as far as support.
In the 'main' file, it would handle the "big 3", standard checks and balances:
- Argument Testing
- Main Function Execution
- Output/Artifacts
The unique or 'functions.ps1' file, it would contain
- all arguments/params for itself (using the $args array)
- standard "MainProcess" function
We'll see how it goes.
No comments:
Post a Comment