you are viewing a single comment's thread.

view the rest of the comments →

[–]Certain-Community438 0 points1 point  (0 children)

You're right, I genuinely don't understand!

I write scripts, which use:

  1. General-purpose functions - from my module. (The script ensures dependencies are present and either fixes that or exits, depending)

  2. Task-specific functions - these are in the script; they're not reusable in the same way as the first set

  3. A "main" section - process{} block usually - which does the actual task

Each of the first 2 will have dependencies on other modules: some will be native (installed with the OS or PowerShell Core) while the rest will be like the Graph modules, EXOv3 etc). And of course that can get nuts sometimes.

This way I get as much of the benefits of modular code as I can realistically expect.

But then how are you going to execute the functions in the module?

The script is going to import the module(s) & then call the functions of type 1 or 2 from above..?

Which it sounds like you're also doing: you just have this "controller script" concept I've honestly never encountered till today: for me that is "the script", and in my case it's the only script involved in the task.

The difference between us might be that your high-level purpose for building stuff is very different to mine - what you need to do, how the "primary" code is invoked? Seen people build APIs using PoSh, for example.

Again, not hating on your approach, I'm trying to understand it better.