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
move common prompt to external function #1016
Conversation
|
||
if [[ "$pwd" == (#m)[/~] ]]; then | ||
# because this function is sourced from other scripts, the vars must be exported | ||
export _prompt_"${prompt}"_pwd="$MATCH" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you exporting it?
I believe the comment is self-explanatory. To go into more detail, if it isn't exported, the variable isn't available to the calling function ex: An alternative way of handling it would be to create If you know of a better way to handle it, please let me know and I will commit a change. |
This would close issue #701 |
Your prompts will share styling. In this case, it's just one function, no styling. |
@@ -0,0 +1,15 @@ | |||
# | |||
# prompt setup function common to many prompts | |||
# moved to external function to ruduce code rudundancy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: should be "reduce"
I'm merging this into a temp branch so I can make a tweak and cherry-pick it to master. I guess weird things happen when a repo is deleted while there are still PRs open. |
This has been merged into master along with some spelling fixes and a fix to ensure extendedglob is set for this function. Thanks for your contribution! |
Be careful with those functions. They are not always completely identical. I was trying to think of a naming scheme since promptpwd is not descriptive enough. |
Maybe shortpwd or something similar? |
It's still doesn't say how short it is and what's included. |
No description provided.