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

Make the commits prefix configurable #40

Closed
wants to merge 1 commit into from

Conversation

reicolina
Copy link
Contributor

Please let me know if you have any feedback, suggestions or questions.

Thanks!

- Also added documentation in the README file.
@mengelbrecht
Copy link

Making the parenthesis also configurable would greatly simplify the integration of git-radar into custom prompt themes.

@reicolina
Copy link
Contributor Author

It is almost like the parenthesis would deserve a separate ENV variable. More than a prefix, it would be considered a wrapper. We could just make that variable to accept two chars; the opening and the closing char "()" Or we can have one variable for the opening "(" char or another for the closing one ")".

Alternatively we could also accept something like this "(%c)", where %c is where the commit prompt text will be placed within the wrapper. We could even make it part of the prefix variable and configure it with something like "git:(%c)" This option will require users to remember to use that %c within the ENV variable tho.

Thoughts?

@mengelbrecht
Copy link

I am voting for making it part of the prefix variable and configurable like you proposed, e.g. git:(%c).
This approach is very flexible and also simple to use.

@reicolina
Copy link
Contributor Author

Thanks for your feedback @mgee.
@michaeldfallen: any thoughts before I go ahead and modify this PR to implement what's discussed above?

@michaeldfallen
Copy link
Owner

The %c idea is interesting. This whole time I've been treating it as something you build but what if it was declarative? Something like:

%r = remote commits
%l = local commits
%b = branch name or reference
%c = file changes

then you can build anything:

git:(%r %b %l) %c, %r [%b %l] %c, branch: %b %l, etc.

Sounds very flexible way of doing it. My one concern would be that %[character] is obtuse. Maybe prefer %{[name]} i.e. delimiting with { } to show the difference between the code and the next character to render?

It would need to change the way prompt.bash and prompt.zsh works quite fundamentally, grepping through the format string to find all the %{[name]}'s and executing the correct function sequence, including printing any string characters that aren't %{[name]}s. Really nice idea though, I like it.

@reicolina
Copy link
Contributor Author

%{[name]} is the format i was looking for when i wrote %[character] 😸
I'll take a swing at this within the next day or two.
Thanks!

@michaeldfallen
Copy link
Owner

@reinaldo13 I had a few free days this week and decided to implement that proposal we were talking about. #65, what do you think?

@reicolina
Copy link
Contributor Author

It looks good @michaeldfallen! Thanks for taking the time to work on this! 🤘 and my apologies for not being able to take care of it earlier.

@michaeldfallen
Copy link
Owner

Don't worry, took me long enough to merge it anyway. Going to close this now.

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

Successfully merging this pull request may close these issues.

None yet

3 participants