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
// This file is part of helpers4.
// Copyright (C) 2025 baxyz
// SPDX-License-Identifier: LGPL-3.0-or-later
/// The two-line source header that carries a copyright notice and an SPDX license identifier.
///
/// ```text
/// Copyright (C) 2025 Jane Doe
/// SPDX-License-Identifier: MIT
/// ```
///
/// The text has no comment marker, so prefix each line for the language of the file
/// (`// `, `# `, ...). The [REUSE](https://reuse.software) specification and most license
/// scanners read exactly these two lines. Nothing is validated: `years` can be `"2025"` or
/// `"2020-2025"`, and `expression` any SPDX expression (see
/// [`Expression`](super::Expression)).
///
/// # Arguments
///
/// - `holder` - The copyright holder, such as a name or an organization.
/// - `years` - The year or range of years of the notice.
/// - `expression` - The SPDX license identifier or expression.
///
/// # Returns
///
/// The two lines, without a trailing newline.
///
/// # Examples
///
/// ```
/// use helpers4::license::header;
///
/// let header = header("Jane Doe", "2025", "MIT OR Apache-2.0");
/// assert_eq!(header, "Copyright (C) 2025 Jane Doe\nSPDX-License-Identifier: MIT OR Apache-2.0");
/// let commented: Vec<String> = header.lines().map(|line| format!("// {line}")).collect();
/// assert_eq!(commented[1], "// SPDX-License-Identifier: MIT OR Apache-2.0");
/// ```