Coder Social home page Coder Social logo

Comments (9)

MichaelMure avatar MichaelMure commented on July 29, 2024 1

It will depend on better support in cobra.

There is a PR open for that but the author is on hold for personal reason.

from git-bug.

Irubataru avatar Irubataru commented on July 29, 2024

I see, interesting. I sort of assumed that shell completion was handled by separate completion scripts, but I guess it makes sense that you use the git-bug executable to handle lookup of the information that zsh etc would need.

from git-bug.

MichaelMure avatar MichaelMure commented on July 29, 2024

Better ZSH completion landed: https://github.com/MichaelMure/git-bug/tree/master/misc/zsh_completion

@Irubataru could you give it a try ?

from git-bug.

Irubataru avatar Irubataru commented on July 29, 2024

Sorry for the late reply, but I finally got around to trying it out and when I try to autocomplete git bug show I get the following message:

_arguments:comparguments:325: invalid option definition: (-f --field)-f[Select field to display. Valid values are [author,authorEmail,createTime,humanId,id,labels,shortId,status,title,actors,participants]]:
_arguments:comparguments:325: invalid option definition: (-f --field)-f[Select field to display. Valid values are [author,authorEmail,createTime,humanId,id,labels,shortId,status,title,actors,participants]]:
_arguments:comparguments:325: invalid option definition: (-f --field)-f[Select field to display. Valid values are [author,authorEmail,createTime,humanId,id,labels,shortId,status,title,actors,participants]]:

and if I try to tab complete git bug ls then I get

_arguments:comparguments:325: invalid option definition: (*-s *--status)*-s[Filter by status. Valid values are [open,closed]]:
_arguments:comparguments:325: invalid option definition: (*-s *--status)*-s[Filter by status. Valid values are [open,closed]]:
_arguments:comparguments:325: invalid option definition: (*-s *--status)*-s[Filter by status. Valid values are [open,closed]]:

I installed it wit the go get method, and placed the git-bug file in the folder you linked somewhere my zsh instance could find it.

from git-bug.

MichaelMure avatar MichaelMure commented on July 29, 2024

Ha, interesting. It's possibly because the completion is generated for git-bug and not git bug.

The bash completion require a very minimal adaptor function: https://github.com/MichaelMure/git-bug/blob/master/commands/root.go#L44-L49

Unfortunately, I have zero knowledge about ZSH completion. Would you be able to fix that ?

from git-bug.

Irubataru avatar Irubataru commented on July 29, 2024

I tried with both git-bug and git bug, and it makes no difference, so I don't think that is the issue. I think I found it though, it appears to be due to the brackets in the explanation strings, e.g. as you can see in line 141.

function _git-bug_bridge_configure {
_arguments \
'(-n --name)'{-n,--name}'[A distinctive name to identify the bridge]:' \
'(-t --target)'{-t,--target}'[The target of the bridge. Valid values are [github,launchpad-preview]]:' \
'(-u --url)'{-u,--url}'[The URL of the target repository]:' \
'(-o --owner)'{-o,--owner}'[The owner of the target repository]:' \
'(-T --token)'{-T,--token}'[The authentication token for the API]:' \
'(-p --project)'{-p,--project}'[The name of the target repository]:'
}

I use zsh, but I have never tried to write completion for it. However, if you escape the inner brackets as \[ and \] then I do not get those error messages anymore. I thought about making a quick PR for it, but it appears that you generate the completion scripts from go, so maybe you have to fix it at a different level.

Also, there is no completion for completing issue numbers. If you look at the zsh file and the bash file, you can see that the bash file has a lot more logic in it. The zsh file only completes command names and optional argument strings. I played around with it for a bit and got something basic working, so maybe I could help out with that if I ever find the time, or is that something your framework should support by itself?

from git-bug.

MichaelMure avatar MichaelMure commented on July 29, 2024

The situation is that git-bug use Cobra as the command line parser, and this library can generate the ZSH completion. They just landed a complete rewrite of this, so it's possible there is a bug lurking somewhere. The code generating the file is there: https://github.com/spf13/cobra/blob/master/zsh_completions.go

As for the custom completion of bug ID, it seems that Cobra doesn't support that at the moment for ZSH: https://github.com/spf13/cobra/blob/master/zsh_completions.md

That said, it's very much in line with what they want to support (it's possible for bash). git-bug has the ls-id command so it would be pretty easy to plug there. Note though that all te git-bug commands support giving a simple prefix, so you don't need that much the completion.

from git-bug.

MichaelMure avatar MichaelMure commented on July 29, 2024

The bracket problem is fixed with this PR upstream: spf13/cobra#899

from git-bug.

MichaelMure avatar MichaelMure commented on July 29, 2024

This has been working for long.

from git-bug.

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.