From f177f22cf84b8b1705c6c1a8b410b9ac87a17c5c Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Thu, 5 Jun 2025 14:13:06 +0200 Subject: [PATCH] Renamed to new-powershell-script.ps1 --- data/templates/{PowerShell.ps1 => New.ps1} | 0 ...{new-script.ps1 => new-powershell-script.ps1} | 16 +++++++--------- 2 files changed, 7 insertions(+), 9 deletions(-) rename data/templates/{PowerShell.ps1 => New.ps1} (100%) rename scripts/{new-script.ps1 => new-powershell-script.ps1} (60%) 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])"