mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-12 06:02:56 +02:00
Updated the manuals
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
The *new-markdown-file.ps1* Script
|
||||
===========================
|
||||
|
||||
This PowerShell script creates a new Markdown file from template file at: ../data/templates/Markdown.md.
|
||||
This PowerShell script creates a new Markdown file from template: ../data/templates/New.md.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
@ -9,11 +9,11 @@ Parameters
|
||||
/Repos/PowerShell/scripts/new-markdown-file.ps1 [[-path] <String>] [<CommonParameters>]
|
||||
|
||||
-path <String>
|
||||
Specifies the path and new filename
|
||||
Specifies the path and new filename (README.md by default)
|
||||
|
||||
Required? false
|
||||
Position? 1
|
||||
Default value
|
||||
Default value README.md
|
||||
Accept pipeline input? false
|
||||
Aliases
|
||||
Accept wildcard characters? false
|
||||
@ -26,8 +26,8 @@ Parameters
|
||||
Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./new-markdown-file.ps1 letter.md
|
||||
✅ New Markdown file 'letter.md' created from template 'Markdown.md'.
|
||||
PS> ./new-markdown-file.ps1
|
||||
✅ New 'README.md' created (from data/templates/New.md).
|
||||
|
||||
```
|
||||
|
||||
@ -44,30 +44,30 @@ Script Content
|
||||
```powershell
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Creates a new Markdown file
|
||||
Creates a Markdown file
|
||||
.DESCRIPTION
|
||||
This PowerShell script creates a new Markdown file from template file at: ../data/templates/Markdown.md.
|
||||
This PowerShell script creates a new Markdown file from template: ../data/templates/New.md.
|
||||
.PARAMETER path
|
||||
Specifies the path and new filename
|
||||
Specifies the path and new filename (README.md by default)
|
||||
.EXAMPLE
|
||||
PS> ./new-markdown-file.ps1 letter.md
|
||||
✅ New Markdown file 'letter.md' created from template 'Markdown.md'.
|
||||
PS> ./new-markdown-file.ps1
|
||||
✅ New 'README.md' created (from data/templates/New.md).
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
#>
|
||||
|
||||
param([string]$path = "")
|
||||
param([string]$path = "README.md")
|
||||
|
||||
try {
|
||||
if ($path -eq "" ) { $path = Read-Host "Enter the new filename" }
|
||||
if (Test-Path "$path" -pathType leaf) { throw "File '$path' is already existing" }
|
||||
|
||||
$pathToTemplate = Resolve-Path "$PSScriptRoot/../data/templates/Markdown.md"
|
||||
$pathToTemplate = Resolve-Path "$PSScriptRoot/../data/templates/New.md"
|
||||
Copy-Item $pathToTemplate "$path"
|
||||
if ($lastExitCode -ne 0) { throw "Can't copy template to: $path" }
|
||||
|
||||
"✅ New Markdown file '$path' created from template 'Markdown.md'."
|
||||
"✅ New '$path' created (from data/templates/New.md)."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0])"
|
||||
@ -75,4 +75,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:56)*
|
||||
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:39)*
|
||||
|
Reference in New Issue
Block a user