Comments (9)
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.
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.
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.
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.
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.
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.
git-bug/misc/zsh_completion/git-bug
Lines 138 to 146 in aa4464d
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.
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.
The bracket problem is fixed with this PR upstream: spf13/cobra#899
from git-bug.
This has been working for long.
from git-bug.
Related Issues (20)
- Web UI: Edit Labels HOT 1
- `git bug user`: unable to adopt identity, delete existing identity HOT 13
- Error: the repository you want to access is already locked HOT 9
- gokart-pre checksum mismatch HOT 2
- Version flag is missing in 0.8.0 HOT 1
- Import Jira through JQL query? HOT 1
- git bug rewrites .git/config and loses comments HOT 3
- Error: error creating SSH agent: "SSH agent requested but SSH_AUTH_SOCK not-specified" on `git bug push` HOT 4
- Sourcehut Support HOT 6
- Error when querying bugs with 1+ parameters HOT 3
- Feature request: Import from JSON? HOT 5
- Best practices for referencing a `git-bug` issue in a commit? HOT 3
- Separate command (or option) to pull user identities from remote HOT 1
- CLI comment edit does not load original comment in text editor HOT 1
- git bug push fails with SHA-1 key message HOT 3
- problem with gitlab push HOT 2
- Critical security vulnerabilities in Go's standard library
- How to change token for github bridge? HOT 20
- `execenv.NewEnv()` is called in each Cobra command constructor
- TUI: Edit Labels HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from git-bug.