< Back

Set-ShieldsIoBadge

Sun Jan 12, 2020 6:52 pm

NAME Set-ShieldsIoBadge



SYNOPSIS

Modifies the link to a https://shields.io badge in a .md file. Can be used as part of a CI pipeline to update the

status of

badges such as Code Coverage.





SYNTAX

Set-ShieldsIoBadge [[-Subject] <String>] [[-Status] <Object>] [[-Color] <String>] [-AsPercentage] [[-Path]

<String>] [-WhatIf] [-Confirm] [<CommonParameters>]





DESCRIPTION

This cmdlet can be used to update the link to a https://shields.io badge that has been created in a file such as

readme.md.



To use this function You need to have initially added the badge to your readme.md or specified file by adding the

following

string (ensuring 'Subject' matches what you specify for -Subject):



![Subject]()





PARAMETERS

-Subject <String>

The label to assign to the badge. Default 'Build'.



Required? false

Position? 1

Default value Build

Accept pipeline input? false

Accept wildcard characters? false



-Status <Object>

The status text of value to assign to the badge. Default: 0.



Required? false

Position? 2

Default value 0

Accept pipeline input? false

Accept wildcard characters? false



-Color <String>

The color to assign to the badge. If status is set to 0 - 100 and this parameter is not specified, the color

is set

automatically to either green, yellow, orange or red depending on the value, or light grey if it is not a 0 -

100 value.



Required? false

Position? 3

Default value

Accept pipeline input? false

Accept wildcard characters? false



-AsPercentage [<SwitchParameter>]

Switch: Use to add a percentage sign after whatever you provide for -Status.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-Path <String>

Path to the text file to update. By default this is $Env:BHProjectPath\\Readme.md



Required? false

Position? 4

Default value "$Env:BHProjectPath\\Readme.md"

Accept pipeline input? false

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Confirm [<SwitchParameter>]



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Set-ShieldsIoBadge -Subject 'Coverage' -Status ([math]::floor(100 -

(($PesterResults.CodeCoverage.NumberOfCommandsMissed / $PesterResults.CodeCoverage.NumberOfCommandsAnalyzed) *

100))) -AsPercentage















RELATED LINKS

http://wragg.io/add-a-code-coverage-bad ... -pipeline/

https://github.com/RamblingCookieMonster/BuildHelpers

about_BuildHelpers