How to use the command 'licensor' (with examples)
The licensor
command is a tool that allows users to write licenses to standard output. It can write various licenses, specify copyright holders, and include license exceptions.
Use case 1: Write the MIT license to a file named LICENSE
Code:
licensor MIT > LICENSE
Motivation: This use case is useful when you want to add the MIT license to your project.
Explanation:
licensor
: the command to executeMIT
: the license you want to write> LICENSE
: redirects the output to a file namedLICENSE
Example output:
The MIT License (MIT)
...
Use case 2: Write the MIT license with a placeholder copyright notice to a file named LICENSE
Code:
licensor -p MIT > LICENSE
Motivation: This use case is helpful when you want to have a placeholder copyright notice in your license file.
Explanation:
licensor
: the command to execute-p
: specifies that a placeholder copyright notice should be includedMIT
: the license you want to write> LICENSE
: redirects the output to a file namedLICENSE
Example output:
(c) [year] [fullname]
The MIT License (MIT)
...
Use case 3: Specify a copyright holder named Bobby Tables
Code:
licensor MIT "Bobby Tables" > LICENSE
Motivation: This use case is useful when you want to specify a specific copyright holder for your license.
Explanation:
licensor
: the command to executeMIT
: the license you want to write"Bobby Tables"
: specifies the copyright holder as “Bobby Tables”> LICENSE
: redirects the output to a file namedLICENSE
Example output:
The MIT License (MIT)
Copyright (c) Bobby Tables
...
Use case 4: Specify license exceptions with a WITH expression
Code:
licensor "Apache-2.0 WITH LLVM-exception" > LICENSE
Motivation: This use case is useful when you need to add license exceptions to your license.
Explanation:
licensor
: the command to execute"Apache-2.0 WITH LLVM-exception"
: the license you want to write with the exception> LICENSE
: redirects the output to a file namedLICENSE
Example output:
Apache License
...
LLVM Exceptions to the Apache 2.0 License
...
Use case 5: List all available licenses
Code:
licensor --licenses
Motivation: This use case is helpful when you need to see a list of all available licenses supported by licensor
.
Explanation:
licensor
: the command to execute--licenses
: lists all available licenses
Example output:
MIT
Apache-2.0
GPL-3.0
...
Use case 6: List all available exceptions
Code:
licensor --exceptions
Motivation: This use case is useful when you need to see a list of all available exceptions supported by licensor
.
Explanation:
licensor
: the command to execute--exceptions
: lists all available exceptions
Example output:
LLVM-exception
Clang-exception
GCC-exception
...
Conclusion:
The licensor
command provides a convenient way to write licenses to standard output. It supports various licenses, allows for specifying copyright holders, and includes license exceptions with the use of a WITH expression. Additionally, it provides the ability to list all available licenses and exceptions. This tool can streamline the process of adding licenses to your projects and ensure proper attribution and compliance.