Skip to content

Commit

Permalink
Fixed bug with branch regex (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
claesgill authored Sep 26, 2020
1 parent 83ea13a commit c704005
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## [0.0.2]

### Fixed
- Fixed bug with branch regex #1

## [0.0.1]


Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
all: build run move

dev: build run

run:
@./bin/gp -status

Expand Down
Binary file modified bin/gp
Binary file not shown.
6 changes: 4 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func main() {
status := flag.Bool("status", false, "formatting git status if any")
flag.Parse()
if *vers == true {
fmt.Println("Git Prettier version v0.0.1")
fmt.Println("Git Prettier version v0.0.2")
os.Exit(1)
}
if *status {
Expand All @@ -36,7 +36,9 @@ func gitBranch() (string){
cmd := exec.Command("git", "branch")
output, err := cmd.Output()
if err != nil {}
branch := strings.Split(string(output[:]), "* ")
rBranch := regexp.MustCompile(`^\*\s.*`)
branch := rBranch.FindAllString(string(output[:]), 1000)
branch = strings.Split(strings.Join(branch, ""), "* ")
parsBranch := strings.Join(branch, "")
return strings.TrimSuffix(parsBranch, "\n")
}
Expand Down

0 comments on commit c704005

Please sign in to comment.