Skip to content

Instantly share code, notes, and snippets.

@vors
Created June 5, 2017 06:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vors/d71009486ca95142653c7c29b8396123 to your computer and use it in GitHub Desktop.
Save vors/d71009486ca95142653c7c29b8396123 to your computer and use it in GitHub Desktop.
Demo for new New-ExternalHelp -ApplicableTag functionality in platyPS 0.8.0

Context

See PowerShell/platyPS#273

Before

Before if we have similar modules, or different version of the same module, we would need to have separate markdown files.

For example, let's say we have 4 modules:

  • Lync Server 2010
  • Lync Server 2013
  • Skype for Business Server 2015
  • Skype for Business Online

There is a simple cmdlet Get-Foo which present in all of them, except Lync Server 2010. Also, lets say that in Lync Server 2013 there is only one paramerer -Parameter1 on this cmdlet. But in Skype for Business Server 2015 and Skype for Business Online it also got a new parameter -Parameter2.

Previously we would need to have 4 different module folder with a lot of duplicated markdown.

Lync Server 2013

# Get-Foo

Great cmdlet

## PARAMETERS

### -Parameter1

Skype for Business Server 2015

# Get-Foo

Great cmdlet

## PARAMETERS

### -Parameter1

### -Parameter2

Skype for Business Online

# Get-Foo

Great cmdlet

## PARAMETERS

### -Parameter1

### -Parameter2

Now

Now we can combine all this duplicated markdown into a nice tight document.

All Lync and Skype for Business modules

```yaml
applicable: Lync Server 2013, Skype for Business Server 2015, Skype for Business Online
```
# Get-Foo

Great cmdlet

## PARAMETERS

### -Parameter1

### -Parameter2
```yaml
applicable: Skype for Business Server 2015, Skype for Business Online
```

Note that we don't need to specify applicable in the -Parameter1 metadata, because it exists in the all versions of Get-Foo

Now to generate maml help for lets say Skype for Business Server 2015, we just pass this as a parameter to New-ExternalHelp

New-ExternalHelp -ApplicableTag 'Skype for Business Server 2015'

And we are getting the help scoped exactly to the right cmdlets and parameters!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment