Skip to content

Commit

Permalink
localization
Browse files Browse the repository at this point in the history
  • Loading branch information
drgrib committed Mar 18, 2017
1 parent ab6dc28 commit 16e3101
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions ttimer.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,22 @@ func mustBeNil(err error) {
}

//////////////////////////////////////////////
/// argsToDuration
/// parseArgs
//////////////////////////////////////////////

func argsToDuration(t, z string) time.Duration {
var d time.Duration
d = time.Duration(6 * time.Second)
func parseArgs(t, z string) (time.Duration, string) {
if len(t) == 1 {
// simple minute timer
minutes, err := strconv.Atoi(t)
mustBeNil(err)
d = time.Duration(minutes) * time.Minute
d := time.Duration(minutes) * time.Minute
title := fmt.Sprintf("%vm Timer", t)
return d, title
}
fmt.Println(len(z))
return d
d := time.Duration(6 * time.Second)
title := "Timer"
return d, title
}

//////////////////////////////////////////////
Expand Down Expand Up @@ -141,10 +143,11 @@ func (t *Timer) countDown() {
//////////////////////////////////////////////

func main() {
d := argsToDuration(args.t, args.z)
// pars
d, title := parseArgs(args.t, args.z)

// start timer
timer := Timer{title: "Timer"}
timer := Timer{title: title}
timer.start(d)

// run UI
Expand Down

0 comments on commit 16e3101

Please sign in to comment.