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

Add another prompt control string that prints out the current path relative to the repository root. #92

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

matthillman
Copy link

I find this useful as I do not print the full path in my prompt normally. This works especially well if you include a newline at the end of your git-radar prompt. Here is how it looks with my prompt:

screen shot 2015-11-06 at 9 51 11 am

My prompt string:

GIT_RADAR_FORMAT="\\x01\\033[1;32m\\x02→\\x01\\033[0m\\x02 \\x01\\033[1;36m\\x02%{git_path}\\x01\\033[0m\\x02 \\x01\\033[37m\\x02git:(\\x01\\033[0m\\x02%{remote: }%{branch}%{ :local}\\x01\\033[37m\\x02)\\x01\\033[0m\\x02%{ :stash}%{ :changes}\\x01\n\\x02"

@michaeldfallen
Copy link
Owner

Looks good. Interesting idea. I personally wouldn't use it but I can see where it would be useful. Like a project aware directory indicator telling you where you are inside your project.

It is however untested. Which would mean preventing breaking with future changes would be difficult.

Can you add tests for:

  • the git_path function:
    • to prove it's use-case
    • cover some of the corner cases (not inside a git repo, inside the .git folder, inside a folder in the repo that is then deleted)
  • the render_prompt function (tested in test-format-config.sh):
    • when the new control string is in the format
    • when the new control string is not in the format
    • when the new control string is in the format with a prefix
    • when the new control string is in the format with a suffix

That should ensure that the new indicator doesn't break on future changes.

@matthillman
Copy link
Author

Thanks for the feedback! I will work on adding the tests.

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