lord63 / choosealicense-cli Goto Github PK
View Code? Open in Web Editor NEWBring http://choosealicense.com to your terminal
License: MIT License
Bring http://choosealicense.com to your terminal
License: MIT License
The MIT license template includes [year] [fullname]
however these are not substituted.
For example, the isc license:
A permissive license lets people do anything with your code with proper
attribution and without warranty. The ISC license is functionally equivalent
to the <a href="/licenses/bsd">BSD 2-Clause</a> and <a
href="/licenses/mit">MIT</a> licenses, removing some language that is no
longer necessary.
Maybe we should strip them.
When generating a license referenced with upper case characters, the context is ignored and as such the placeholders are not updated.
$ license generate MIT
MIT License
Copyright (c) [year] [fullname]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
$ license generate MIT
MIT License
Copyright (c) 2020 Adriaan Knapen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Any reason why Python 3.7 is not listed under the supported versions? Haven't used it much so for - only just ran into the tool, but until now it works, test pass and the code base seems small enough.
A more minimal step would be to add it to the CI, such that it's at least tested without officially mentioning it as supported.
For open source packages I develop on the behalf of my employer, I would like to apply a default context that diverges from my Git settings. In my specific use case, I would like --fullname
to default to Name of the Company
and not $(git config user.name)
.
I suggest to add support for environment variables and / or .licenserc
files.
The order of precedence would be: CLI options override environment variables and .licenserc
files. Environment variables override .licenserc
files.
For the env variables I would suggest:
$LICENSE_YEAR
$LICENSE_FULLNAME
$LICENSE_EMAIL
$LICENSE_PROJECT
For the .licenserc
files, I'd suggest an ini-like format:
year=2019
fullname=Jan Buschtöns
email[email protected]
project=Foo Project
.licenserc
files would be read recursively from the current working directory upwards to the root and would override one another, with the leaf file taking precedence.
I think the environment variables would already be sufficient, since they effectively would allow for an rc-like usage via direnv
.
Thanks again for this awesome tool!
Currently, the tests cost too much time and it may be banned by github. Orz
when user hit github api rate limiting, they can't get the expected api response.
(venv) ➜ choosealicense-cli git:(20200309-fix-context-unicode) ✗ license show
Traceback (most recent call last):
File "/Users/lord63/Code/choosealicense-cli/venv/bin/license", line 11, in <module>
load_entry_point('choosealicense-cli', 'console_scripts', 'license')()
File "/Users/lord63/Code/choosealicense-cli/venv/lib/python2.7/site-packages/Click-7.0-py2.7.egg/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/Users/lord63/Code/choosealicense-cli/venv/lib/python2.7/site-packages/Click-7.0-py2.7.egg/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/Users/lord63/Code/choosealicense-cli/venv/lib/python2.7/site-packages/Click-7.0-py2.7.egg/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/lord63/Code/choosealicense-cli/venv/lib/python2.7/site-packages/Click-7.0-py2.7.egg/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/lord63/Code/choosealicense-cli/venv/lib/python2.7/site-packages/Click-7.0-py2.7.egg/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/Users/lord63/Code/choosealicense-cli/choosealicense/cli.py", line 31, in show
keys = [item['key'] for item in response.json()]
TypeError: string indices must be integers
here is the real api response:
>>> response.status_code
403
>>> response.json()
{u'documentation_url': u'https://developer.github.com/v3/#rate-limiting', u'message': u"API rate limit exceeded for xxx.xxx.xxx.xxx. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)"}
The context
command cannot deal with non-ASCII characters, as can be seen here:
$ git config user.name
Jan Buschtöns
$ license context isc
The template has following defaults:
year: 2019
Traceback (most recent call last):
File "/usr/local/bin/license", line 8, in <module>
sys.exit(cli())
File "/usr/local/lib/python2.7/site-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python2.7/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python2.7/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/choosealicense/cli.py", line 94, in context
echo('\t{0}: {1}'.format(item, default_context[item]))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in position 10: ordinal not in range(128)
Interestingly, generate
works just fine:
$ license generate isc
ISC License
Copyright (c) 2019, Jan Buschtöns
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
I have little Python experience, but I am super happy that I found this tool. Thanks a lot for this! I find it really useful.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.