Home / Docs / Command line

una contract

Release v0.4.0

Print the full header of a function, declared or inferred, with doc comments and requirements.

text
una contract [OPTIONS] <NAME>

Examples

sh
una contract wordfreq.counts

Print a function's full header: the module path, then the function's name.

Arguments

Argument What it does Default
<NAME> The module path followed by the function's name, for example events.checkin.check_in

Options

Option What it does Default
--json Print machine output as JSON on stdout, and nothing else on stdout
--color <WHEN> When to use colors in human output. Values: never: Never use colors; auto: Use colors when the output is a terminal; always: Always use colors. auto

Specification

The normative rules, from spec/13 §5:

Command Meaning
una contract <qualified.name> Print the full header, declared or inferred, with doc comments and requirements

una contract <qualified.name> reads the package in the current directory and checks it at tier 0 (ADR 0029). The name is the module path followed by the function's name, as in events.checkin.check_in, and names a function. When the package has diagnostics, those of its project files included, una contract reports them as una check does and exits with code 1 before it resolves the name, since an inferred header is defined only for a package that checks (ADR 0036); in a package without diagnostics, an unknown name is a usage error (exit code 2). Otherwise it prints the doc comments, then the header in canonical form with every clause, declared or inferred, in canonical order, each inferred clause followed by the comment -- inferred, then one line per requirement of derived from: -- requirement ID (status): "text". With --json it prints una.contract/1, compact, with keys in this order:

Help text

As una contract --help prints it at v0.4.0:

text
Print the full header of a function, declared or inferred, with doc comments and requirements

Usage: una contract [OPTIONS] <NAME>

Arguments:
  <NAME>
          The module path followed by the function's name, for example events.checkin.check_in

Options:
      --json
          Print machine output as JSON on stdout, and nothing else on stdout

      --color <WHEN>
          When to use colors in human output

          Possible values:
          - never:  Never use colors
          - auto:   Use colors when the output is a terminal
          - always: Always use colors

          [default: auto]

  -h, --help
          Print help (see a summary with '-h')
View the Markdown