Skip to content

Commit

Permalink
feat: Finished input parser
Browse files Browse the repository at this point in the history
  • Loading branch information
Jelloeater committed Sep 1, 2024
1 parent 3ccfc1f commit e7b7845
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,17 @@ import (
)

func writeDate(format string, timezone string) {
log.Print(format)
log.Print(timezone)
_ = clipboard.WriteAll(format + timezone)

loc, e := time.LoadLocation(timezone)
if e != nil {
log.Fatal(e)
}
now := time.Now().In(loc)

timestamp := now.Format(format)
clip := timestamp
log.Print(clip + " copied to clipboard")
_ = clipboard.WriteAll(clip)

}

Expand All @@ -29,7 +37,7 @@ func mainCliApp() error {
Flags: []cli.Flag{
&cli.StringFlag{
Name: "format",
Value: "YYYY-MM-DDTHH:MM:SSZ",
Value: "2006-01-02T15:04:05Z07:00",
Usage: "Timestamp format",
},
&cli.StringFlag{
Expand All @@ -43,6 +51,7 @@ func mainCliApp() error {
format := c.String("format")
timezone := c.String("timezone")
writeDate(format, timezone)

return nil
},
}
Expand Down

0 comments on commit e7b7845

Please sign in to comment.