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 clink completion in DOS Command Prompt #921

Open
remkop opened this issue Jan 20, 2020 · 0 comments
Open

Support clink completion in DOS Command Prompt #921

remkop opened this issue Jan 20, 2020 · 0 comments
Labels
theme: auto-completion An issue or change related to auto-completion theme: integration An issue or change related to integration with other frameworks, shells or operating systems theme: shell An issue or change related to interactive (JLine) applications
Milestone

Comments

@remkop
Copy link
Owner

remkop commented Jan 20, 2020

The clink project allows TAB completion in the Command Prompt shell. The clink documentation indicates it should be possible to customize this:

Clink can be extended through its Lua API which allows easy creation context sensitive match generators, prompt filtering, and more. More details can be found in Clink's documentation which can be found here.

The above documentation link unfortunately does not show any documentation, but there is a separate clink-completions project that has Lua scripts for completing some well-known command line utilities.

Also:

Investigate how much effort it would be to generate Lua scripts for completing picocli-based commands on DOS prompt systems that have clink installed.

Example script:

--package.path = debug.getinfo(1, "S").source:match[[^@?(.*[\/])[^\/]-$]] .."modules/?.lua;".. package.path
--local matchers = require('matchers')
local parser = clink.arg.new_parser
local nested_parser = parser(
    {
        "add" .. parser({},
            "-n", "--dry-run",
            "-v", "--verbose",
            "-f", "--force",
            "-i", "--interactive",
            "-p", "--patch",
            "-e", "--edit",
            "-u", "--update",
            "-A", "--all",
            "--no-all",
            "--ignore-removal",
            "--no-ignore-removal",
            "-N", "--intent-to-add",
            "--refresh",
            "--ignore-errors",
            "--ignore-missing"
            ),
        "apply" .. parser(
            "--stat",
            "--numstat",
            "--summary",
            "--check",
            "--index",
            "--cached",
            "-3", "--3way",
            "--build-fake-ancestor=",
            "-R", "--reverse",
            "--reject",
            "-z",
            "-p",
            "-C",
            "--unidiff-zero",
            "--apply",
            "--no-add",
            "--allow-binary-replacement", "--binary",
            "--exclude=",
            "--include=",
            "--ignore-space-change", "--ignore-whitespace",
            "--whitespace=",
            "--inaccurate-eof",
            "-v", "--verbose",
            "--recount",
            "--directory="
            ),
        "branch" .. parser(
            "-v", "--verbose",
            "-q", "--quiet",
            "-t", "--track",
            "--set-upstream",
            "-u", "--set-upstream-to",
            "--unset-upstream",
            "--color",
            "-r", "--remotes",
            "--contains" ,
            "--abbrev",
            "-a", "--all",
--            "-d" .. parser({branches}):loop(1),
--            "--delete" .. parser({branches}):loop(1),
--            "-D" .. parser({branches}):loop(1),
            "-m", "--move",
            "-M",
            "--list",
            "-l", "--create-reflog",
            "--edit-description",
            "-f", "--force",
            "--no-merged",
            "--merged",
            "--column"
        ),
        "clone" .. parser(
            "--template",
            "-l", "--local",
            "-s", "--shared",
            "--no-hardlinks",
            "-q", "--quiet",
            "-n", "--no-checkout",
            "--bare",
            "--mirror",
            "-o", "--origin",
            "-b", "--branch",
            "-u", "--upload-pack",
            "--reference",
            "--dissociate",
            "--separate-git-dir",
            "--depth",
            "--single-branch", "--no-single-branch",
            "--no-tags",
            "--recurse-submodules", "--shallow-submodules", "--no-shallow-submodules",
            "--jobs"
        ),
        "column",
        "commit" .. parser(
            "-a", "--all",
            "-p", "--patch",
            "-C", "--reuse-message=",
            "-c", "--reedit-message=",
            "--fixup=",
            "--squash=",
            "--reset-author",
            "--short",
            "--branch",
            "--porcelain",
            "--long",
            "-z",
            "--null",
            "-F", "--file=",
            "--author=",
            "--date=",
            "-m", "--message=",
            "-t", "--template=",
            "-s", "--signoff",
            "-n", "--no-verify",
            "--allow-empty",
            "--allow-empty-message",
            "--cleanup", -- .. parser({"strip", "whitespace", "verbatim", "default"}),
            "-e", "--edit",
            "--no-edit",
            "--amend",
            "--no-post-rewrite",
            "-i", "--include",
            "-o", "--only",
            "-u", "--untracked-files", "--untracked-files=", -- .. parser({"no", "normal", "all"}),
            "-v", "--verbose",
            "-q", "--quiet",
            "--dry-run",
            "--status",
            "--no-status",
            "-S", "--gpg-sign", "--gpg-sign=",
            "--"
        ),
        "commit-tree",
        "fetch-pack",
        "remote"..parser({
            "add" ..parser(
                "-t"..parser({branches}),
                "-m",
                "-f",
                "--mirror",
                "--tags", "--no-tags"
            ),
            "rename"..parser({remotes}),
            "remove"..parser({remotes}),
            "rm"..parser({remotes}),
            "set-head"..parser({remotes}, {branches},
                "-a", "--auto",
                "-d", "--delete"
            ),
            "set-branches"..parser("--add", {remotes}, {branches}),
            "set-url"..parser(
                "--add"..parser("--push", {remotes}),
                "--delete"..parser("--push", {remotes})
            ),
            "get-url"..parser({remotes}, "--push", "--all"),
            "show"..parser("-n", {remotes}),
            "prune"..parser("-n", "--dry-run", {remotes}),
            "update"..parser({remotes}, "-p", "--prune")
            }, "-v", "--verbose"),
        "write-tree",
    },
    "--version",
    "--help",
    "-c",
    "--exec-path",
    "--html-path",
    "--bare",
    "--git-dir=",
    "--work-tree=",
    "--namespace="
)

clink.arg.register_parser("nested", nested_parser)
@remkop remkop added theme: auto-completion An issue or change related to auto-completion theme: shell An issue or change related to interactive (JLine) applications labels Jan 20, 2020
@remkop remkop changed the title Consider generating lua scripts for clink completion in DOS prompt Support clink completion in DOS prompt Jan 20, 2020
@remkop remkop changed the title Support clink completion in DOS prompt Support clink completion in DOS Command Prompt Jan 20, 2020
@remkop remkop added the theme: integration An issue or change related to integration with other frameworks, shells or operating systems label May 21, 2020
@remkop remkop added this to the 4.4 milestone May 21, 2020
@remkop remkop modified the milestones: 4.4, 4.5 Jun 28, 2020
@remkop remkop modified the milestones: 4.5.2, 4.6 Oct 14, 2020
remkop added a commit that referenced this issue Nov 18, 2020
@remkop remkop modified the milestones: 4.6, 4.7 Dec 26, 2020
@remkop remkop modified the milestones: 4.7, 4.8 Jun 28, 2022
@remkop remkop modified the milestones: 4.8, 4.9 Aug 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme: auto-completion An issue or change related to auto-completion theme: integration An issue or change related to integration with other frameworks, shells or operating systems theme: shell An issue or change related to interactive (JLine) applications
Projects
None yet
Development

No branches or pull requests

1 participant