diff --git a/Scripts/create-shortcut.ps1 b/Scripts/create-shortcut.ps1 index bad352cd..c8e04673 100755 --- a/Scripts/create-shortcut.ps1 +++ b/Scripts/create-shortcut.ps1 @@ -12,22 +12,22 @@ License: CC0 #> -param([string]$Shortcut = "", [string]$Target = "", [string]$Description) +param([string]$shortcut = "", [string]$target = "", [string]$description) try { - if ($Shortcut -eq "" ) { $Shortcut = read-host "Enter filename of shortcut" } - if ($Target -eq "" ) { $Target = read-host "Enter path to target" } - if ($Description -eq "" ) { $Description = read-host "Enter description" } + if ($shortcut -eq "" ) { $shortcut = read-host "Enter new shortcut filename" } + if ($target -eq "" ) { $target = read-host "Enter path to target" } + if ($description -eq "" ) { $description = read-host "Enter description" } $sh = new-object -ComObject WScript.Shell - $shortcut = $sh.CreateShortcut("$Shortcut.lnk") - $shortcut.TargetPath = "$Target" - $shortcut.WindowStyle = "1" - $shortcut.IconLocation = "C:\Windows\System32\SHELL32.dll, 3" - $shortcut.Description = "$Description" - $shortcut.save() + $sc = $sh.CreateShortcut("$shortcut.lnk") + $sc.TargetPath = "$target" + $sc.WindowStyle = "1" + $sc.IconLocation = "C:\Windows\System32\SHELL32.dll, 3" + $sc.Description = "$description" + $sc.save() - write-host -foregroundColor green "✔️ shortcut $Shortcut created." + "✔️ created shortcut $shortcut ⭢ $target" exit 0 } catch { write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" diff --git a/Scripts/create-symlink.ps1 b/Scripts/create-symlink.ps1 index fbbdf54b..60a2c072 100755 --- a/Scripts/create-symlink.ps1 +++ b/Scripts/create-symlink.ps1 @@ -12,15 +12,15 @@ License: CC0 #> -param([string]$Symlink = "", $[string]Target = "") +param([string]$symlink = "", $[string]target = "") try { - if ($Symlink -eq "" ) { $Symlink = read-host "Enter filename of symlink" } - if ($Target -eq "" ) { $Target = read-host "Enter path to target" } + if ($symlink -eq "" ) { $symlink = read-host "Enter new symlink filename" } + if ($target -eq "" ) { $target = read-host "Enter path to target" } - new-item -path "$Symlink" -itemType SymbolicLink -Value "$Target" + new-item -path "$symlink" -itemType SymbolicLink -Value "$target" - "✔️ created symlink $Symlink (pointing to $Target)" + "✔️ created symlink $symlink ⭢ $target" exit 0 } catch { write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" diff --git a/Scripts/create-tag.ps1 b/Scripts/create-tag.ps1 index 9e34982f..05c91796 100755 --- a/Scripts/create-tag.ps1 +++ b/Scripts/create-tag.ps1 @@ -2,7 +2,7 @@ .SYNOPSIS create-tag.ps1 [] [] .DESCRIPTION - Creates a new tag in the current/given Git repository + Creates a new tag in a Git repository .EXAMPLE PS> .\create-tag.ps1 v1.7 .LINK @@ -17,6 +17,8 @@ param([string]$NewTagName = "", [string]$RepoDir = "$PWD") try { if ($NewTagName -eq "") { $NewTagName = read-host "Enter new tag name" } + $StopWatch = [system.diagnostics.stopwatch]::startNew() + if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" } set-location "$RepoDir" @@ -36,7 +38,8 @@ try { & git push origin "$NewTagName" if ($lastExitCode -ne "0") { throw "Error: 'git push origin $NewTagName' failed!" } - "🔖 tag $NewTagName has been created" + [int]$Elapsed = $StopWatch.Elapsed.TotalSeconds + "✔️ created new tag '$NewTagName' in $Elapsed sec" exit 0 } catch { write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"