# <copyright file="New-GitVersionConfig.ps1" company="Endjin Limited">
# Copyright (c) Endjin Limited. All rights reserved.
# </copyright>

    Generates a default GitVersion confguration file.
    Generates a default GitVersion confguration file.
    PS C:\> New-GitVersionConfig -Path ./GitVersion.yml
    Generates the configuration file in the current directory.
    The destination path for the generated file.
    When true, overwrites any existing file.

function New-GitVersionConfig
    param (
        [string] $OutputPath = "GitVersion.yml",

        [switch] $Force

    $templatePath = "$PSScriptRoot/../../templates/gitversion.tmpl.yml"

    # If we're using the default value of OutputPath (i.e. we've not specified it when calling this function),
    # then it won't be part of the PSBoundParameters collection, so we need to add it before calling the
    # underlying template helper
    if ("OutputPath" -notin $PSBoundParameters.Keys) {
        $PSBoundParameters.Add("OutputPath", $OutputPath)

    _executeTemplate -TemplatePath $templatePath @PSBoundParameters