aboutsummaryrefslogtreecommitdiff
path: root/docs/yaml/functions/summary.yaml
blob: cf63dcd78616d264c04637978703b8f56f2502cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: summary
returns: void
since: 0.53.0
description: |
  This function is used to summarize build configuration at the end of the build
  process. This function provides a way for projects (and subprojects) to report
  this information in a clear way.

  The content is a series of key/value pairs grouped into sections. If
  the section keyword argument is omitted, those key/value pairs are
  implicitly grouped into a section with no title. key/value pairs can
  optionally be grouped into a dictionary, but keep in mind that
  dictionaries do not guarantee ordering. `key` must be string,
  `value` can be:

  - an integer, boolean or string
  - *since 0.57.0* an external program or a dependency
  - *since 0.58.0* a feature option
  - a list of those.

  Instead of calling summary as `summary(key, value)`, it is also possible to
  directly pass a dictionary to the [[summary]] function, as seen in the example
  below.

  `summary()` can be called multiple times as long as the same
  section/key pair doesn't appear twice. All sections will be collected
  and printed at the end of the configuration in the same order as they
  have been called.

example: |
  Example `meson.build`:
  ```meson
  project('My Project', version : '1.0')
  summary({'bindir': get_option('bindir'),
          'libdir': get_option('libdir'),
          'datadir': get_option('datadir'),
          }, section: 'Directories')
  summary({'Some boolean': false,
          'Another boolean': true,
          'Some string': 'Hello World',
          'A list': ['string', 1, true],
          }, section: 'Configuration')
  ```

  Output:
  ```
  My Project 1.0

    Directories
      prefix         : /opt/gnome
      bindir         : bin
      libdir         : lib/x86_64-linux-gnu
      datadir        : share

    Configuration
      Some boolean   : False
      Another boolean: True
      Some string    : Hello World
      A list         : string
                       1
                       True
  ```

arg_flattening: false

posargs:
  key_or_dict:
    type: str | dict[str | bool | int | dep | external_program | list[str | bool | int | dep | external_program]]
    description: |
      The name of the new entry, or a dict containing multiple entries.  If a
      dict is passed it is equivalent to calling summary() once for each
      key-value pair.  Keep in mind that dictionaries do not guarantee
      ordering.

optargs:
  value:
    type: str | bool | int | dep | external_program | list[str | bool | int | dep | external_program]
    description: |
      The value to print for the `key`.  Only valid if `key_or_dict` is a str.

kwargs:
  bool_yn:
    type: bool
    default: false
    description: Convert bool values to yes and no
  section:
    type: str
    description: The section to put this summary information under.  If the
      section keyword argument is omitted, key/value pairs are implicitly
      grouped into a section with no title.
  list_sep:
    type: str
    since: 0.54.0
    description: |
      The separator to use when printing list values in this summary.  If no
      separator is given, each list item will be printed on its own line.