PowerShell Experiment: Standard Scaffold w/ Custom Functions in External File

 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:

  1. Start with a scaffold 'main.ps1' script, that is never touched.
  2. 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:
  1. Argument Testing
  2. Main Function Execution
  3. Output/Artifacts
The unique or 'functions.ps1' file, it would contain 
  1. all arguments/params for itself (using the $args array)
  2. standard "MainProcess" function
We'll see how it goes.

Comments

Popular posts from this blog

Real World NodeJS w/ Continuous Integration

OWASP Training @ PluralSight

Further use of Octopus Deploy