diff --git a/license.go b/license.go index 3ff41dd..484a39d 100644 --- a/license.go +++ b/license.go @@ -24,7 +24,7 @@ var embedFS embed.FS var templates = map[string]templateInfo{ "MIT": { templateFilename: "mit.txt", - outputFilename: "LICENSE", + licenseFilename: "LICENSE", args: []string{ "[year]", "[fullname]", @@ -32,13 +32,13 @@ var templates = map[string]templateInfo{ }, "GNU GPLv3": { templateFilename: "gnu_gplv3.txt", - outputFilename: "COPYING", + licenseFilename: "COPYING", }, } type templateInfo struct { templateFilename string - outputFilename string + licenseFilename string args []string } @@ -78,5 +78,5 @@ func generateLicense(name string) (string, string, error) { licenseData = strings.ReplaceAll(licenseData, arg, value) } - return licenseData, templateInfo.outputFilename, nil + return licenseData, templateInfo.licenseFilename, nil } diff --git a/main.go b/main.go index 2e2ef88..50ace25 100644 --- a/main.go +++ b/main.go @@ -78,12 +78,12 @@ func (a *action) RunGenerate(c *cli.Context) error { fmt.Printf("What LICENSE do you chose: ") licenseName := ioe.ReadInput() - licenseData, outputFilename, err := generateLicense(licenseName) + licenseData, licenseFilename, err := generateLicense(licenseName) if err != nil { return fmt.Errorf("failed to generate license %s: %w", licenseName, err) } - outputFile := filepath.Join(a.flags.output, outputFilename) + outputFile := filepath.Join(a.flags.output, licenseFilename) if err := os.WriteFile(outputFile, []byte(licenseData), os.ModePerm); err != nil { return fmt.Errorf("failed to write file %s: %w", outputFile, err) }