Document IArgumentCompleterFactory and parameterized ArgumentCompleters · Issue #7390 · MicrosoftDocs/PowerShell-Docs · GitHub
Skip to content

Document IArgumentCompleterFactory and parameterized ArgumentCompleters #7390

Closed

Description

Summary of the new document or enhancement

PowerShell/PowerShell#12605 adds support for parameterized argument completers.

This will be available in PowerShell 7.2.

By deriving from ArgumentCompleterAttribute and Implement IArgumentCompleterFactory, the derived attribute can use properties set on the attribute to control the IArgumentCompleter instance that is created.

This allows more generic implementations of completers.

The interface is really simple.
It is only a single method.

IArgumentCompleter Create();

Examples of how this can be used are shown below:

[DirectoryCompleter(ContainingFile="pswh.exe", Depth=2)]

[DateCompleter(WeekDay='Monday', From="LastYear")]

[GitCommits(Branch='release')]

Details of requested document:

  • Proposed title: Parameterized Argument Completers.
  • Propose location in the TOC:
  • Target audience: Developers and advanced scripters
  • Purpose or scenario:
    or
    Proposed changes/additions to existing article:
  • List of related articles to link to: IArgumentCompleter

Activity

  1. sdwheeler commented on Mar 29, 2021

    @sdwheeler
    Contributor

    Staffan Gustafsson (@powercode) does this work in scripts? Can you provide a scripted example?

  2. added 2 commits that reference this issue on Jul 27, 2021
    4866b03
    1f04129
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions