Skip to content

Commit

Permalink
Update README, fix Find-AliasTips to refresh regex
Browse files Browse the repository at this point in the history
  • Loading branch information
codyduong committed Apr 11, 2024
1 parent f322628 commit 47ac1f4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,20 @@ Import-Module alias-tips
> [!IMPORTANT]
> alias-tips should be imported after all aliases declared
Everytime your aliases are updated run
Everytime your aliases are updated or changed run [`Find-AliasTips`](./docs/en-US/Find-AliasTips.md)

```powershell
Find-AliasTips
```

This will store a hash of all aliased commands to: `$HOME/.alias_tips.hash` . It is **not recommended** to run on every profile load, as this can significantly slow down your profile startup times.

Other functionality:
- [Disable-AliasTips](./docs/en-US/Disable-AliasTips.md)
- [Enable-AliasTips](./docs/en-US/Enable-AliasTips.md)
- [Find-Alias](./docs/en-US/Find-Alias.md)
- [Find-AliasTips](./docs/en-US/Find-AliasTips.md)

## Configuration

*alias-tips* can be configured via Environment Variables
Expand All @@ -78,7 +84,7 @@ This will store a hash of all aliased commands to: `$HOME/.alias_tips.hash` . It
\* This uses [ANSI Escape Codes](https://en.wikipedia.org/wiki/ANSI_escape_code), for a [table of colors](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors).
This also means alias-tips supports any other virtual terminal features: blinking/bold/underline/italics.

## How Does This Work
## How It Works

It will attempt to read all functions/aliases set in the current context.

Expand Down
13 changes: 13 additions & 0 deletions alias-tips/Public/Find-AliasTips.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,18 @@ function Find-AliasTips {
}
})

# Remove the existing job(s) and variables, to force the prompter to actually detect new aliases in the context
$existingJobs = Get-Job -Name "FindAliasTipsJob" -ErrorAction SilentlyContinue
if ($null -ne $existingJobs) {
foreach ($job in $existingJobs) {
if ($job.State -eq "Running") {
Stop-Job -Id $job.Id -Force
}
Remove-Job -Id $job.Id -Force
}
}
$global:AliasTipsProxyFunctionRegex, $global:AliasTipsProxyFunctionRegexNoArgs = $null, $null

Check warning

Code scanning / PSScriptAnalyzer

Found global variable 'global:AliasTipsProxyFunctionRegex'. Warning

Found global variable 'global:AliasTipsProxyFunctionRegex'.

Check warning

Code scanning / PSScriptAnalyzer

Found global variable 'global:AliasTipsProxyFunctionRegexNoArgs'. Warning

Found global variable 'global:AliasTipsProxyFunctionRegexNoArgs'.
Start-RegexThreadJob

Set-Content -Path $AliasTipsHashFile -Value $Value
}

0 comments on commit 47ac1f4

Please sign in to comment.