From 264eedd46071bbf13c30df30c40cb48304776e66 Mon Sep 17 00:00:00 2001 From: TyostoKarry <114697841+TyostoKarry@users.noreply.github.com> Date: Sat, 21 Mar 2026 19:48:44 +0200 Subject: [PATCH] Add novelty --good-night command Create --good-night command that greets the user with good night ascii art - Create internal/goodnight with 12 unique ascii good night arts and a function to diplay one at random - Add --good-night flag to and functionality to main --- internal/goodnight/goodnight.go | 168 ++++++++++++++++++++++++++++++++ main.go | 8 ++ 2 files changed, 176 insertions(+) create mode 100644 internal/goodnight/goodnight.go diff --git a/internal/goodnight/goodnight.go b/internal/goodnight/goodnight.go new file mode 100644 index 0000000..21b8afc --- /dev/null +++ b/internal/goodnight/goodnight.go @@ -0,0 +1,168 @@ +package goodnight + +import "math/rand" + +var goodNightArts = []string{ + ` +* . * . * . * +. _ . * . +* (o,o) . * . +. ( : ) * . * + ("_("_) . * . +~ ~ ~ ~ ~ ~ ~ +. * . * . + hoot hoot ~ +`, + ` +. * . * . * . * . +* ( ● )( ◑ )( ○ ) * +. * . * +* . * +. * . * . +* . * . * . * . * + drift off ~ +`, + ` +* . * . * . * +. * . * . * +* ) ) ) +. ( ( ( * . + . ) ) ) ) . * +* ( ( ( ( ( +. | | * . * +. | ~~~ | + \_____/ * * . +~ ~ ~ ~ ~ ~ ~ ~ + rest well ~ +`, + ` +. * . . . * . . . +. . * . . . * . * +. . * . * . +* * . * . * +. * * . . +* * . . * * +. * * * . + follow the lights home +`, + ` + * . * . * . +. +--------------------+ +* | i . i . i . i| +. | i . i . i . i| +* | . i . i . i .| +. | . i . i . i .| +* | i . i . i . i| +. +--------------------+ + nothing like rain to + drift off to +`, + ` + * . * . * . +. * . * . * + . * ( ( ) ) . * +* . ) __ ( . * +. (_(____) * +* . | ~~~~| . * +. | | . +* . \____/ . * +. ~ ~ ~ ~ ~ . +* sip & sleep * +. * . * . * +`, + ` + * . * . * . +. * . * . * +* . * . * . +. * /\ * . * +* . / \ . * +. / zZ \ * . +* . / zZ \ . * +. /_______ \ . +* ./___________\. * +~~~~~~~~~~~~~~~~~~~~~~~~ +. camp under stars . +`, + ` +. * . · . * . · . +· . * . · . * . * +. · ✦ . ✦ . +* ✦ . ✦ . * +. ✦ ✦ . . +* ✦ . . ✦ * +. ✦ ✦ ✦ . +* . · . * . · . * +. follow the light +* into dreamland . * +`, + ` +. * . * . * . * +* . +. |\_/| * * +* |o o|__. . +. \ / \ * * +* /| | | . +. (_| |____) * * +* . +. * . * . * . * + purrfect dreams ~ +`, + ` +. * . * . * . * +* . * . . +. * ________ * * +* / . * \ . +. | . * * | * * +* | . * . * | . +. | * . * | * * +* \________/ . +. * . * . * . * + jar of tiny lights ~ + Sleep thight ~ +`, + ` + * . * . * +. * . +* . * * . * +. _______________ . +* | ___________ | * +. | | chapter | | . +* | | 37: the | | * +. | | sleepy | | . +* | | ending | | * +. | |___________| | . +* |_______________| * + one more page... ~ +`, + ` +* . * . * . +. * . * . +* . * . * +. /\ . +* / \ * +. / .. \ . +* / .''. \ * +. / .' '. \ . +* / ' zZ ' \ * +. /____________ \ . +* ~~~~~~~~~~~~~~~~ * + tent under stars ~ +`, + ` +* . * . * . +. ________________ . +* | . * . |* +. | * . * . * |. +* | LOADING |* +. | DREAMS |. +* | [======== ] |* +. | 78%% ... |. +* |________________|* +. * . * . *. + almost there ~ +`, +} + +func RandomGoodNightArt() string { + return goodNightArts[rand.Intn(len(goodNightArts))] +} diff --git a/main.go b/main.go index fbaa334..af3856f 100644 --- a/main.go +++ b/main.go @@ -4,6 +4,7 @@ import ( "fmt" "os" + "github.com/TyostoKarry/sleepycli/internal/goodnight" "github.com/spf13/pflag" ) @@ -18,6 +19,7 @@ func main() { bufferFlag int cyclesMaxFlag int cyclesMinFlag int + goodNightFlag bool versionFlag bool ) @@ -28,6 +30,7 @@ func main() { pflag.IntVarP(&bufferFlag, "buffer", "b", 15, "Fall asleep buffer in minutes") pflag.IntVarP(&cyclesMinFlag, "cycles-min", "n", 4, "Minimum cycles to show") pflag.IntVarP(&cyclesMaxFlag, "cycles-max", "x", 6, "Maximum cycles to show") + pflag.BoolVarP(&goodNightFlag, "good-night", "", false, "Display a random good night art") pflag.BoolVarP(&versionFlag, "version", "v", false, "Print version") pflag.Parse() @@ -37,6 +40,11 @@ func main() { os.Exit(0) } + if goodNightFlag { + fmt.Println(goodnight.RandomGoodNightArt()) + os.Exit(0) + } + if err := validateAndSelectMode(wakeFlag, sleepFlag, fromFlag, toFlag, bufferFlag, cyclesMinFlag, cyclesMaxFlag); err != nil { fmt.Fprintln(os.Stderr, "Error:", err) os.Exit(1)