コミット
a7ba71c4f2
|
@ -0,0 +1,15 @@
|
||||||
|
Discordian Public License 2.3 (DPL-2.3)
|
||||||
|
|
||||||
|
All Rites Reversed (ĸ) 3188 Aoi K. [Champagne Supernova] <koizumi.aoi@kyoko-project.wer.ee>
|
||||||
|
|
||||||
|
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
|
|
@ -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
|
|
@ -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
|
|
@ -0,0 +1,3 @@
|
||||||
|
module git.kyoko-project.wer.ee/koizumi.aoi/gen_cvs_header
|
||||||
|
|
||||||
|
go 1.19
|
|
@ -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)
|
||||||
|
}
|
||||||
|
}
|
読み込み中…
新しいイシューから参照