Skip to content

Commit

Permalink
no longer show empty brackets on empty time [15m0s]
Browse files Browse the repository at this point in the history
  • Loading branch information
advdv committed May 17, 2015
1 parent 93bfaa5 commit 1f784e9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion command/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,16 @@ func (c *Status) Run(ctx *cli.Context) error {
if curr != 0 && recent > curr {
fmt.Println("A new version of Timeglass is available, please upgrade from https://github.com/timeglass/glass/releases.")
}
} else if t.Seconds() == 0 {
//for script usage we return nothing when there has zero
//time elapsed, this prevents empty bracke
return nil
}

fmt.Printf(" [%s]", t)
if !ctx.Bool("time-only") {
fmt.Println()
}

fmt.Println(t)
return nil
}
2 changes: 1 addition & 1 deletion vcs/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var PrepCommitTmpl = template.Must(template.New("name").Parse(`#!/bin/sh
# @see http://git-scm.com/docs/githooks#_prepare_commit_msg
case "$2" in
message|template)
printf "$(cat $1) [$(glass status --time-only)]" > "$1" ;;
printf "$(cat $1)$(glass status --time-only)" > "$1" ;;
esac
`))

Expand Down

0 comments on commit 1f784e9

Please sign in to comment.