Printing first line of task's docsting by --list #105 #110

Merged
merged 4 commits into from May 6, 2014

Projects

None yet

5 participants

@hirokiky
Contributor

Supported issue #105.

I also added a test but I'm not similar with the testing tool 'spec'.
So that, please teach me about it of fix the code If you don't like the addition.

@rread rread commented on an outdated diff Jan 21, 2014
invoke/cli.py
@@ -209,6 +209,12 @@ def parse(argv, collection=None):
out = primary
if aliases:
out += " (%s)" % ', '.join(aliases)
+
+ docstring = collection[primary].__doc__
+ if docstring:
+ max_width = max(map(len, names))
+ out += " " * (max_width - len(primary) + 1) + docstring.split('\n')[0]
@rread
rread Jan 21, 2014

suggest adding an lstrip() there (e.g. "... + docstring.lstrip().split('\n')[0]") to support docstrings that start on the line after the quotes.

@hirokiky
Contributor

@rread Thanks! I fixed it just now.

@jthigpen
jthigpen commented Feb 8, 2014

When a submodule has a default task, the denotation of that task causes a bug in the formatting of that output.

  aws.elb_status           Check Status of all load balancers.
  deploy.deploy (deploy)            Deploy the branch (default=stable) to staging.
  deploy.jenkins           Establish ssh tunnel to jenkins on port 9000 and open Jenkins.
@hirokiky
Contributor
hirokiky commented Feb 9, 2014

@jthigpen Thank you. You are completely right. I will fix it as soon as I can!.

It seems this bug caused by a task with some aliases, not only the case of 'default task'.
so that when I fix tests, I will add a task decorated with task(aliases=('',)).
Because It is easier to write and understand that meaning than adding a taks having default task.

@patcon
patcon commented Feb 23, 2014

👍

@hirokiky
Contributor
hirokiky commented May 3, 2014

This pull-request still can be merged with master safely.
I tried with 0bcf45a.

@bitprophet bitprophet merged commit d321987 into pyinvoke:master May 6, 2014

1 check passed

default The Travis CI build passed
Details
@bitprophet bitprophet added a commit that referenced this pull request May 6, 2014
@bitprophet bitprophet Changelog re #110 131d324
@bitprophet
Member

Thanks a bunch! Very useful change :)

Merged this in, rejiggered a bunch of it (there was existing code to handle this display format so I used that), added changelog, and seems to all work now. Just pushed.

@hirokiky
Contributor
hirokiky commented May 7, 2014

Im glad, thanks a lot.

@hirokiky hirokiky deleted the hirokiky:list-with-docstring branch May 7, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment