Skip to content

Use and fill templates in PowerShell via a simple syntax.

License

Notifications You must be signed in to change notification settings

GSGBen/pstemplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PSTemplate

Use and fill templates in PowerShell via a simple syntax.

Installation

Install-Module PSTemplate

Usage

One-liner

Fill-Template -Template "simple {{Type}} but could be a here-string" -Variables @{'Type' = 'string'}

outputs:

simple string but could be a here-string

More Common

$template = @"
{{line1}}
line2
{{line3}}
"@

$tokens = @{
    "line1" = "Line 1"
    "line3" = "Line 3"
}

Fill-Template -Template $template -Variables $tokens

outputs:

Line 1
line2
Line 3

From and to File

$tokens = @{
    "line1" = "Line 1"
    "line3" = "Line 3"
}

Get-Content "C:\temp\Lines.template" | Fill-Template -Template $template -Variables $tokens | Out-File "C:\temp\lines.filled" -Encoding Utf8

About

Use and fill templates in PowerShell via a simple syntax.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published