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

Useful output with bare invocation & no root default task #180

Closed
bitprophet opened this Issue Sep 26, 2014 · 8 comments

Comments

Projects
None yet
4 participants
@bitprophet
Member

bitprophet commented Sep 26, 2014

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.

@epicserve

This comment has been minimized.

epicserve commented Sep 26, 2014

A workaround until then is to add a task like this to your tasks file. However, the list task shows up in the task list. It would be nice if you could hide it some how.

@task(default=True)
def list():
    """List tasks"""
    run("invoke --list")
@bitprophet

This comment has been minimized.

Member

bitprophet commented Sep 26, 2014

@epicserve I am curious though why you were even running invoke by itself :) it's not something I see users do super duper often (same with fab). It's important to have it behave "well" but at the same time I'm not sure why folks need a workaround exactly ;)

@epicserve

This comment has been minimized.

epicserve commented Sep 26, 2014

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).

@sophacles

This comment has been minimized.

sophacles commented Sep 26, 2014

I think it would be nice to display at least a minimal usage/help string...

Something like:

Usage: inv[oke] [--core-opts] task1 [--task1-opts] ... taskN [--taskN-opts]
For more information: invoke --help
To list available invokations: invoke --list

No default task set.

If there isn't a tasks.py, there should probably be a better error than:

Can't find any collection named None!

Probably a message like: (after the Usage strings)

Could not find a tasks.py file. Either run with -f or create a task file.

None of this is vital of course, but it's nice polish :)

@bitprophet

This comment has been minimized.

Member

bitprophet commented Sep 26, 2014

I thought it did get updated to print a more useful "no collection found" msg? If not there's probably another ticket for it...

@sophacles

This comment has been minimized.

sophacles commented Sep 26, 2014

It does print a more useful message with no tasks.py -- I was looking at an old virtualenv.

@pekkaklarck

This comment has been minimized.

pekkaklarck commented Oct 1, 2014

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 invoke, and I was even more surprised when I noticed that docs say it should be same as invoke --help:
http://docs.pyinvoke.org/en/latest/concepts/cli/intro.html

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')
@bitprophet

This comment has been minimized.

Member

bitprophet commented Oct 1, 2014

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.

bitprophet added a commit that referenced this issue Oct 1, 2014

@bitprophet bitprophet closed this in dd09d24 Oct 1, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment