Skip to content

Commit

Permalink
Merge pull request #13 from tamada/implement
Browse files Browse the repository at this point in the history
update
  • Loading branch information
tamada committed Jun 14, 2021
2 parents d144527 + 723669e commit d48e923
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ COMMANDS
}

func handle(opts *options) int {
if opts.header {
fmt.Println("========== notification from NML ==========")
}
return opts.command.Execute()
}

Expand Down
14 changes: 7 additions & 7 deletions timer.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ type timer struct {

func (t *timer) Duration() time.Duration {
switch t.unit {
case "min":
case "min", "minutes":
return time.Duration(t.number) * time.Minute
case "nsec":
case "nsec", "nanoseconds", "nanosec":
return time.Duration(t.number) * time.Nanosecond
case "usec": // micro seconds
case "usec", "microseconds": // micro seconds
return time.Duration(t.number) * time.Nanosecond * time.Duration(1000)
case "msec":
case "msec", "milliseconds":
return time.Duration(t.number) * time.Nanosecond * time.Duration(1000000)
case "hour":
case "hour", "hours":
return time.Duration(t.number) * time.Hour
case "sec":
case "sec", "seconds":
return time.Duration(t.number) * time.Second
default:
return time.Second
return time.Duration(t.number) * time.Second
}
}

0 comments on commit d48e923

Please sign in to comment.