Ejemplo n.º 1
0
def synopsis() -> cli_syntax.Synopsis:
    command_line = arg.CommandLine([
        arg.Single(arg.Multiplicity.ZERO_OR_MORE,
                   _OPTION_PLACEHOLDER_ARGUMENT),
        arg.Single(arg.Multiplicity.MANDATORY, TEST_CASE_FILE_ARGUMENT)
    ],
                                   prefix=program_info.PROGRAM_NAME)
    return cli_syntax.Synopsis(command_line, _TP.text(_DESCRIPTION_PARAGRAPH))
Ejemplo n.º 2
0
def synopsis() -> cli_syntax.Synopsis:
    command_line = arg.CommandLine([
        arg.Single(arg.Multiplicity.MANDATORY,
                   arg.Constant(common_opts.SUITE_COMMAND)),
        arg.Single(arg.Multiplicity.OPTIONAL, _REPORTER_OPTION),
        arg.Single(arg.Multiplicity.OPTIONAL, _ACTOR_OPTION),
        arg.Single(arg.Multiplicity.MANDATORY, _FILE_ARGUMENT),
    ],
                                   prefix=program_info.PROGRAM_NAME)
    return cli_syntax.Synopsis(command_line, _TP.text(_DESCRIPTION_PARAGRAPH))
Ejemplo n.º 3
0
    def initial_paragraphs(self) -> List[ParagraphItem]:
        command_line = arg.CommandLine([
            arg.Single(arg.Multiplicity.MANDATORY, _c(clo.HELP)),
            arg.Single(arg.Multiplicity.ZERO_OR_MORE, _n('ARGUMENT'))
        ],
                                       prefix=program_info.PROGRAM_NAME)

        command_line_syntax_text = CommandLineSyntaxRenderer().apply(
            command_line)
        return docs.paras(command_line_syntax_text)
Ejemplo n.º 4
0
    def _entities_help() -> List[cli_syntax.Synopsis]:
        def row(names: EntityTypeNames) -> List[docs.TableCell]:
            return [
                docs.text_cell(doc_format.syntax_text(names.identifier)),
                docs.text_cell(names.name.plural.capitalize()),
            ]

        entities_table = docs.plain_table(
            map(row, ALL_ENTITY_TYPES_IN_DISPLAY_ORDER))

        arguments = [
            arg.Single(arg.Multiplicity.MANDATORY, _c(clo.HELP)),
            arg.Single(arg.Multiplicity.MANDATORY, _n('ENTITY-TYPE')),
            arg.Single(arg.Multiplicity.OPTIONAL, _n('ENTITY-NAME'))
        ]
        single_line_description = 'Lists all entities of a type; or describes a given entity.'
        return [
            cli_syntax.Synopsis(arg.CommandLine(arguments),
                                docs.text(single_line_description),
                                [entities_table])
        ]
Ejemplo n.º 5
0
def _command_line__suite(
        additional_arguments: List[arg.ArgumentUsage]) -> arg.CommandLine:
    return arg.CommandLine(_common_initial_args__suite() +
                           additional_arguments,
                           prefix=program_info.PROGRAM_NAME)
Ejemplo n.º 6
0
def cl_syntax_for_args(argument_usages: Sequence[a.ArgumentUsage]) -> str:
    cl = a.CommandLine(argument_usages)
    return cl_syntax(cl)
Ejemplo n.º 7
0
def _synopsis_for_args(argument_usages: Sequence[arg.ArgumentUsage],
                       single_line_description: str) -> cli_syntax.Synopsis:
    return cli_syntax.Synopsis(arg.CommandLine(argument_usages,
                                               prefix=program_info.PROGRAM_NAME),
                               docs.text(single_line_description))
Ejemplo n.º 8
0
def _synopsis(additional_arguments: list,
              single_line_description: str) -> cli_syntax.Synopsis:
    arguments = [_c(clo.HELP)] + additional_arguments
    return cli_syntax.Synopsis(
        arg.CommandLine(list(map(_single_mandatory_arg, arguments))),
        docs.text(single_line_description))