Giter Club home page Giter Club logo

pwsh-git-completion's Introduction

pwsh-git-completion

Simple ad-hoc git completion that works for me

Why not posh-git?

I couldn't figure out how to only get the completion to work, without loading the whole module, so I created my own that doesn't slow down your profile by ~0.5 seconds.

Also, this one tries to intelligently provide completions based on context, e.g. git add <tab> will provide a list of unstaged/modified files, while git switch <tab> provides a list of branches to switch to, etc. They are added as needed.

How to use?

Install it either manually, or from PowershellGallery with:

Install-Module pwsh-git-completion

Later, register the completions with the function Register-GitCompletion. Add it to your profile to load the completion automatically.

Support completions

This module does not support all git commands, but the ones I use most often myself. PRs are welcome to add support for more commands!

Currently, the module supports:

  • git <tab> to complete commands git add <tab> to complete unstaged files
  • git rm <tab> to complete removable files
  • git restore <tab> to complete modified, but non-staged, files
  • git checkout <tab> to complete potential refs to checkout
  • git rebase <tab> to complete potential refs to rebase upon
  • git switch <tab> to complete branches to switch to
  • git any-command -<tab> to complete flags for any command (completed by parsing git help any-command, some commands might be broken)

All completions also supports substring completions, e.g. git add .psm1<tab> will complete any unstaged files that has .psm1 in it's full path.

Requirements

Probably the latest version of Powershell, or at least PSReadLine 2.1.0.

pwsh-git-completion's People

Contributors

rehnarama avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

thejiahao

pwsh-git-completion's Issues

git --list-cmds proper usage

https://github.com/rehnarama/pwsh-git-completion/blob/1b4d4a83acce93491252b7d6a5cb32353526d6ac/pwsh-git-completion.psm1#L37C35-L37C35

The command git --list-cmds=main, others, alias, nohelpers returns only main commands because git --list-cmds does not supports spaces. It shoud be changed to git --list-cmds=main,others,alias,nohelpers. Maybe the behavior of the command was changed, since it is experimental command.

Documentation - https://git-scm.com/docs/git#Documentation/git.txt---list-cmdsgroupgroup82308203

Completion documentation

It would be of great use if you would document what completions are in this module and some examples.

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.