Skip to content
Myr

Change generator default license to none

Before adoption: this commit came in with the history the project adopted, so no landing records it.

It's questionable that a default license makes any sense from a legal perspective. If the tool created the license without the user choosing it, then it may not even be applicable. Best to let the user choose their license with intent.

authored by Steve Francia · committed by Steve Francia · parent dcf42b2 · Browse files · 4 files+7 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

4 files+7 added−5 removed

  • other:+7 added−5 removed

4 files+7 added−5 removed

modified:cobra/cmd/add_test.go+1 added
8 unmodified lines
9)1011func TestGoldenAddCmd(t *testing.T) {12 viper.Set("useViper", true)13 viper.Set("license", "apache")14 command := &Command{15 CmdName: "test",16 CmdParent: parentName,17 Project: getProject(),
37 unmodified lines
modified:cobra/cmd/init_test.go+1 added
59 unmodified lines
60 t.Run(tt.name, func(t *testing.T) {6162 assertNoErr(t, initCmd.Flags().Set("pkg-name", tt.pkgName))63 viper.Set("useViper", true)64 viper.Set("license", "apache")65 projectPath, err := initializeProject(tt.args)66 defer func() {67 if projectPath != "" {68 os.RemoveAll(projectPath)
27 unmodified lines
modified:cobra/cmd/licenses.go+4 added-4 removed
1// Copyright © 2015 Steve Francia <spf@spf13.com>.1// Copyright © 2021 Steve Francia <spf@spf13.com>.2//3// Licensed under the Apache License, Version 2.0 (the "License");4// you may not use this file except in compliance with the License.5// You may obtain a copy of the License at
46 unmodified lines
52 initAgpl()53}5455// getLicense returns license specified by user in flag or in config.56// If user didn't specify the license, it returns Apache License 2.0.56// If user didn't specify the license, it returns none57//58// TODO: Inspect project for existing license59func getLicense() License {60 // If explicitly flagged, use that.
11 unmodified lines
72 if viper.IsSet("license") {73 return findLicense(viper.GetString("license"))74 }7576 // If user didn't set any license, use Apache 2.0 by default.77 return Licenses["apache"]76 // If user didn't set any license, use none by default77 return Licenses["none"]78}7980func copyrightLine() string {81 author := viper.GetString("author")
39 unmodified lines
modified:cobra/cmd/root.go+1 added-1 removed
48 unmodified lines
49 rootCmd.PersistentFlags().Bool("viper", false, "use Viper for configuration")50 cobra.CheckErr(viper.BindPFlag("author", rootCmd.PersistentFlags().Lookup("author")))51 cobra.CheckErr(viper.BindPFlag("useViper", rootCmd.PersistentFlags().Lookup("viper")))52 viper.SetDefault("author", "NAME HERE <EMAIL ADDRESS>")53 viper.SetDefault("license", "apache")53 viper.SetDefault("license", "none")5455 rootCmd.AddCommand(addCmd)56 rootCmd.AddCommand(initCmd)57}
22 unmodified lines