Comparing version 1.2.0 to 1.3.0
@@ -14,5 +14,4 @@ "use strict"; | ||
const _require2 = require('../licenses'), | ||
licenses = _require2.licenses; | ||
licenseNames = _require2.licenseNames; | ||
const licenseNames = Object.keys(licenses); | ||
exports.pickLicense = | ||
@@ -19,0 +18,0 @@ /*#__PURE__*/ |
@@ -12,11 +12,14 @@ #!/usr/bin/env node | ||
const _require3 = require('./generate-list'), | ||
generateList = _require3.generateList; | ||
const cli = meow(`Usage: | ||
$ licensed # Brings up an option to start a questionnaire or choose from a list of available licenses | ||
$ licensed <license-name> # Brings prompt to enter your name | ||
$ licensed <license-name> <your-full-name> [--year | -y] <year> | ||
$ licensed --help | ||
$ licensed --version | ||
$ licensed <license-name> <your-full-name> [--year | -y] <year> | ||
$ licensed [--list | -l] | ||
Options: | ||
--year, -y <year> The year the license is in effect | ||
--year, -y <year> Manually enter year the license is in effect | ||
--list, -l List all available licenses | ||
--help Show this screen | ||
@@ -38,2 +41,6 @@ --version Show version | ||
alias: 'y' | ||
}, | ||
list: { | ||
type: 'boolean', | ||
alias: 'l' | ||
} | ||
@@ -43,19 +50,29 @@ } | ||
/** | ||
* If called without inputs, | ||
* get a list of available inputs and prompt the | ||
* user to choose some stuff. | ||
* If licensed is called with | ||
* `-l` or `--list` flag, generate | ||
* a list of available licenses to | ||
* choose from | ||
*/ | ||
if (!cli.input.length) { | ||
chooseLicense(cli.flags); | ||
} | ||
/** | ||
* If called with an input | ||
* fuzzy search amongst license names | ||
* and return the first result | ||
*/ | ||
else { | ||
searchLicense({ | ||
input: cli.input | ||
}, cli.flags); | ||
} | ||
if (cli.flags.l) { | ||
generateList(); | ||
} else { | ||
/** | ||
* If called without inputs, | ||
* get a list of available inputs and prompt the | ||
* user to choose some stuff. | ||
*/ | ||
if (!cli.input.length) { | ||
chooseLicense(cli.flags); | ||
} | ||
/** | ||
* If called with an input | ||
* fuzzy search amongst license names | ||
* and return the first result | ||
*/ | ||
else { | ||
searchLicense({ | ||
input: cli.input | ||
}, cli.flags); | ||
} | ||
} |
@@ -10,3 +10,3 @@ "use strict"; | ||
const licensesFolder = resolve(__dirname, '..', 'assets', 'licenses'); | ||
exports.licenses = { | ||
const licenses = { | ||
'Apache 2.0': { | ||
@@ -89,2 +89,4 @@ value: readFileSync(resolve(licensesFolder, 'Apache 2.0'), 'utf-8'), | ||
} | ||
}; | ||
}; | ||
exports.licenses = licenses; | ||
exports.licenseNames = Object.keys(licenses); |
@@ -16,3 +16,2 @@ "use strict"; | ||
exports.writeLicense = (fullName, licenseName, year) => { | ||
// const year = (new Date).getFullYear(); | ||
const license = licenses[licenseName].value; | ||
@@ -19,0 +18,0 @@ const text = `Copyright (c) ${year}, ${fullName}\n\n${license}`; |
{ | ||
"name": "licensed", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "licensed is a command line interface to help you choose and add licenses to your projects", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -36,8 +36,8 @@ # licensed | ||
$ licensed <license-name> # Brings prompt to enter your name | ||
$ licensed <license-name> <your-full-name> [--year | -y] <year> | ||
$ licensed --help | ||
$ licensed --version | ||
$ licensed <license-name> <your-full-name> [--year | -y] <year> | ||
$ licensed [--list | -l] | ||
Options: | ||
--year, -y <year> The year the license is in effect | ||
--year, -y <year> Manually enter year the license is in effect | ||
--list, -l List all available licenses | ||
--help Show this screen | ||
@@ -44,0 +44,0 @@ --version Show version |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
258721
20
517