You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
753 B
Go
41 lines
753 B
Go
// Copyright 2018 Drone.IO Inc. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"flag"
|
|
"fmt"
|
|
"os"
|
|
|
|
"git.awesome-for.me/liuzhiguo/go-license/license"
|
|
"git.awesome-for.me/liuzhiguo/go-license/license/licenseutil"
|
|
)
|
|
|
|
var (
|
|
pub = flag.String("pub", "id_ed25519.pub", "")
|
|
file = flag.String("file", "license.txt", "")
|
|
)
|
|
|
|
func main() {
|
|
flag.Parse()
|
|
|
|
publicKey, err := licenseutil.ReadPublicKey(*pub)
|
|
if err != nil {
|
|
fmt.Println(err)
|
|
os.Exit(1)
|
|
}
|
|
|
|
l, err := license.DecodeFile(*file, publicKey)
|
|
if err != nil {
|
|
fmt.Println(err)
|
|
os.Exit(1)
|
|
}
|
|
|
|
enc := json.NewEncoder(os.Stdout)
|
|
enc.SetIndent("", " ")
|
|
enc.Encode(l)
|
|
}
|