pyinvoke / invoke

Pythonic task management & command execution.
http://pyinvoke.org
BSD 2-Clause "Simplified" License
4.41k stars 370 forks source link

Hiding tasks from --list which are pre/post methods #348

Open toxinu opened 8 years ago

toxinu commented 8 years ago

Very similar to #290 but the workaround proposed by @bitprophet doesn't work for pre/post methods.

I get this output:

Traceback (most recent call last):
  File "[path]/bin/invoke", line 11, in <module>
    sys.exit(program.run())
  File "[path]/invoke/program.py", line 270, in run
    self.execute()
  File "[path]/invoke/program.py", line 379, in execute
    executor.execute(*self.tasks)
  File "[path]/invoke/executor.py", line 97, in execute
    expanded = self.expand_calls(calls, config)
  File "[path]/invoke/executor.py", line 188, in expand_calls
    ret.extend(self.expand_calls(call.pre, config))
  File "[path]/invoke/executor.py", line 180, in expand_calls
    if call.contextualized:
AttributeError: 'function' object has no attribute 'contextualized'

With this source:

from invoke import task

def pre_task():
    pass

@task(pre=[pre_task])
def my_task():
    pass
toxinu commented 8 years ago

Just realized that underscore prefixed tasks are not listed. Am I wrong?

dirkschneemann commented 7 years ago

Doesn't work for me on invoke 0.15.0, underscore prefixed tasks are still listed (at the top of the list since they are in alphabetical order).

This feature would be much appreciated since I have some pre- and post-tasks which I do not want to flood the task list with (they are not meant to be executed on their own anyway).

bitprophet commented 7 years ago
danieleteti commented 4 years ago

Any news on this? It would be really useful for dependency management and deduplication

rberger commented 2 years ago

Having @task(hidden=True) would be awesome

SnoopJ commented 3 days ago

I believe this feature request (as interpreted above to be fundamentally about the ability to hide tasks in general) is also covered by #722 (that one being a later duplicate of this one) and would be closed by merge of #723.