Skip to content

Commit

Permalink
tip: Get-Help -Online parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
deadlydog committed Feb 18, 2024
1 parent cafdc69 commit c13e756
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
$tip = [tiPS.PowerShellTip]::new()
$tip.CreatedDate = [DateTime]::Parse('2024-02-18')
$tip.Title = 'Use Get-Help -Online to view the help in your web browser'
$tip.TipText = @'
You can use Get-Help to view the documentation for a cmdlet. This will use the help files on your local machine, which may be out of date. You can update your local files with Update-Help, but it uses more disk space and may take a while to run.
To easily ensure you are viewing the most up-to-date help, use the -Online parameter. This will open the help docs in your default web browser. Some people prefer to view the help docs in their web browser because it is easily searchable, and you can have multiple tabs open at once for different cmdlets.
CAUTION: The web browser will default to showing the help for the latest version of PowerShell. If you are using an older version of PowerShell, be sure to change the version picker to the version of PowerShell you are using.
'@
$tip.Example = @'
# Use your local help, which may not be up-to-date.
Get-Help Get-Item
# Open the help in your default web browser.
Get-Help Get-Item -Online
'@
$tip.Urls = @(
'https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/get-help?view=powershell-7.4'
)
$tip.Category = [tiPS.TipCategory]::NativeCmdlet # Community, Editor, Module, NativeCmdlet, Performance, Security, Syntax, Terminal, or Other.
#$tip.ExpiryDate = [DateTime]::Parse('2024-10-30') # Optional. If the tip is not relevant after a certain date, set the expiration date. e.g. Announcing a conference or event.

# Category meanings:
# Community: Social events and community resources. e.g. PowerShell Summit, podcasts, etc.
# Editor: Editor tips and extensions. e.g. VSCode, ISE, etc.
# Module: Modules and module tips. e.g. PSScriptAnalyzer, Pester, etc.
# NativeCmdlet: Native cmdlet tips. e.g. Get-Process, Get-ChildItem, Get-Content, etc.
# Performance: Tips to improve runtime performance. e.g. foreach vs ForEach-Object, ForEach-Object -Parallel, etc.
# Security: Security tips. e.g. ExecutionPolicy, Constrained Language Mode, passwords, etc.
# Syntax: Syntax tips. e.g. splatting, pipeline, etc.
# Terminal: Terminal shortcuts and tips. e.g. PSReadLine, Windows Terminal, ConEmu, etc.
# Other: Tips that don't fit into any of the other categories.
13 changes: 12 additions & 1 deletion src/tiPS/PowerShellTips.json
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@
{
"CreatedDate": "2024-02-11T00:00:00",
"Title": "Get web request from browser dev tools",
"TipText": "Open up your web browser's developer tools (usually by pressing the F12 key) and navigate to the Network tab to see the network requests that are being made when you load a page. You can right-click on a request and copy it as PowerShell. This will copy the request and all headers as a PowerShell command that you can paste in your scripts.\r\n\r\nThis is an easy way to explore APIs and help automate flows that you typically do in the browser. You may even find APIs that are not listed in the web application's documentation, but beware that endpoints not listed in documentation may change without notice.",
"TipText": "Open up your web browser's developer tools (usually by pressing the F12 key) and navigate to the Network tab to see the network requests that are being made when you load a webpage. You can right-click on a request and copy it as PowerShell. This will copy the request and all headers as a PowerShell command that you can paste in your scripts.\r\n\r\nThis is an easy way to explore APIs and help automate flows that you typically do in the browser. You may even find APIs that are not listed in the web application's documentation, but beware that endpoints not listed in documentation may change without notice.",
"Example": "",
"Urls": [
"https://x.com/_mbanana/status/1714337624674939081?s=20"
Expand All @@ -529,5 +529,16 @@
],
"Category": 0,
"ExpiryDate": "9999-12-31T23:59:59.9999999"
},
{
"CreatedDate": "2024-02-18T00:00:00",
"Title": "Use Get-Help -Online to view the help in your web browser",
"TipText": "You can use Get-Help to view the documentation for a cmdlet. This will use the help files on your local machine, which may be out of date. You can update your local files with Update-Help, but it uses more disk space and may take a while to run.\r\n\r\nTo easily ensure you are viewing the most up-to-date help, use the -Online parameter. This will open the help docs in your default web browser. Some people prefer to view the help docs in their web browser because it is easily searchable, and you can have multiple tabs open at once for different cmdlets.\r\n\r\nCAUTION: The web browser will default to showing the help for the latest version of PowerShell. If you are using an older version of PowerShell, be sure to change the version picker to the version of PowerShell you are using.",
"Example": "# Use your local help, which may not be up-to-date.\r\nGet-Help Get-Item\r\n\r\n# Open the help in your default web browser.\r\nGet-Help Get-Item -Online",
"Urls": [
"https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/get-help?view=powershell-7.4"
],
"Category": 3,
"ExpiryDate": "9999-12-31T23:59:59.9999999"
}
]

0 comments on commit c13e756

Please sign in to comment.