forked from security/hakurei
license: embed license in executable
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
This commit is contained in:
26
license.go
Normal file
26
license.go
Normal file
@@ -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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user