en-US/about_tcs.utils.help.txt
|
TOPIC about_tcs.utils SHORT DESCRIPTION Scaffolding and utility functions for building tcs-style PowerShell modules. LONG DESCRIPTION tcs.utils generates new modules, functions and Pester tests that follow the standard used across the TheCodeSaiyan PowerShell suite, and contains a few helpers for working with module source. Generators New-ModuleCustomTemplate Creates a module folder: psm1, manifest (requires tcs.core 0.4.0+), Config.ps1, README.md, .gitignore and folders. -IncludeRepoFiles also adds a module test, analyzer settings and a CI workflow. New-FunctionTemplate Creates function scripts with help and the tcs.core telemetry pattern (Start-TcsTelemetry and Complete-TcsTelemetry). New-PesterCustomTests Creates Pester 5 tests that import the module the tests belong to. Generating modules from OpenAPI/Swagger documents moved to the tcs.openapi module (Install-Module tcs.openapi; New-OpenApiModule). Module utilities Convert-ModuleNameAndReferences Copies and renames a module. Export-ModuleToFlatTextAndManifest Exports a module to one text file and a JSON manifest. Import-ModuleFromFlatTextAndManifest Recreates the module from them. Update-ModuleManifestExports Sets FunctionsToExport from the functions in Public. String utilities Edit-StringAtLine, Get-LeadingSpaceCount Windows only Get-MsiSequence reads sequences, files and custom actions from an MSI file or extracts it (Windows Installer COM and msiexec.exe). Generated modules load the scripts in Public and Private and their subfolders (tests excluded) and never write into their own module folder when they are imported. Settings live in the user's settings folder managed by tcs.core (see Get-ModuleConfig and Set-ModuleConfig); secrets are saved with Set-ModuleSecret and read with Get-ModuleSecret. Telemetry tcs.utils sends anonymous usage events through tcs.core when it is imported (Invoke-TelemetryCollection) and when each exported command starts and ends (Start-TcsTelemetry and Complete-TcsTelemetry; when one tcs.utils command calls another, only the outer one is recorded): command name, duration, success, exception type, PowerShell and OS version and a random installation ID. No user, machine, path or error text is sent. Turn it off with Set-ModuleConfig -ModuleName tcs.utils -Telemetry $false or by setting the TCS_TELEMETRY_OPTOUT environment variable to 1. EXAMPLES New-ModuleCustomTemplate -Names 'tcs.example' -Path ./modules New-FunctionTemplate -Name 'Get-Example' -Path ./modules/tcs.example/Public New-PesterCustomTests -Source ./modules/tcs.example/Public SEE ALSO about_tcs.core https://github.com/ntatschner/TheCodeSaiyan-PowerShell-tcs.utils KEYWORDS tcs scaffolding module template |