From 37c9c9abd169a25b25fd4afa549e0263bba04528 Mon Sep 17 00:00:00 2001 From: Daniel Thompson Date: Wed, 24 Mar 2021 15:21:34 -0400 Subject: [PATCH] Add Support for Creating Temp Folder Fixes #30 --- Axium/1.5.0/Axium.psd1 | Bin 6398 -> 6492 bytes Axium/1.5.0/Functions/New-AxiumSubfolder.ps1 | 60 +++++++++++++++++++ CHANGELOG.md | 2 +- README.md | 1 + 4 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 Axium/1.5.0/Functions/New-AxiumSubfolder.ps1 diff --git a/Axium/1.5.0/Axium.psd1 b/Axium/1.5.0/Axium.psd1 index 3873f5de9424deb5acba2e462469f1086eee800b..6f5f0f28a929644549390cd815211a6c3f818180 100644 GIT binary patch delta 71 zcmexoc*kgi3HM|cP6=f{hE#@f23-b6h6;vEhEj%HhF~C>#E{02&yd5A0+cPc W22#wL$B@WSJlT+2b#t8H0(Jm&fe^(2 delta 21 dcmca(^v`gE3HRnAZVtA|Mchi8_XsXv2LN7E2gCpX diff --git a/Axium/1.5.0/Functions/New-AxiumSubfolder.ps1 b/Axium/1.5.0/Functions/New-AxiumSubfolder.ps1 new file mode 100644 index 0000000..9fc5925 --- /dev/null +++ b/Axium/1.5.0/Functions/New-AxiumSubfolder.ps1 @@ -0,0 +1,60 @@ +function New-AxiumSubfolder { + <# + .SYNOPSIS + Creates a subfolder under a folder containing a copy of axiUm. + + .DESCRIPTION + Creates a subfolder under a folder containing a copy of axiUm. This is useful to create a folder to + hold temporary files, such as the ones needed for printing letters. + + Aliases: nas + + .INPUTS + System.String + + .OUTPUTS + System.IO.DirectoryInfo + + .NOTES + Author : Dan Thompson + Copyright : 2020 Case Western Reserve University + #> + + [CmdletBinding(SupportsShouldProcess)] + [OutputType([System.IO.DirectoryInfo])] + + param( + # The path to a folder that may contain a copy of axiUm. + # + # Aliases: p + [Parameter( + Position = 0, + ValueFromPipeline = $True, + ValueFromPipelineByPropertyName = $True, + Mandatory = $True + )] + [ValidateNotNullOrEmpty()] + [string]$Path, + + # The name of the folder to create if it doesn't already exist. + # + # Aliases: n + [ValidateNotNullOrEmpty()] + [string]$Name = 'Temp' + ) + + process { + $Output = $Null + + if ($Path | Test-AxiumCopy -Verbose:$VerbosePreference) { + Write-Verbose -Message """$Path"" contains a copy of axiUm." + $Output = New-Item -Path $Path -Name $Name -Verbose:$VerbosePreference -WhatIf:$WhatIfPreference + } else { + Write-Verbose -Message """$Path doesn't contain a copy of axiUm. Nothing to do." + } + + $Output + } +} + +New-Alias -Name 'nas' -Value 'New-AxiumSubfolder' diff --git a/CHANGELOG.md b/CHANGELOG.md index ee69dce..a523c43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,4 +38,4 @@ * Added missing documentation for `Test-AxiumCopy` to `README.MD`. Fixes issue #29. # Version 1.5.0 - +* Added `New-AxiumSubfolder`. Fixes issue #30. diff --git a/README.md b/README.md index afef7a6..89665e5 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,7 @@ You will probably want to call the following functions directly: * `Install-AxiumWorkstation` * `Write-AxiumFix` * `Test-AxiumCopy` +* `New-AxiumSubfolder` The following are used mainly by other functions, and usually don't need to be called directly: * `Get-IPAddresses`