4 ms·
If I could make a suggestion about debugging scripts. It doesn't seem that I can currently debug scripts that are contained in a module folder, but not directl
by c0wb0yc0d3r 9y ago
If I could make a suggestion about debugging scripts.
It doesn't seem that I can currently debug scripts that are contained in a module folder, but not directly the script being called.
If I have a module file that looks like this:
Get-ChildItem -Path $PSScriptRoot\.ps1 | ForEach-Object{ .$_.FullName } # source the script files
Export-ModuleMember -function -* # export those sourced scripts
I am not sure how it works exactly, but if I am writing a new cmdlet, Get-HackerNews.ps1, the breakpoints aren't hit in ISE. It would be super cool if it did.
------
Also is there guidance on module structure? Right now it looks like the docs indicate that all the cmdlets should be placed in the .psm1 file, but to me that sounds like it would get rather unmaintainable very quickly. Just looking at the one my dev team has created, we have nearly 50 exported functions. Maybe our our module could be broken up, but that would still leave us ~10 cmdlets per module.
- hobs 9y agoHere is an example of a real project that uses PowerShell to help DBA automation, you dont include them in your psm1, just dot source them, see https://github.com/sqlcollaborative/dbatools/blob/master/dbatools.psm1 https://github.com/sqlcollaborative/dbatools/blob/master/dba... for an example.
- c0wb0yc0d3r 9y agoAwesome, that is similar to what I do right now.