File: dch.rs

package info (click to toggle)
rust-debian-changelog 0.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 364 kB
  • sloc: makefile: 2
file content (22 lines) | stat: -rw-r--r-- 677 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//! A simple example of making a change to a changelog file

use std::io::Read;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let file = std::fs::File::open("/usr/share/doc/rustc/changelog.Debian.gz")?;
    let mut gz = flate2::read::GzDecoder::new(file);
    let mut contents = String::new();
    gz.read_to_string(&mut contents)?;
    let mut changelog: debian_changelog::ChangeLog = contents.parse()?;
    changelog.auto_add_change(
        &["* Make a change"],
        (
            "Jelmer Vernooij".to_string(),
            "jelmer@debian.org".to_string(),
        ),
        None,
        None,
    );
    changelog.write(std::io::stdout())?;
    Ok(())
}