jimeh / git-aware-prompt

Display current Git branch name in your terminal prompt when in a Git working directory.
Creative Commons Zero v1.0 Universal
2.16k stars 340 forks source link

Value of PS1 variable not set and the three .sh files don't have +x #73

Closed GroceryBoyJr closed 3 years ago

GroceryBoyJr commented 3 years ago

When pulling the project, the git aware prompt doesn't work "out of the box". When I looked at the value of PS1, it wasn't getting assigned by the values from prompt.sh. Turns out PS1 wasn't being acted on by prompt.sh, so I uncommented the first PS1 example in the script comments at the bottom and it worked.

As a side note, the three .sh scripts don't have eXecute bits set.

They are also missing #!/bin/bash at the top, but they work OK without it.

jimeh commented 3 years ago

Right, yes out of the box it does nothing and instead leaves it up to the user to customize their prompt as they see fit. It simply provides tools for adding the git status to your prompt, rather than replace whatever your current prompt style is. The commented out PS1 examples are just that, examples for you to use if you want, or make your own.

Apologies if the instructions in the readme are not that clear about uneventful "out of the box" experience.

As for the script files, none of them actually need to be marked as executable or have a shebang, as they're not executed. They're sourced into a running bash instance.

I'll close this issue for now, but feel free to comment further if you have any more questions or feedback :)

GroceryBoyJr commented 3 years ago

Jim - thanks for your extremely fast response! May I please ask your permission to write another article on your work but add one more step of defining PS1? (I'd like to write it for enable-sysadmin.com, which is now known as https://www.redhat.com/sysadmin/ )

James

On Thu, Nov 11, 2021 at 1:50 PM Jim Myhrberg @.***> wrote:

Closed #73 https://github.com/jimeh/git-aware-prompt/issues/73.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jimeh/git-aware-prompt/issues/73#event-5605599527, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASABLFEJNK3LM4VORTVTZ43ULQF7LANCNFSM5H3DHC6Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

jimeh commented 2 years ago

@GroceryBoyJr You're free to write any article you want about this project, or any of my projects really. And git-aware-prompt specifically is licensed under CC0 1.0 Universal, making public domain. So really you're free to do anything you like, without even asking for permission :)