Skip to content

Commit

Permalink
fix: show a message when there are no data
Browse files Browse the repository at this point in the history
/spend 30m
  • Loading branch information
Goutte committed Mar 25, 2023
1 parent 5cc7268 commit 452309a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
.DEFAULT_GOAL := build

VERSION=$(shell git describe --tags)

run:
go run main.go

sum:
go run main.go sum

build: $(shell find . -name \*.go)
go build -o build/gitime main.go
go build -o build/gitime .

test:
go test gitime/*.go
Expand Down
3 changes: 2 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ func Execute() error {
func init() {
cobra.OnInitialize(initConfig)

rootCmd.PersistentFlags().StringVar(&configFileFlag, "config", "", "config file (default is $HOME/.gitime.yaml)")
// Might use some config at some point for things like DaysInOneWeek
//rootCmd.PersistentFlags().StringVar(&configFileFlag, "config", "", "config file (default is $HOME/.gitime.yaml)")

// Snippets
//rootCmd.PersistentFlags().StringP("author", "a", "YOUR NAME", "author name for copyright attribution")
Expand Down
6 changes: 4 additions & 2 deletions cmd/sum.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ package cmd
import (
"fmt"
"github.com/goutte/gitime/gitime"
"github.com/spf13/cobra"
"github.com/tsuyoshiwada/go-gitlog"
"log"

"github.com/spf13/cobra"
)

var (
Expand Down Expand Up @@ -38,6 +37,9 @@ func formatTimeSpent(ts *gitime.TimeSpent) string {
} else {
out = ts.String()
}
if out == "" {
out = "No time-tracking directives /spend or /spent found in commits."
}
return out
}

Expand Down

0 comments on commit 452309a

Please sign in to comment.