mirror of
https://github.com/spf13/cobra
synced 2024-11-24 22:57:12 +00:00
Parse the full license text as a template
... to allow including "Copyright © 2015 NAME HERE" to the output LICENSE file where necessary
This commit is contained in:
parent
10546a043b
commit
6d6c92d5b7
1 changed files with 11 additions and 1 deletions
|
@ -16,6 +16,7 @@ package cmd
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
|
@ -87,7 +88,16 @@ func initalizePath(path string) {
|
||||||
|
|
||||||
func createLicenseFile() {
|
func createLicenseFile() {
|
||||||
lic := getLicense()
|
lic := getLicense()
|
||||||
err := writeStringToFile(ProjectPath(), "LICENSE", lic.Text)
|
|
||||||
|
template := lic.Text
|
||||||
|
|
||||||
|
var data map[string]interface{}
|
||||||
|
data = make(map[string]interface{})
|
||||||
|
|
||||||
|
// Try to remove the email address, if any
|
||||||
|
data["copyright"] = strings.Split(copyrightLine(), " <")[0]
|
||||||
|
|
||||||
|
err := writeTemplateToFile(ProjectPath(), "LICENSE", template, data)
|
||||||
_ = err
|
_ = err
|
||||||
// if err != nil {
|
// if err != nil {
|
||||||
// er(err)
|
// er(err)
|
||||||
|
|
Loading…
Reference in a new issue