diff --git a/data/templates/PowerShell.ps1 b/data/templates/New.ps1 similarity index 100% rename from data/templates/PowerShell.ps1 rename to data/templates/New.ps1 diff --git a/scripts/new-script.ps1 b/scripts/new-powershell-script.ps1 similarity index 60% rename from scripts/new-script.ps1 rename to scripts/new-powershell-script.ps1 index 53925d97..83cb0a4e 100755 --- a/scripts/new-script.ps1 +++ b/scripts/new-powershell-script.ps1 @@ -1,12 +1,12 @@ <# .SYNOPSIS - Creates a new PowerShell script + Creates a PowerShell script .DESCRIPTION - This PowerShell script creates a new PowerShell script file by using the template file at: ../data/templates/PowerShell.ps1. + This PowerShell script creates a new PowerShell script file by using the template ../data/templates/New.ps1. .PARAMETER path - Specifies the path and new filename + Specifies the path and new filename ("bot.ps1" by default) .EXAMPLE - PS> ./new-script.ps1 bot.ps1 + PS> ./new-powershell-script.ps1 ✅ New PowerShell script 'bot.ps1' created from template 'PowerShell.ps1'. .LINK https://github.com/fleschutz/PowerShell @@ -14,16 +14,14 @@ Author: Markus Fleschutz | License: CC0 #> -param([string]$path = "") +param([string]$path = "bot.ps1") try { - if ($path -eq "" ) { $path = Read-Host "Enter the new filename" } - - $pathToTemplate = Resolve-Path "$PSScriptRoot/../data/templates/PowerShell.ps1" + $pathToTemplate = Resolve-Path "$PSScriptRoot/../data/templates/New.ps1" Copy-Item $pathToTemplate "$path" if ($lastExitCode -ne 0) { throw "Can't copy to: $path" } - "✅ New PowerShell script '$path' created from template 'PowerShell.ps1'." + "✅ New '$path' created (from data/templates/New.ps1)." exit 0 # success } catch { "⚠️ Error: $($Error[0])"