Skip to content

Commit

Permalink
chg: allow negative value for to and to without from #47
Browse files Browse the repository at this point in the history
  • Loading branch information
mutschler committed Dec 18, 2024
1 parent 25d5908 commit 1f4b5d6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions mt.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,6 @@ func GenerateScreenshots(fn string) []image.Image {
from := stringToMS(viper.GetString("from"))
end := stringToMS(viper.GetString("end"))

if from > end {
log.Fatalf("from cant be higher than to")
}
if from > 0 {
log.Infof("First screenshot will be at %s", viper.GetString("from"))
}
Expand All @@ -120,7 +117,12 @@ func GenerateScreenshots(fn string) []image.Image {
}

if end > 0 {
duration = end
if strings.HasPrefix(viper.GetString("end"), "-") {
log.Infof("to option is negative, substracting %s from end of file", viper.GetString("end"))
duration = duration - end
} else {
duration = end
}
}

if from > 0 {
Expand Down

0 comments on commit 1f4b5d6

Please sign in to comment.