-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Support for Creating Temp Folder
Fixes #30
- Loading branch information
1 parent
ae0eb28
commit 37c9c9a
Showing
4 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters