Skip to content

Adding snippet for class based argument completion #1212

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

Closed
wants to merge 1 commit into from

Conversation

powercode
Copy link

Adding a snippet with a class based Argument Completer and simple usage examples.

Is has helper functions for the most common use cases I have encountered when writing completers.

I am a bit hesitating about the examples - Do they belong here? Maybe we should have one snippet without them?

One completer with and one w/o example

Also adding placeholders for the one without example
@TylerLeonhardt
Copy link
Member

I've thought about this for a bit. I'm not sure how many folks create argument completions. If not a lot of folks do it, I'm hesitant to add this to the snippets that ship with the PowerShell extension. Feel free to change my mind!

That said, perhaps what we should have is a doc in this repo that consists of a bunch of user develop snippets for misc scenarios? In that doc we could also have instructions on how to make your own snippets so that it's easier to get started with snippets.

Thoughts? (@SeeminglyScience, @rkeithhill, and @rjmholt)

@rkeithhill
Copy link
Contributor

How about we make this an example? We could do more with our examples. There is a some stuff in there for dealing with paths but hey, the more examples the better IMO.

@powercode
Copy link
Author

I have no strong feelings about it at all. I just write completers for most of the scripts/modules I write, since I believe that is one of the greatest usability boost you can get.

I have a PR for the C# version of this in the engine, so it may be better to wait for that. This is more of a stop gap, or for Windows PowerShell

@TylerLeonhardt
Copy link
Member

@powercode do you mind if we make your snippets the first snippets to go in the "community snippets"? I've got a PR out about this:
#1246

I'll make sure to give you credit.

Copy link
Contributor

@rjmholt rjmholt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that this is part of community snippets, we should probably close this.

@rkeithhill
Copy link
Contributor

I agree with @rjmholt

@powercode powercode closed this May 12, 2018
@rkeithhill
Copy link
Contributor

rkeithhill commented May 12, 2018

@powercode Any progress on the PowerShell repo issue you submitted on simplifying tab-completion? Just spent a weekend on a tab-completer for a moderately complex native app. Kind of a PITA. I really wanted to use Native-CommandTree in TabExpansionPlusPlus but it could not handle the fact that this app has some "subcommands" that look like parameters.

@powercode
Copy link
Author

@rkeithhill It got put on hold to "get more input". Bot closed it a week ago, but I'll be back.

I've run into exactly the same issue with nct, and the work I've done so far is really only useful for cmdlet completions.

I'm still trying to figure out a good way of doing this for native commands. I have started modeling what rust is doing with https://clap.rs/. A fluent API for describing command lines, but it is too much of a WIP to share yet.

@rjmholt
Copy link
Contributor

rjmholt commented May 14, 2018

Interesting, I remember @lzybkr also talking about Rust's CLI experience in comparison to PowerShell. I feel like clap might have been what he was referring to.

@lzybkr
Copy link
Member

lzybkr commented May 14, 2018

Yes, I most likely mentioned clap, which now will automatically generate completions that include tooltips for PowerShell.

Another cli framework worth looking at is knack - used for the vsts and az clis. I recall seeing another interesting framework written in go as well, maybe used for kubernetes.

@rkeithhill
Copy link
Contributor

clap reminds me a bit of the Genghis command line parser that Chris Sells and friends developed for .NET back in 2002. http://sellsbrothers.com/12655

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants