From 4eca26eeeb2bbc00e580b4a2ea58a068c73f64e1 Mon Sep 17 00:00:00 2001 From: Oliver Lipkau Date: Sat, 8 Apr 2017 20:50:38 +0200 Subject: [PATCH] updated the help documentation of the functions implements #16 --- ConfluencePS/Public/Get-WikiPage.ps1 | 10 +++++----- ConfluencePS/Public/Get-WikiSpace.ps1 | 14 +++++++------- ConfluencePS/Public/New-WikiPage.ps1 | 24 +++++++++++++----------- ConfluencePS/Public/New-WikiSpace.ps1 | 7 ++++--- ConfluencePS/Public/Remove-WikiLabel.ps1 | 5 ++--- ConfluencePS/Public/Remove-WikiPage.ps1 | 7 +++---- ConfluencePS/Public/Remove-WikiSpace.ps1 | 12 ++++++------ 7 files changed, 40 insertions(+), 39 deletions(-) diff --git a/ConfluencePS/Public/Get-WikiPage.ps1 b/ConfluencePS/Public/Get-WikiPage.ps1 index ea779a7..118804e 100644 --- a/ConfluencePS/Public/Get-WikiPage.ps1 +++ b/ConfluencePS/Public/Get-WikiPage.ps1 @@ -7,16 +7,16 @@ Fetch Confluence pages, optionally filtering by Name/Space/ID. Piped output into other cmdlets is generally tested and supported. - .EXAMPLE - Get-WikiPage -Title Confluence -Limit 100 - Get all pages with the word Confluence in the title. Title is not case sensitive. - Among only the first 100 pages found, returns all results matching *confluence*. - .EXAMPLE Get-WikiPage -Limit 500 | Select-Object ID, Title | Sort-Object Title List the first 500 pages found in your Confluence instance. Returns only each page's ID and Title, sorting results alphabetically by Title. + .EXAMPLE + Get-WikiPage -Title Confluence -Limit 100 + Get all pages with the word Confluence in the title. Title is not case sensitive. + Among only the first 100 pages found, returns all results matching *confluence*. + .EXAMPLE Get-WikiSpace -Name Demo | Get-WikiPage Get all spaces with a name like *demo*, and then list pages from each returned space. diff --git a/ConfluencePS/Public/Get-WikiSpace.ps1 b/ConfluencePS/Public/Get-WikiSpace.ps1 index 32d032b..e4da894 100644 --- a/ConfluencePS/Public/Get-WikiSpace.ps1 +++ b/ConfluencePS/Public/Get-WikiSpace.ps1 @@ -9,24 +9,24 @@ Piped output into other cmdlets is generally tested and supported. .EXAMPLE - Get-WikiSpace -ID 123456 - Display the info of the space with ID 123456. + Get-WikiSpace + Display the info of all spaces on the server. .EXAMPLE - Get-WikiSpace -Name test - Display all spaces containing 'test' in the name. + Get-WikiSpace -SpaceKey NASA + Display the info of the space with key "NASA". .LINK https://github.com/brianbunke/ConfluencePS #> - [CmdletBinding()] - param ( + [CmdletBinding()] + param ( # Filter results by key. Supports wildcard matching on partial input. [Alias('Key')] [string]$SpaceKey, # Defaults to 25 max results; can be modified here. - [ValidateRange(1,[int]::MaxValue)] + [ValidateRange(1, [int]::MaxValue)] [int]$Limit ) diff --git a/ConfluencePS/Public/New-WikiPage.ps1 b/ConfluencePS/Public/New-WikiPage.ps1 index bc6a6da..c3f0d60 100644 --- a/ConfluencePS/Public/New-WikiPage.ps1 +++ b/ConfluencePS/Public/New-WikiPage.ps1 @@ -8,21 +8,23 @@ function New-WikiPage { Content needs to be in "Confluence storage format;" see also -Convert. .EXAMPLE - New-WikiPage -Title 'Test New Page' -ParentID 123456 -Body '

Hello world

' -WhatIf - Creates a new test page (as a child member of existing page 123456) with one line of page text. - Automatically finds 123456 in space 'ABC' via Get-WikiPage and applies the key to the REST post. - -WhatIf support, so the page will not actually be created. + New-WikiPage -Title "My new fance Page" -Body "

My Title

The body of my fancy new page.

" + Creates a new page with a given title and body content (in "confluence's storeage format"). + The information of the created page is returned to the console. + + + .EXAMPLE + New-WikiPage -Title 'Test New Page' -ParentID 123456 -Body 'Hello world' -Convert -WhatIf + Creates a new page as a child member of existing page 123456 with one line of page text. + The Body defined is converted to Storage fromat by the "-Convert" parameter .EXAMPLE - Get-WikiPage -Title 'Darth Vader' | New-WikiPage -Title 'Luke Skywalker' -Body $Body -Confirm - Searches for pages named *Darth Vader*, pipes page ID and space key. New page is a child of existing page. - Note that this can grab multiple pages via wildcard matching, potentially attempting multiple posts. - You will be asked to confirm each creation. Choose wisely. + New-WikiPage -Title "Luke Skywalker" -Parent (Get-WikiPage -title "Darth Vader" -SpaceKey "STARWARS") + Creates a new page with an empty body as a child page of the "Parent Page" in the "space" page. .EXAMPLE - New-WikiPage -Title 'Loner Page' -SpaceKey TEST -Body $Body -Convert -Verbose - Creates a new page at the root of the specified space (no parent page). Verbose flag enabled. - $Body is not yet in Confluence storage format ("XHTML-based"), and needs to be converted. + [ConfluencePS.Page]@{Title="My Title";Space=[ConfluencePS.Space]@{Key="ABC"}} | New-WikiPage + Creates a new page "My Title" in the space "ABC" with an empty body. .LINK Get-WikiPage diff --git a/ConfluencePS/Public/New-WikiSpace.ps1 b/ConfluencePS/Public/New-WikiSpace.ps1 index 78b0e35..1adad4b 100644 --- a/ConfluencePS/Public/New-WikiSpace.ps1 +++ b/ConfluencePS/Public/New-WikiSpace.ps1 @@ -7,7 +7,7 @@ Create a new blank space. Key and Name mandatory, Description recommended. .EXAMPLE - New-WikiSpace -Key 'TEST' -Name 'Test Space' + [ConfluencePS.Space]@{key="TEST";Name="Test Space"} | New-WikiSpace Create the new blank space. Runs Set-WikiInfo first if instance info unknown. .EXAMPLE @@ -18,10 +18,11 @@ https://github.com/brianbunke/ConfluencePS #> [CmdletBinding( + ConfirmImpact = 'Medium', SupportsShouldProcess = $true, - DefaultParameterSetName = "byObject", - ConfirmImpact = 'Medium' + DefaultParameterSetName = "byObject" )] + [OutputType([ConfluencePS.Space])] param ( # Space Object [Parameter( diff --git a/ConfluencePS/Public/Remove-WikiLabel.ps1 b/ConfluencePS/Public/Remove-WikiLabel.ps1 index 1985103..d85f0a7 100644 --- a/ConfluencePS/Public/Remove-WikiLabel.ps1 +++ b/ConfluencePS/Public/Remove-WikiLabel.ps1 @@ -14,9 +14,8 @@ Verbose and Confirm flags both active. .EXAMPLE - Get-WikiLabelApplied -Label asdf -Limit 100 | Remove-WikiLabel -Label asdf -WhatIf - Would remove the label "asdf" from all of your Confluence pages. -WhatIf flag supported. - This may not remove everything if the max result limit for Get-WikiLabelApplied is reached. + Get-WikiPage -SpaceKey "ABC" | Remove-WikiLabel -Label asdf -WhatIf + Would remove the label "asdf" from all pages in the ABC space. .LINK https://github.com/brianbunke/ConfluencePS diff --git a/ConfluencePS/Public/Remove-WikiPage.ps1 b/ConfluencePS/Public/Remove-WikiPage.ps1 index 7068c04..8e4d577 100644 --- a/ConfluencePS/Public/Remove-WikiPage.ps1 +++ b/ConfluencePS/Public/Remove-WikiPage.ps1 @@ -9,13 +9,12 @@ Untested against non-page content, but probably works anyway. .EXAMPLE - Get-WikiSpace -Key SESAME | Get-WikiPage -Title Oscar | Remove-WikiPage -Confirm + Get-WikiPage -Title Oscar | Remove-WikiPage -Confirm Send Oscar to the trash. Each matching page will ask you to confirm the deletion. .EXAMPLE - Get-WikiLabelApplied -Label outdated -Limit 100 | Remove-WikiPage -Verbose -WhatIf - Find the first 100 content results that are labeled "outdated." - Would remove each page one by one with verbose output; -WhatIf flag active. + Remove-WikiPage -PageID 12345,12346 -Verbose -WhatIf + Simulates the removal of two specifc pages. .LINK https://github.com/brianbunke/ConfluencePS diff --git a/ConfluencePS/Public/Remove-WikiSpace.ps1 b/ConfluencePS/Public/Remove-WikiSpace.ps1 index d8fb629..8780d92 100644 --- a/ConfluencePS/Public/Remove-WikiSpace.ps1 +++ b/ConfluencePS/Public/Remove-WikiSpace.ps1 @@ -8,13 +8,13 @@ "The space is deleted in a long running task, so the space cannot be considered deleted when this resource returns." .EXAMPLE - Remove-WikiSpace -Key XYZ -Confirm - Delete a space with key XYZ (note that key != name). Confirm will prompt before deletion. + Remove-WikiSpace -Key ABC,XYZ -Confirm + Delete the space with key ABC and with key XYZ (note that key != name). Confirm will prompt before deletion. .EXAMPLE - Get-WikiSpace -Name ald | Remove-WikiSpace -Verbose -WhatIf - Get spaces matching '*ald*' (like Reginald and Alderaan), piping them to be deleted. - Would remove each space one by one with verbose output; -WhatIf flag active. + Get-WikiSpace | Where {$_.Name -like "*old"} | Remove-WikiSpace -Verbose -WhatIf + Get all spaces ending in 'old' and simulate the deletion of them. + Would simulate the removal of each space one by one with verbose output; -WhatIf flag active. .LINK https://github.com/brianbunke/ConfluencePS @@ -35,7 +35,7 @@ [Alias('Key')] [string[]]$SpaceKey - # Probably an extra param later to loop checking the status & wait for completion? + # TODO: Probably an extra param later to loop checking the status & wait for completion? ) BEGIN {