-
Notifications
You must be signed in to change notification settings - Fork 188
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
bash prompt #1379
Labels
Comments
Hmm, this could work: #!/bin/bash
__osc_prompt() {
# Git has a precedence
if [ -d .git ] ; then
# Test for the existence of bash function
declare -F __git_ps1 >/dev/null && printf "%s" "$(__git_ps1 "$@")"
return
fi
# Are we even in the OSC checkout?
[ -d .osc ] || return
local osc_binary osc_pattern osc_str;
osc_binary=$(type -p osc)
if [ -n "$1" ] ; then osc_pattern="${*}" ; else osc_pattern="(%s)" ; fi
if [ -n "$osc_binary" ] && [ -x "$osc_binary" ] && [ -f .osc/_package ] ; then
osc_str="$(osc status 2>/dev/null |cut -d' ' -f 1|sort|uniq -c|tr -d ' \n')"
# shellcheck disable=SC2059
printf " ${osc_pattern}" "$osc_str"
fi
} What do you think? |
Sorry it took me so long to look into this. |
mcepl
added a commit
to openSUSE-Python/osc
that referenced
this issue
Sep 24, 2024
Equivalent of `__git_ps1` for git. Suggested use: # Prompt for osc [[ -f /usr/share/bash-completion/completions/osc-prompt.sh ]] && \ source /usr/share/bash-completion/completions/osc-prompt.sh export PS1='\h:\W$(__osc_prompt) \$ ' Fixes openSUSE#1379
mcepl
added a commit
to openSUSE-Python/osc
that referenced
this issue
Sep 24, 2024
Equivalent of `__git_ps1` for git. Suggested use: # Prompt for osc [[ -f /usr/share/bash-completion/completions/osc-prompt.sh ]] && \ source /usr/share/bash-completion/completions/osc-prompt.sh export PS1='\h:\W$(__osc_prompt) \$ ' Fixes openSUSE#1379
mcepl
added a commit
to openSUSE-Python/osc
that referenced
this issue
Sep 24, 2024
Equivalent of `__git_ps1` for git. Suggested use: # Prompt for osc [[ -f /usr/share/bash-completion/completions/osc-prompt.sh ]] && \ source /usr/share/bash-completion/completions/osc-prompt.sh export PS1='\h:\W$(__osc_prompt) \$ ' Fixes: openSUSE#1379
mcepl
added a commit
to openSUSE-Python/osc
that referenced
this issue
Oct 23, 2024
Equivalent of `__git_ps1` for git. Suggested use: # Prompt for osc [[ -f /usr/share/bash-completion/completions/osc-prompt.sh ]] && \ source /usr/share/bash-completion/completions/osc-prompt.sh export PS1='\h:\W$(__osc_prompt) \$ ' Fixes: openSUSE#1379
mcepl
added a commit
to openSUSE-Python/osc
that referenced
this issue
Nov 5, 2024
Equivalent of `__git_ps1` for git. Suggested use: # Prompt for osc [[ -f /usr/share/bash-completion/completions/osc-prompt.sh ]] && \ source /usr/share/bash-completion/completions/osc-prompt.sh export PS1='\h:\W$(__osc_prompt) \$ ' Fixes: openSUSE#1379
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your feature request related to a problem? Please describe.
When using osc as a VCS I would like to have a similar prompt indicating the status of my checkout as I have for git. With fish shell it was a trivial to add a function:
but I don’t know how to do it with osc.
Describe the solution you'd like
Similar short snippet I would source in
~/.bashrc
.The text was updated successfully, but these errors were encountered: