New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document TabExpansion, TabExpansion2, and ArgumentCompleter #747

Closed
HemantMahawar opened this Issue Nov 1, 2016 · 5 comments

Comments

Projects
None yet
2 participants
@HemantMahawar
Member

HemantMahawar commented Nov 1, 2016

From @MartinSGill on August 30, 2016 6:25

TabExpansion could be a really nice feature of PowerShell, but it's very difficult to easily expand it. Usually if you want to you end up writing code like this:

if (Test-Path Function:\TabExpansion) {
    Rename-Item Function:\TabExpansion TabExpansionBackup
}

This approach is fine for a single module to extend TabExpansion, but you start running into all sorts of issues (like name collisions) when multiple modules start trying to do the same thing.

It would be great if there were a mechanism to register TabExpansion functions. e.g

Register-TabExpansion -Command cmd.exe -ScriptBlock/File

Internally this function would simply be a map between the command (or an alias) and the function which would be called if the command is matched.

Once there is a consistent mechanism for TabExpansion it should be fairly easy for people to write modules to add expansions for various tools (git, rake, npm, etc), making powershell much more useable.

Copied from original issue: PowerShell/PowerShell#2130

@HemantMahawar

This comment has been minimized.

Show comment
Hide comment
@HemantMahawar

HemantMahawar Nov 1, 2016

Member

From @lzybkr on August 30, 2016 17:4

We need better documentation, but tab completion is pretty extensible right now.

Extensibility was part of the design introduced with TabExpansion2 in V3, but registering completers wasn't, so I created TabExpansionPlusPlus to help register those completers.

In V5, we added Register-ArgumentCompleter which is nearly identical to the one in TabExpansionPlusPlus. We also added the attribute ArgumentCompleter which can be used in both C# and in PowerShell.

Member

HemantMahawar commented Nov 1, 2016

From @lzybkr on August 30, 2016 17:4

We need better documentation, but tab completion is pretty extensible right now.

Extensibility was part of the design introduced with TabExpansion2 in V3, but registering completers wasn't, so I created TabExpansionPlusPlus to help register those completers.

In V5, we added Register-ArgumentCompleter which is nearly identical to the one in TabExpansionPlusPlus. We also added the attribute ArgumentCompleter which can be used in both C# and in PowerShell.

@HemantMahawar

This comment has been minimized.

Show comment
Hide comment
@HemantMahawar

HemantMahawar Nov 1, 2016

Member

From @MartinSGill on August 31, 2016 6:22

@lzybkr Thanks for pointing out those features, i'd never have realised they were there.

I certainly agree about the documentation part https://technet.microsoft.com/en-us/library/mt631420.aspx looks a bit empty, as indeed does Get-Help Register-ArgumentCompleter -Full

I think entries about_TabExpansion (and an alias about_AutoComplete) in the help would be good, and Register-ArgumentCompleter also needs some documentation.

Member

HemantMahawar commented Nov 1, 2016

From @MartinSGill on August 31, 2016 6:22

@lzybkr Thanks for pointing out those features, i'd never have realised they were there.

I certainly agree about the documentation part https://technet.microsoft.com/en-us/library/mt631420.aspx looks a bit empty, as indeed does Get-Help Register-ArgumentCompleter -Full

I think entries about_TabExpansion (and an alias about_AutoComplete) in the help would be good, and Register-ArgumentCompleter also needs some documentation.

@HemantMahawar

This comment has been minimized.

Show comment
Hide comment
@HemantMahawar

HemantMahawar Nov 1, 2016

Member

From @vors on August 31, 2016 19:51

I renamed the issue, based on the discussion.

Member

HemantMahawar commented Nov 1, 2016

From @vors on August 31, 2016 19:51

I renamed the issue, based on the discussion.

@HemantMahawar

This comment has been minimized.

Show comment
Hide comment
@HemantMahawar

HemantMahawar Nov 1, 2016

Member

From @kilasuit on August 31, 2016 20:8

There were a number of additional v5 (& now v5.1) features that could have done with clearer docs including classes.

Hopefully though with lead up to a "releasable" v6 we will be able to get this aligned and add in docs like these as well.

Member

HemantMahawar commented Nov 1, 2016

From @kilasuit on August 31, 2016 20:8

There were a number of additional v5 (& now v5.1) features that could have done with clearer docs including classes.

Hopefully though with lead up to a "releasable" v6 we will be able to get this aligned and add in docs like these as well.

@HemantMahawar

This comment has been minimized.

Show comment
Hide comment
@HemantMahawar

HemantMahawar Nov 1, 2016

Member

Register-ArgumentCompleter was documented via #743 and #744

Member

HemantMahawar commented Nov 1, 2016

Register-ArgumentCompleter was documented via #743 and #744

@joeyaiello joeyaiello changed the title from Document TabExpansion and ArgumentCompleter to Document TabExpansion, TabExpansion2, and ArgumentCompleter Aug 15, 2017

@joeyaiello joeyaiello closed this Oct 20, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment