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

%(prompt Prompt: ) parsing bugs #371

Closed
yarda opened this issue Feb 10, 2015 · 2 comments
Closed

%(prompt Prompt: ) parsing bugs #371

yarda opened this issue Feb 10, 2015 · 2 comments
Milestone

Comments

@yarda
Copy link

yarda commented Feb 10, 2015

The following content of .tigrc works for me:
bind generic <Ctrl-f> :!git log -G%(prompt)

But the following prompt with custom text don't work (it is not parsed or the quotes are not removed before running the command):
bind generic <Ctrl-f> :!git log -G"%(prompt Prompt: )" - Failed to format arguments
bind generic <Ctrl-f> :!git log -G"%(prompt Prompt:)" - Failed to format arguments
bind generic <Ctrl-f> :!git log -G%(prompt Prompt: ) - Failed to format arguments
bind generic <Ctrl-f> :!git log -G%(prompt Prompt:) - Failed to format arguments
bind generic <Ctrl-f> :!git log -G %(prompt Prompt: ) - Failed to format arguments
bind generic <Ctrl-f> :!git log -G %(prompt Prompt:) - Failed to format arguments
bind generic <Ctrl-f> :!git log -G "%(prompt Prompt: )" - same result as running git log -G \"%(prompt)\" i.e. wrong result, quotes are not removed
bind generic <Ctrl-f> :!git log -G '%(prompt Prompt: )' - same result as running git log -G \'%(prompt)\' i.e. wrong result, quotes are not removed

The only way which I found how to make it work correctly is not to use spaces in the prompt, i.e.:
bind generic <Ctrl-f> :!git log -G%(promptPrompt:) or for multi word prompt:
bind generic <Ctrl-f> :!git log -G%(promptSearch_regexp:)

which differs from the examples in the documentation.

@jonas
Copy link
Owner

jonas commented Feb 11, 2015

This indeed look like a bug. I think the quotes should be removed during the formatting, similar to how bash does it.

@jonas jonas added this to the tig-2.1 milestone Feb 18, 2015
@jonas jonas closed this as completed in a77f8a6 Feb 18, 2015
@thomasjachmann
Copy link

@jonas I currently also get "Failed to format arguments" whenever I add a space. I use the configuration in .gitconfig:

[tig "bind"]
  main = B !@git branch "%(prompt Branchname: )" %(commit)

This is the version with two spaces, but either one of them (between prompt and Branchname or between colon and closing bracket) leads to the error.

$ tig -v
tig version 2.4.1
ncurses version 5.7.20081102
readline version 7.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants