aboutsummaryrefslogtreecommitdiffhomepage
path: root/license.go
diff options
context:
space:
mode:
authorOphestra Umiker <cat@ophivana.moe>2024-07-16 22:07:40 +0900
committerOphestra Umiker <cat@ophivana.moe>2024-07-16 22:07:40 +0900
commit7e6eb82195c650bc34829e5cca2d2296e78c0707 (patch)
tree11f8b2d026c0f5c273a86dd0ebe79270319dd425 /license.go
parent09507a541bb3ed6e19f2e61e332b9a6c1941d17a (diff)
license: embed license in executable
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
Diffstat (limited to 'license.go')
-rw-r--r--license.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/license.go b/license.go
new file mode 100644
index 00000000..4cbe0128
--- /dev/null
+++ b/license.go
@@ -0,0 +1,26 @@
+package main
+
+import (
+ _ "embed"
+ "flag"
+ "fmt"
+ "os"
+)
+
+var (
+ //go:embed LICENSE
+ license string
+
+ printLicense bool
+)
+
+func init() {
+ flag.BoolVar(&printLicense, "license", false, "Print license")
+}
+
+func tryLicense() {
+ if printLicense {
+ fmt.Println(license)
+ os.Exit(0)
+ }
+}