Skip to content
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

Support for clink completion #433

Open
zyf722 opened this issue Aug 8, 2024 · 4 comments
Open

Support for clink completion #433

zyf722 opened this issue Aug 8, 2024 · 4 comments
Milestone

Comments

@zyf722
Copy link

zyf722 commented Aug 8, 2024

Clink introduces multiple modern shell features to Windows cmd.exe, and it supports extending completions through Lua 5.2 scripts like:

clink.argmatcher("foo")
:addflags("-?", "-h", "-n", "-v", "--help", "--nothing", "--verbose")
:addarg("print", "delete")
:addarg(clink.filematches)
:nofiles()
:adddescriptions(
    { "-n", "--nothing",    description = "Do nothing; show what would happen without doing it" },
    { "-v", "--verbose",    description = "Verbose output" },
    { "-h", "--help", "-?", description = "Show help text" },
    { "print",              description = "Print the specified file" },
    { "delete",             description = "Delete the specified file" },
)

and

clink.argmatcher("git")
:addarg({
    "merge"..clink.argmatcher():addflags({
        "--strategy"..clink.argmatcher():addarg({
            "resolve",
            "recursive",
            "ours",
            "octopus",
            "subtree",
        })
    })
})

It would be great if support for generating clink completions (for tools like poetry) could be added. I'm glad to help if the idea gets considered by the team.

@Secrus
Copy link
Member

Secrus commented Aug 8, 2024

So, if I understand that correctly, we would have to generate Lua code for completions, right?

@zyf722
Copy link
Author

zyf722 commented Aug 8, 2024

@Secrus Yes, that's the case. And I believe this can be done using a template, just like how completions are generated for other shells?

@Secrus
Copy link
Member

Secrus commented Aug 8, 2024

Seems like something doable, provided that clink doesn't change their API too often. I am open to considering it, but most likely as a post-3.0 feature. Right now I want to focus on refactoring and improving already existing features.

@Secrus Secrus added this to the Future milestone Aug 8, 2024
@zyf722
Copy link
Author

zyf722 commented Aug 8, 2024

Glad to see this idea is being considered. Looking forward to it and if there is anything I can do to help, please let me know :)

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

No branches or pull requests

2 participants