henrikruscon / hyper-statusline

Status Line Plugin for Hyper
MIT License
387 stars 79 forks source link

show branch name during rebase #9

Closed jankuca closed 7 years ago

jankuca commented 7 years ago

I'd like to replace my PS1 template with this plugin but I need to see the name of the branch which is being rebased.

These are the outputs I see with my current prompt:

# on a regular branch
master

# during a rebase; this is what the plugin doesn't display
(no branch, rebasing master)

This is the function I use for getting the info:

function parse_git_branch {
  ref=$(git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1 /')
  if [ "$ref" != "" ]; then
    echo -e "\033[2;37m@\033[0;37m ${ref#refs/heads/}"
  fi
}

Is this something you would be willing to add? I might take a crack at it myself eventually.

henrikruscon commented 7 years ago

SED won't be possible since its not supported by Windows. I'll have a look at this soon ✌️

henrikruscon commented 7 years ago

@jankuca I tried but my RegEx game is too weak. SED is easier because each line comes on its own but with exec it comes in one string. If you manage the RegEx feel free to PR and I'll merge it ✌️