Browse Source

fix "shut license" command and "shut mono status" if mono repository has no packages

shut-new-model
Niklas Rosenstein 9 months ago
parent
commit
b0904f0650
No known key found for this signature in database GPG Key ID: 6D269B33D25F6C6
3 changed files with 12 additions and 2 deletions
  1. + 7
    - 0
      Makefile
  2. + 4
    - 1
      src/shut/commands/commons/status.py
  3. + 1
    - 1
      src/shut/commands/license.py

+ 7
- 0
Makefile

@ -0,0 +1,7 @@
pylint:
# We have to disable these for now because pylint does not understand databind and nr.stream.
pylint src/shut -E --disable=unsubscriptable-object,no-value-for-parameter,no-name-in-module,no-member
mypy:
mypy src/shut

+ 4
- 1
src/shut/commands/commons/status.py

@ -20,6 +20,7 @@
# IN THE SOFTWARE.
import os
import sys
from typing import Union
from nr.utils.git import Git
@ -48,13 +49,15 @@ def print_status(project: Project) -> None:
if isinstance(project.subject, MonorepoModel):
monorepo_dir = project.subject.get_directory()
if not project.packages:
sys.exit('error: monorepo has no packages')
items = sorted(project.packages, key=lambda x: x.data.name)
names = [os.path.normpath(os.path.relpath(x.get_directory(), monorepo_dir)) for x in items]
else:
items = [project.subject]
names = [project.subject.get_name()]
width = max(map(len, names))
width = max(map(len, names)) if names else 0
for item, name in zip(items, names):
tag, num_commits = get_commits_since_last_tag(item)

+ 1
- 1
src/shut/commands/license.py

@ -36,7 +36,7 @@ def license():
@license.command()
@click.option('--name', help='The name of the license to retrieve.')
@click.option('--name', help='The name of the license to retrieve.', required=True)
@click.option('--long', 'format_', flag_value='long', default=True)
@click.option('--short', 'format_', flag_value='short')
@click.option('--json', 'format_', flag_value='json')

Loading…
Cancel
Save