Public/New-DevDirectory.ps1

function New-DevDirectory {
    <#
    .SYNOPSIS
    Creates one or more directories, including nested paths.

    .DESCRIPTION
    Creates each requested directory (and any missing parent segments)
    relative to -BasePath. Each path is rejected if it is rooted or escapes
    -BasePath via a '..' segment. Directories that already exist are left
    untouched.

    .PARAMETER Path
    One or more relative directory paths to create, e.g. 'src/core'.

    .PARAMETER BasePath
    Directory the paths are resolved against. Defaults to the current location.

    .EXAMPLE
    mkd src/core

    .EXAMPLE
    mkd src/adapters, tests/unit, docs
    #>

    [CmdletBinding(SupportsShouldProcess = $true)]
    [Alias('mkd')]
    [OutputType([System.IO.DirectoryInfo[]])]
    param(
        [Parameter(Mandatory = $true, Position = 0)]
        [string[]]$Path,

        [Parameter()]
        [string]$BasePath = (Get-Location).Path
    )

    $resolvedPaths = foreach ($childPath in $Path) {
        Resolve-DtContainedPath -BasePath $BasePath -ChildName $childPath
    }

    if (-not $PSCmdlet.ShouldProcess(($resolvedPaths -join ', '), 'Create directories')) {
        return
    }

    foreach ($resolvedPath in $resolvedPaths) {
        New-DtDirectory -Path $resolvedPath -Force -Confirm:$false | Out-Null
        Get-Item -LiteralPath $resolvedPath
    }
}