Skip to content

Add -Filter switch to set initial filter #109

@tig

Description

@tig

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
...

Full script here: https://gist.github.com/tig/cbbeab7f53efd73e329afd6d4b838191

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions