In the latest variant of the "F7 for History" script @SteveL-MSFT used Select-Object-like to filter the history based on what was already on the command line.
I think this would be much slicker if we could pass an initial text to the cmdlet to use as a filter. E.g.
ls | ocgv -Filter "foo"
Then the script could change to:
...
$history = Get-History | Sort-Object -Descending -Property Id | Select-Object CommandLine
$selection = $history | Out-ConsoleGridView -Title "Select CommandLine from History" -OutputMode Single -Filter $line
...
In the latest variant of the "F7 for History" script @SteveL-MSFT used
Select-Object
-like
to filter the history based on what was already on the command line.I think this would be much slicker if we could pass an initial text to the cmdlet to use as a filter. E.g.
Then the script could change to:
Full script here: https://gist.github.com/tig/cbbeab7f53efd73e329afd6d4b838191