commit a7ba71c4f2e3fe36fe9975b36ad070ac7d63e173 Author: Aoi K Date: Sun Dec 11 22:55:24 2022 -0300 Re:load Signed-off-by: Aoi K diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..ee3b638 --- /dev/null +++ b/COPYING @@ -0,0 +1,15 @@ +Discordian Public License 2.3 (DPL-2.3) + +All Rites Reversed (ΔΈ) 3188 Aoi K. [Champagne Supernova] + +Permission is hereby granted, to any person obtaining a copy of this +material without restriction, including but not limited the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the material, subject to the following conditions: + +YOU AGREE THAT THERE IS NO GODDESS BUT GODDESS AND SHE IS YOUR GODDESS & +THAT THERE IS NO ERISIAN MOVEMENT BUT THE ERISIAN MOVEMENT AND IT IS THE +ERISIAN MOVEMENT. + +HAIL ERIS! +FIVE TONS OF FLAX diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f39c3c2 --- /dev/null +++ b/Makefile @@ -0,0 +1,8 @@ +build: + go build -o gen_cvs_header +clean: + rm -f gen_cvs_header +install: + install -Dm0755 gen_cvs_header ${PREFIX}/bin/gen_cvs_header +uninstall: + rm -f ${PREFIX}/bin/gen_cvs_header diff --git a/README b/README new file mode 100644 index 0000000..f4e9af0 --- /dev/null +++ b/README @@ -0,0 +1,17 @@ +gen_cvs_header +============== +Print some fancy header like those of CVS, like OpenBSD's for pasting into your files. +Uses only the standard library. + +Build +----- +Requires the Go toolchain, the go.mod file says 1.19 but anything earlier will work I think, like 1.14 or something. + +Usage +----- +Pass the following environment variables to it with `env` or you can also export them into your shell + +* CVS_AUTHOR +* CVS_FILE +* CVS_ID +* CVS_VERSION diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..99031e5 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module git.kyoko-project.wer.ee/koizumi.aoi/gen_cvs_header + +go 1.19 diff --git a/main.go b/main.go new file mode 100644 index 0000000..623f352 --- /dev/null +++ b/main.go @@ -0,0 +1,43 @@ +package main + +import ( + "fmt" + "log" + "os" + "time" +) +func main() { + + // Load date and time into this variable + currentTime := time.Now() + + // Now split the heck out of it in another six variables + day := currentTime.Day() + month := currentTime.Month() + year := currentTime.Year() + hour := currentTime.Hour() + minute := currentTime.Minute() + second := currentTime.Second() + + // Use environment variables to add stuff here + author := os.Getenv("CVS_AUTHOR") + file := os.Getenv("CVS_FILE") + identifier := os.Getenv("CVS_ID") + version := os.Getenv("CVS_VERSION") + + // Cursed, but it's like, whatever + if len(author) == 0 { + log.Printf("$CVS_AUTHOR is not set. \n") + os.Exit(1) + } else if len(file) == 0 { + log.Printf("$CVS_FILE is not set. \n") + os.Exit(1) + } else if len(identifier) == 0 { + log.Printf("$CVS_ID is not set. \n") + os.Exit(1) + } else if len(version) == 0 { + log.Printf("$CVS_VERSION is not set. \n") + } else { + fmt.Printf("$%s: %s,v %s %d/%d/%d %d:%d:%d %s Exp $\n", identifier, file, version, year, month, day, hour, minute, second, author) + } +}