pyinvoke / invoke

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

Add pre & post tasks to help output #860

Open dflock opened 2 years ago

dflock commented 2 years ago

It would be great if the help output for a task could include a list of pre & post tasks that this task calls. For example, if I have a serve task, that calls clean & build as pre-tasks, the help output could look something like this:

❯ inv --help serve

Usage: inv[oke] [--core-opts] serve [other tasks here ...]

Docstring:
  Serve thing at http://localhost:$DOCS_PORT/ & live reload on changes. Default port: 5500

Options:
  none

Pre-tasks:
  Calls clean, build

Post-tasks:
  none

Invoke does know this information, and it would be great to make it visible to users so they know what running a task will do - without having to look at the tasks.py code - on manually having to add this text to the docstring.

neozenith commented 2 years ago

Great suggestion. If you or anyone reading this has the bandwidth, opening a PR that references this issue and has appropriate test coverage would be much appreciated.

Our current priorities are working through dropping Python2 support to reduce our test matrix before addressing a backlog of issues.