Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stop shovel tasks from choking in docstring newlines #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions shovel/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

from __future__ import print_function

import re
import logging
from .tasks import Shovel, Task
from .parser import parse
Expand Down Expand Up @@ -82,7 +83,7 @@ def run(*args):
print('No tasks found!')
else:
names = list(t.fullname for t in tasks)
docs = list(t.doc for t in tasks)
docs = list(re.sub(r'\s+', ' ', t.doc) for t in tasks)

# The width of the screen
width = 80
Expand All @@ -94,8 +95,8 @@ def run(*args):

# Create the format with padding for the longest name, and to
# accomodate the screen width
format = '%%-%is # %%-%is' % (
max(len(name) for name in names), width)
namemax = max(len(name) for name in names)
format = '%%-%is => %%.%is...' % (namemax, width - namemax - 8)
for name, doc in zip(names, docs):
print(format % (name, doc))
elif clargs.method:
Expand Down