Browse Source

start re-implementation of CLI and rename from "shore" to "shut"

shut
Niklas Rosenstein 10 months ago
parent
commit
fec376f599
No known key found for this signature in database GPG Key ID: 6D269B33D25F6C6
3 changed files with 65 additions and 0 deletions
  1. + 1
    - 0
      package.yaml
  2. + 1
    - 0
      setup.py
  3. + 63
    - 0
      src/shore/commands/__init__.py

+ 1
- 0
package.yaml

@ -32,6 +32,7 @@ entrypoints:
console_scripts:
- shore = shore.__main__:_entry_point
- shore-conda-forge = shore.tools.conda_forge:main
- shut = shore.commands:shut
shore.core.plugins:
- core = shore.plugins.core:CorePlugin
- install-script = shore.plugins.install_script:InstallScriptRenderer

+ 1
- 0
setup.py

@ -43,6 +43,7 @@ setuptools.setup(
'console_scripts': [
'shore = shore.__main__:_entry_point',
'shore-conda-forge = shore.tools.conda_forge:main',
'shut = shore.commands:shut',
],
'shore.core.plugins': [
'core = shore.plugins.core:CorePlugin',

+ 63
- 0
src/shore/commands/__init__.py

@ -0,0 +1,63 @@
# -*- coding: utf8 -*-
# Copyright (c) 2020 Niklas Rosenstein
#
# 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.
"""
This package implements the Shut CLI.
"""
from nr.proxy import Proxy
import click
import logging
context = Proxy(lambda: click.get_current_context().obj)
@click.group()
@click.option('-v', '--verbose', count=True, help='Increase the log verbosity.')
@click.option('-q', '--quiet', is_flag=True, help='Quiet mode, wins over --verbose.')
def shut(verbose, quiet):
"""
Shut is a tool to manage the lifecycle of pure Python packages. It automates tasks such
as bootstrapping a project, bumping version numbers, managing changelogs and publishing
packages to PyPI all the while performing sanity checks.
Shut makes strong assumptions on the project structure and assumes that the source-control
system of choice is Git.
"""
ctx = click.get_current_context()
ctx.ensure_object(dict)
ctx['quiet'] = quiet
if quiet:
level = logging.CRITICAL
elif verbose >= 2:
level = logging.DEBUG
elif verbose >= 1:
level = logging.INFO
else:
level = logging.WARNING
logging.basicConfig(
format='[%(levelname)s|%(asctime)s|%(name)s]: %(message)s',
level=level,
)

Loading…
Cancel
Save