Skip to content

Commit

Permalink
Add Support for Creating Temp Folder
Browse files Browse the repository at this point in the history
Fixes #30
  • Loading branch information
danthompson-cwru committed Mar 24, 2021
1 parent ae0eb28 commit 37c9c9a
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 1 deletion.
Binary file modified Axium/1.5.0/Axium.psd1
Binary file not shown.
60 changes: 60 additions & 0 deletions Axium/1.5.0/Functions/New-AxiumSubfolder.ps1
Original file line number Diff line number Diff line change
@@ -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'
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down

0 comments on commit 37c9c9a

Please sign in to comment.