From 423c9e9567c1598f6a74f9d5ec628bcafc98bf87 Mon Sep 17 00:00:00 2001 From: vinchent Date: Mon, 23 Sep 2024 16:57:24 +0200 Subject: [PATCH] clockface: add main func --- .gitignore | 2 ++ main.go | 38 +++++++++++++++++++++++++++++++++++--- 2 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..774451c --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +clock.svg +gobytest diff --git a/main.go b/main.go index 5aaaa7e..542bc44 100644 --- a/main.go +++ b/main.go @@ -1,14 +1,46 @@ package main import ( - "gobytest/countdown" + "fmt" + "gobytest/clockface" + "io" "os" "time" ) func main() { // greet.Greet(os.Stdout, "Elodie") - sleeper := countdown.NewConfigurableSleeper(1*time.Second, time.Sleep) + // sleeper := countdown.NewConfigurableSleeper(1*time.Second, time.Sleep) - countdown.Countdown(os.Stdout, sleeper) + // countdown + // countdown.Countdown(os.Stdout, sleeper) + + // clockface + t := time.Now() + + sh := clockface.SecondHand(t) + io.WriteString(os.Stdout, svgStart) + io.WriteString(os.Stdout, bezel) + io.WriteString(os.Stdout, secondHandTag(sh)) + io.WriteString(os.Stdout, svgEnd) } + +func secondHandTag(p clockface.Point) string { + return fmt.Sprintf( + ``, + p.X, + p.Y, + ) +} + +const svgStart = ` + +` + +const bezel = `` + +const svgEnd = ``