mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-06-20 03:37:56 +02:00
Renamed template to New.txt
This commit is contained in:
parent
370e08c2d9
commit
29d27eec18
@ -1,5 +1,5 @@
|
|||||||
Your Headline
|
Headline
|
||||||
=============
|
========
|
||||||
|
|
||||||
Some introductory words...
|
Some introductory words...
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
Your Headline
|
Headline
|
||||||
=============
|
========
|
||||||
|
|
||||||
Some introductory words...
|
Some introductory words...
|
||||||
|
|
@ -1,13 +1,13 @@
|
|||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Creates a new text file
|
Creates a text file
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This PowerShell script creates a new .txt file from template file at: ../data/templates/Text.txt.
|
This PowerShell script creates a new .txt file from: ../data/templates/New.txt.
|
||||||
.PARAMETER path
|
.PARAMETER path
|
||||||
Specifies the path and new filename (README.txt by default)
|
Specifies the path and new filename (README.txt by default)
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./new-text-file.ps1
|
PS> ./new-text-file.ps1
|
||||||
✅ New file 'README.txt' created from template 'Text.txt'.
|
✅ New 'README.txt' created (from data/templates/New.txt).
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -17,11 +17,11 @@
|
|||||||
param([string]$path = "README.txt")
|
param([string]$path = "README.txt")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$pathToTemplate = Resolve-Path "$PSScriptRoot/../data/templates/Text.txt"
|
$pathToTemplate = Resolve-Path "$PSScriptRoot/../data/templates/New.txt"
|
||||||
Copy-Item $pathToTemplate "$path"
|
Copy-Item $pathToTemplate "$path"
|
||||||
if ($lastExitCode -ne 0) { throw "Can't copy template to: $path" }
|
if ($lastExitCode -ne 0) { throw "Can't copy template to: $path" }
|
||||||
|
|
||||||
"✅ New file '$path' created from template 'Text.txt'."
|
"✅ New '$path' created (from data/templates/New.txt)."
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error: $($Error[0])"
|
"⚠️ Error: $($Error[0])"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user