Skip to content

Commit

Permalink
Merge branch 'release/0.0.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
repejota committed Sep 7, 2016
2 parents b3c30d5 + be9f250 commit 76908ee
Show file tree
Hide file tree
Showing 8 changed files with 93 additions and 10 deletions.
11 changes: 5 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,15 @@ build:
go build -v ${LDFLAGS}

test:
go test -v ./... --cover

cover:
go test -coverprofile cover.out
goveralls -repotoken k7kIkhp7ub6iz1gIEBGOjmOvhuPJB7Dki
./contrib/go.test.sh

lint:
golint ./...
go vet ./...

dev-deps:
go get -u github.com/golang/lint/golint

dist: dist-linux dist-darwin dist-windows

dist-linux:
Expand All @@ -42,7 +41,7 @@ dist-windows:
clean:
go clean
rm -rf psh-*
rm cover.out
rm -rf cover.out

reload:
source ./contrib/install.sh
32 changes: 29 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,35 @@

A prompt generator

Master : [![CircleCI](https://circleci.com/gh/repejota/psh/tree/master.svg?style=svg)](https://circleci.com/gh/repejota/psh/tree/master)
* Master : [![CircleCI](https://circleci.com/gh/repejota/psh/tree/master.svg?style=svg)](https://circleci.com/gh/repejota/psh/tree/master)
* Develop : [![CircleCI](https://circleci.com/gh/repejota/psh/tree/develop.svg?style=svg)](https://circleci.com/gh/repejota/psh/tree/develop)

![psh screenshot](https://github.com/repejota/psh/raw/master/shot.png "psh screenshot")
* Coverage Master: [![codecov](https://codecov.io/gh/repejota/psh/branch/master/graph/badge.svg)](https://codecov.io/gh/repejota/psh)
* Coverage Develop: [![codecov](https://codecov.io/gh/repejota/psh/branch/develop/graph/badge.svg)](https://codecov.io/gh/repejota/psh)

* Go Report Card: [![Go Report Card](https://goreportcard.com/badge/github.com/repejota/psh)](https://goreportcard.com/report/github.com/repejota/psh)

## Installation

How to install:

```
$ go get -u github.com/repejota/sh
```

And use this on your `.bash_profile`

Coverage Master: [![Coverage Status](https://coveralls.io/repos/github/repejota/psh/badge.svg?branch=master)](https://coveralls.io/github/repejota/psh?branch=master)
```
# Usage:
# $ source install.sh
function __psh {
PS1="$(psh)"
}
export PS1="$(psh)"
PROMPT_COMMAND=__psh
```

## Screenshot

![psh screenshot](https://github.com/repejota/psh/raw/master/shot.png "psh screenshot")
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.4
0.0.5
5 changes: 5 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
test:
override:
- make test
post:
- bash <(curl -s https://codecov.io/bash)
12 changes: 12 additions & 0 deletions contrib/go.test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

set -e
echo "" > cover.out

for d in $(go list ./... | grep -v vendor); do
go test -coverprofile=profile.out -covermode=atomic $d
if [ -f profile.out ]; then
cat profile.out >> cover.out
rm profile.out
fi
done
3 changes: 3 additions & 0 deletions git.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"strings"
)

// getGitBranch returns the current git branch name
func getGitBranch() string {
out, err := exec.Command("git", "rev-parse", "--abbrev-ref", "HEAD").Output()
if err != nil {
Expand All @@ -16,6 +17,7 @@ func getGitBranch() string {
return strings.Trim(string(out), "\n")
}

// getGitChanges counts the number of changes on this repo
func getGitChanges() int {
out, err := exec.Command("git", "status", "-s", "--porcelain").Output()
if err != nil {
Expand All @@ -29,6 +31,7 @@ func getGitChanges() int {
return changes
}

// getGitPartial builds Git partial string
func getGitPartial() string {
partial := ""
if existsPath(".git") {
Expand Down
21 changes: 21 additions & 0 deletions options_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package main

import "testing"

func TestDefaultOptions(t *testing.T) {
var options Options

options.setDefaults()

if !options.JobsPartial {
t.Error("Expected true but found ", options.JobsPartial)
}

if !options.PathPartial {
t.Error("Expected true but found ", options.PathPartial)
}

if !options.GitPartial {
t.Error("Expected true but found ", options.GitPartial)
}
}
17 changes: 17 additions & 0 deletions utils_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package main

import "testing"

func TestExistPath(t *testing.T) {
ep := existsPath(".git")
if !ep {
t.Error("Expected true, got ", ep)
}
}

func TestDoNotExistPath(t *testing.T) {
ep := existsPath("foobar")
if ep {
t.Error("Expected false, got ", ep)
}
}

0 comments on commit 76908ee

Please sign in to comment.