sphinxdoc

A sphinx extension for documenting ec based scripts.

Example

sphinxdoc on nut_shell.py, will produce the documentation below.

nut_shell

A module to test decorator based configuration.

Everything about using ec. this module is designed to be a nut shell guide to ec and as a way to enable test driven development.

Notes

  • The decorators task, arg and group are available as __builtins__, when the script is launched using ec.
  • DocStrings of the tasks could be used by external modules (like sphinx). This is one of the key factors of developing ec, apart from it’s predecessor Commander.
task1(arg1[arg2=2][arg3=3])

A simple task, at the root of the script.

  • Note that the order of input collection will follow the order of configuration (in this case arg1 and then arg2).
  • Any unconfigured args will be collected after the collection of the configured args (hence arg3 will be collected as the last arg).
  • Since a name isn’t specified in @task, the name of the task, simple will be used as the name of this task.
Args
arg1: Some int.
arg2: int (2).
arg3: str (3).
intro, i

A group.

Groups can contain tasks and other groups within them. This group has an alias; thus could be identified as intro or i. Tasks to could have aliases.
simple(arg1)

A task within a group.

  • This task can be accessed as intro/simple.
  • Notice the missing self arg.
  • @task.name, simple will be the name of this task, not the function name renamed_task.
Args
arg1: Some string.
wrapper()

Calls nut_shell.simple with some arguments, the args that aren’t provided will be collected.

get()

Get user input through utils.get.

simple
task1(arg1[arg2=1])
Args
arg1: Value for arg1.
arg2: int (1).
group1

A group with some tasks

task1(arg1)
Args
arg1: .