license

package module
v0.0.0-...-d93b85b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 4, 2018 License: MIT Imports: 3 Imported by: 0

README

License

GoDoc

A simple utility to write a license file to the current directory. It accepts the license type, year, and name of the copyright holder. If no year is provided the current year is assumed. Likewise, if no name is provided the currently logged-in user's name is used instead.

Installation

go get -u bitbucket.org/antizealot1337/license/cmd/license

Usage

Copied from license -help

Usage of license:
  -help
        Show the help/usage information and exit
  -holder string
        The name of the copyright holder (default "<current user name>")
  -list
        List the available licenses instead of writing a license file
  -name string
        The name of the license to write (default "MIT")
  -year int
        The year of the copyright (default <current year>)

When specifying the name of the license it should be one of the following:

License

Licensed under the terms of the MIT license. See the LICENSE file for more info.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Write deprecated

func Write(license string, info *Info, out io.Writer) error

Write a license with the year and name to the Writer. If there is an error writing to the Writer it will be returned.

Deprecated: Because Info is deprecated so too is this method. This function should be replaced in with WriteLic. Currently, Write calls WriteLic with Info.Name and Info.Year supplied as holder and year respectively.

func WriteLic

func WriteLic(licenseType, holder string, year int, out io.Writer) error

WriteLic is a convenience function that will find a License, apply the infomation, and write it to the supplied io.Writer. If an error occurs it will be returned immediately.

Types

type Info deprecated

type Info struct {
	Name string
	Year int

} //struct Info

Info for the copyright.

Deprecated: This type will be removed in favor of the more robust License type.

func NewInfo

func NewInfo(name string, year int) *Info

NewInfo constructs an Info.

type License

type License string

License represents a license type.

func GetLicense

func GetLicense(name string) (License, error)

GetLicense will attempt to find a license with the supplied name and return it. If no License can be found with the name an error is returned.

func (License) Substitute

func (l License) Substitute(holder string, year int) License

Substitute will replace all occurances of USER, and YEAR with the supplied values. This will not overwrite the exising License but will create and return a new License with the specified values replaced.

func (License) WriteTo

func (l License) WriteTo(out io.Writer) (int64, error)

WriteTo writes the License to an io.Writer returning the number of bytes written and any errors that occured during the write.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL