JBOISES.psm1

<#
    File: JBOISES.psm1
    Author: Casper Stekelenburg
    Publisher: Casper Stekelenburg
    Copyright: © 2016 Casper Stekelenburg. All rights reserved.
    Usage: To load this module in PowerShell: Import-Module -Name JBOISES
    Notes: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
                BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
                NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
                DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
                OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#>

Function Add-Help {
<#
    .Synopsis
    This function adds help at current insertion point
    .Example
    add-help
    adds comment based help at current insertion point
    .Notes
    NAME: Add-Help
    AUTHOR: ed wilson, msft
    Modified by: Casper Stekelenburg
    LASTEDIT: 09/07/2010 17:32:34
    HSG: WES-09-11-10
    KEYWORDS: Scripting Techniques, Windows PowerShell ISE
    .Link
    Http://www.ScriptingGuys.com
    #Requires -Version 2.0
#>

$author=(Get-WmiObject win32_useraccount).FullName
$helpText = @"
    <#
    .Synopsis
        This does that
    .Description
        This function does
    .Example
        Example-
        Example- accomplishes
    .Parameter parametername
        The parameter description
    .Inputs
        None
    .Outputs
        None
    .Notes
        NAME: Example-
        AUTHOR: $author
        LASTEDIT: $(Get-Date)
        KEYWORDS:
    .LINK
        about_functions_advanced
    .LINK
        about_CommonParameters
    #>
 
"@

 $psise.CurrentFile.Editor.InsertText($helpText)
} #end function add-help
Function Add-BaseFunctionOptions {
$modulename=$psISE.CurrentFile.DisplayName.Split(".")[0]
$defaultfunctionstuff = @"
    [CmdletBinding(
        SupportsShouldProcess=$true,
        ConfirmImpact="Medium",
        HelpURI=""
    )]
    Param(
        [parameter(
            Mandatory=$true'
            ValueFromPipeline=$true,
            HelpMessage="This is a HelpMessage",
            ValueFromPipelineByPropertyName=$true
        )]
    )
"@

$psise.CurrentFile.Editor.InsertText($defaultfunctionstuff)
}
Function New-Function {
$functionstart= @"
Function Change-Name {
 
"@

$functionend= @"
 
 }
"@


$psise.CurrentFile.Editor.InsertText($functionstart)
Add-Help
Add-BaseFunctionOptions
$psise.CurrentFile.Editor.InsertText($functionend)
}

# *** Alias ***
If(!(Test-Path alias:ahlp)) {
    Set-Alias -Name ahlp -Value add-help -Description "MrEd alias" |
    Out-Null
}
If(!(Test-Path alias:abfo)) {
    Set-Alias -Name abfo -Value Add-BaseFunctionOptions -Description "Add-BaseFunctionOptions" |
    Out-Null
}
If(!(Test-Path alias:nf)) {
    Set-Alias -Name nf -Value New-Function -Description "New-Function" |
    Out-Null
}
Export-ModuleMember -alias * -function * -variable *