Debian Codegraph @

examples/license-for-file.rs

raw
1 use debian_copyright::Copyright;
2 use std::path::Path;
3
4 pub const TEXT: &str = r#"Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
5 Upstream-Author: John Doe <john@example>
6 Upstream-Name: example
7 Source: https://example.com/example
8
9 Files: *
10 License: GPL-3+
11 Copyright: 2019 John Doe
12
13 Files: debian/*
14 License: GPL-3+
15 Copyright: 2019 Jane Packager
16
17 License: GPL-3+
18 This program is free software: you can redistribute it and/or modify
19 it under the terms of the GNU General Public License as published by
20 the Free Software Foundation, either version 3 of the License, or
21 (at your option) any later version.
22 "#;
23
24 pub fn main() {
25 let c = TEXT.parse::<Copyright>().unwrap();
26 let license = c.find_license_for_file(Path::new("debian/foo")).unwrap();
27 println!("{}", license.name().unwrap());
28 }