def collect_commands(default, commands):
    default_commands = [help,
                        test,
                        show_tests,
                        show_config,
                        save_config,
                        show_state]

    if default is not None and len(getargspec(default).args) > 0:
        raise TypeError("Main function cannot take arguments.")

    def show_commands():
        """Print the available commands
        """
        cmds = commands
        if default is not None and default not in cmds:
            cmds = [default] + commands
        print_bold("Available commands:")
        all_commands = cmds + default_commands + [show_commands]
        if AUTO_COMPLETION:
            all_commands += [activate_autocompletion]
        names = [command.__name__ for command in all_commands]
        for name in names:
            print("\t" + str(name))

    all_commands = commands + default_commands + [show_commands]
    if AUTO_COMPLETION:
        all_commands += [activate_autocompletion]

    return all_commands
Add default commands
dataset/ETHPy150Open duerrp/pyexperiment/pyexperiment/experiment.py/collect_commands