From 8843672d66e8bbef19c1769379e668121c539a64 Mon Sep 17 00:00:00 2001 From: Cody Duong Date: Thu, 11 Apr 2024 02:34:47 -0500 Subject: [PATCH] Update README and remove unused --- README.md | 14 +++++++++++--- alias-tips/Public/Find-Alias.ps1 | 8 -------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 2b26b7d..98c8e16 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,10 @@ Install the module from the [PowerShell Gallery](https://www.powershellgallery.c Install-Module alias-tips -AllowClobber ``` -Inside your PowerShell profile +Inside your PowerShell profile, import alias tips. + +> [!IMPORTANT] +> alias-tips should be imported after all aliases declared ```powershell Import-Module alias-tips @@ -69,14 +72,17 @@ This will store a hash of all aliased commands to: `$HOME/.alias_tips.hash` . It | ALIASTIPS_DEBUG | `$false` | Enable to show debug messages when processing commands | | ALIASTIPS_HASH_PATH | `[System.IO.Path]::Combine("$HOME", '.alias_tips.hash')` | File Path to store results from `Find-AliasTips` | | ALIASTIPS_MSG | `"Alias tip: {0}"` | Alias hint message for non-virtual terminals | -| ALIASTIPS_MSG_VT | `` `e[033mAlias tip: {0}`em" `` | Alias hint message for virtual terminals | +| ALIASTIPS_MSG_VT | `` `e[033mAlias tip: {0}`em" `` | Alias hint message for virtual terminals* | | ALIASTIPS_FUNCTION_INTROSPECTION | `$false` | **POTENTIALLY DESTRUCTIVE** [Function Alias Introspection](#function-alias-introspection) | +\* 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 It will attempt to read all functions/aliases set in the current context. -### Example Interactions +### Example Interactions/Limitations #### Alias ```powershell @@ -90,6 +96,8 @@ function grbi { git rebase -i $args } ``` +> [!NOTE] +> This has a limitation in that alias-tips does not know in this case that -i is equivalent to the --interactive flag. #### Function Alias Introspection diff --git a/alias-tips/Public/Find-Alias.ps1 b/alias-tips/Public/Find-Alias.ps1 index e4310ba..bc985c2 100644 --- a/alias-tips/Public/Find-Alias.ps1 +++ b/alias-tips/Public/Find-Alias.ps1 @@ -44,14 +44,6 @@ function Find-Alias { $tokens = @() $ast = [System.Management.Automation.Language.Parser]::ParseInput($Line, [ref]$tokens, [ref]$null) - $fastAlias = Find-AliasCommand ($tokens.Text -join " ") - - # fastAlias is not appreciably faster but is definetly less stable, disable for now? - # if (-not [string]::IsNullOrEmpty($fastAlias)) { - # Write-Verbose "Found alias without resorting to parsing" - # return $fastAlias - # } - $queue = [System.Collections.ArrayList]::new() $extents = @(0, 0) $offset = 0