Useful output with bare invocation & no root default task #180
Comments
A workaround until then is to add a task like this to your tasks file. However, the @task(default=True)
def list():
"""List tasks"""
run("invoke --list") |
@epicserve I am curious though why you were even running |
shrug I'm different/special I guess. :) I run commands all the time without arguments (ls, mkdir, pwd, workon, stree, ifconfig, pep8, ipython, pyflakes, setvirtualenvproject, virtualenvwrapper, etc). |
I think it would be nice to display at least a minimal usage/help string... Something like:
If there isn't a
Probably a message like: (after the Usage strings)
None of this is vital of course, but it's nice polish :) |
I thought it did get updated to print a more useful "no collection found" msg? If not there's probably another ticket for it... |
It does print a more useful message with no tasks.py -- I was looking at an old virtualenv. |
I'm new to Invoke and really like it so far. One of the biggest surprises has been the default behavior of showing a traceback when running just In other words, +1 from me to show help unless configured otherwise. Luckily I can easily emulate that behavior: @task(default=True)
def help():
"""Show help, basically an alias for --help.
Needed as a default task due to https://github.com/pyinvoke/invoke/issues/180
"""
run('invoke --help') |
Good catch re: the docs. I retain the right to change things at whim given it's pre 1.0, but clearly past-me thought help output was the sane default; and that's also Unix tradition much of the time, so yea. Let's do that. |
In the past we had empty output when one said
invoke
by itself (IIRC), then #165 happened and now it will pick up a default root task; but if there IS no default root task we just get a ValueError. It should probably do something useful like print core help or a task list.The text was updated successfully, but these errors were encountered: