Giter VIP home page Giter VIP logo

Comments (9)

vladimir-kotikov avatar vladimir-kotikov commented on June 18, 2024 2

This only adds autocompletion for alias itsef

@albfan, yep, i did get sorted. I think it's possible to get completions for aliased commands by making aliases function returning parsers from git_parser, This would allow to not restructure the whole git_parser as this would be very massive change. I'll take a look at this approach in the mean time

from clink-completions.

albfan avatar albfan commented on June 18, 2024 1

This only adds autocompletion for alias itsef.

But the fix is easy, just need some boilerplate code. The match from alias an real command should be keeped, and the parser should be added to aliases based on its real command.

https://github.com/vladimir-kotikov/clink-completions/blob/master/git.lua#L480

on that line you have the parser for checkout autocomplete. You need to add that autocompletion con co alias so my thoughs is you need to create a table:

parsers = {}
parsers["checkout"] =  parser({checkout_spec_generator},
         "-q", "--quiet",                    "-q", "--quiet",
         "-b",                   "-b",
         "-B",                   "-B",
         "-l",                   "-l",
         "--detach",                     "--detach",
         "-t", "--track",                    "-t", "--track",
         "--orphan",                     "--orphan",
         "-2", "--ours",                     "-2", "--ours",
         "-3", "--theirs",                   "-3", "--theirs",
         "-f", "--force",                    "-f", "--force",
         "-m", "--merge",                    "-m", "--merge",
         "--overwrite-ignore",                   "--overwrite-ignore",
         "--conflict",                   "--conflict",
         "-p", "--patch",                    "-p", "--patch",
         "--ignore-skip-worktree-bits"                   "--ignore-skip-worktree-bits"
     )

and use it later on alias and real commands

https://github.com/vladimir-kotikov/clink-completions/blob/master/git.lua#L115

here line variable have both alias and real command, that need to be keeped

https://github.com/vladimir-kotikov/clink-completions/blob/master/git.lua#L119

here search on parsers table and see if you have avaliable some parser for real command under co (checkout)

from clink-completions.

lijunle avatar lijunle commented on June 18, 2024

This function does not work in my box. :(

C:\Users\lijunle\Repos\test>git config --get-regexp alias 2>nul
alias.st status -sb
alias.ci commit
alias.br branch
alias.co checkout
alias.ft fetch -p
alias.cp cherry-pick

Command git checkout m<TAB> getting the right branch, however, git co m<TAB> does not work.

from clink-completions.

vladimir-kotikov avatar vladimir-kotikov commented on June 18, 2024

@lijunle, thanks for report. i'll investigate

from clink-completions.

glucas avatar glucas commented on June 18, 2024

As a workaround or short-term solution, Is there a way users can add their own aliases to the git_parser, without modifying git.lua directly? I'm not that familiar with the clink api, so wondering if I could do something along the lines of write my own lua file that gets the current git_parser and adds additional commands?

from clink-completions.

Dji75 avatar Dji75 commented on June 18, 2024

Hello,
Is there any news about this enhancement ? :)

from clink-completions.

Dji75 avatar Dji75 commented on June 18, 2024

@vladimir-kotikov are you still get involved in this project ?
As you seemed to say, the issue does not look so hard to fix, could we have some hope that it will be fixed soon ? ^_^

from clink-completions.

albfan avatar albfan commented on June 18, 2024

My relation with windows involves using msys2 and not reinvent the wheel.

from clink-completions.

Dji75 avatar Dji75 commented on June 18, 2024

@albfan , you make my day !
I used this link in order to use msys2 with cmder and git bash completion works perfectly, many thanks !

from clink-completions.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.