]> git.ardis.lu - ArdisUtilities/commitdiff
Remove unnecessary function wrapper
authorArdis Lu <ardisglu@gmail.com>
Mon, 27 May 2024 20:23:55 +0000 (13:23 -0700)
committerArdis Lu <ardisglu@gmail.com>
Mon, 27 May 2024 20:23:55 +0000 (13:23 -0700)
install.ps1

index a1069c40d868fbeec36a89d8a40e84ff4d62001f..158b146b7f80aae8a838e31386dbbfead221d49d 100644 (file)
@@ -1,40 +1,36 @@
-function Install-ArdisUtilities {
-  [OutputType([System.Void])]
-  [CmdletBinding()]
-  param(
-    [Parameter()]
-    [Switch]$Persist
-  )
+[OutputType([System.Void])]
+[CmdletBinding()]
+param(
+  [Parameter()]
+  [Switch]$Persist
+)
 
-  begin {
-    # Create a temporary working folder
-    $tempFolder = Join-Path $Env:Temp $(New-Guid)
-    New-Item -Type Directory -Path $tempFolder | Out-Null
-  }
+begin {
+  # Create a temporary working folder
+  $tempFolder = Join-Path $Env:Temp $(New-Guid)
+  New-Item -Type Directory -Path $tempFolder | Out-Null
+}
 
-  process {
-    # Download and extract the repository from GitHub
-    $zipFile = Join-Path $tempFolder /ArdisUtilities.zip
-    Invoke-WebRequest 'https://github.com/ardislu/ArdisUtilities/archive/refs/heads/main.zip' -OutFile $zipFile
-    Expand-Archive $zipFile $tempFolder
-    $module = Join-Path $tempFolder 'ArdisUtilities-main/ArdisUtilities'
+process {
+  # Download and extract the repository from GitHub
+  $zipFile = Join-Path $tempFolder /ArdisUtilities.zip
+  Invoke-WebRequest 'https://github.com/ardislu/ArdisUtilities/archive/refs/heads/main.zip' -OutFile $zipFile
+  Expand-Archive $zipFile $tempFolder
+  $module = Join-Path $tempFolder 'ArdisUtilities-main/ArdisUtilities'
 
-    # Import the module from the extraction
-    Import-Module $module
+  # Import the module from the extraction
+  Import-Module $module
 
-    if ($Persist) {
-      $destination = "$HOME/Documents/PowerShell/Modules" # Default path for persistent PowerShell modules
-      if (Test-Path -LiteralPath "$destination/ArdisUtilities") {
-        Remove-Item "$destination/ArdisUtilities" -Force -Recurse
-      }
-      Copy-Item -Path $module -Destination $destination -Recurse
+  if ($Persist) {
+    $destination = "$HOME/Documents/PowerShell/Modules" # Default path for persistent PowerShell modules
+    if (Test-Path -LiteralPath "$destination/ArdisUtilities") {
+      Remove-Item "$destination/ArdisUtilities" -Force -Recurse
     }
-  }
-
-  clean {
-    # Clean up the temporary folder
-    Remove-Item $tempFolder -Force -Recurse
+    Copy-Item -Path $module -Destination $destination -Recurse
   }
 }
 
-Install-ArdisUtilities @args
+clean {
+  # Clean up the temporary folder
+  Remove-Item $tempFolder -Force -Recurse
+}
This page took 0.049335 seconds and 4 git commands to generate.