Crate debian_watch

Source
Expand description

Formatting-preserving parser and editor for Debian watch files

§Example

let wf = debian_watch::WatchFile::new(None);
assert_eq!(wf.version(), debian_watch::DEFAULT_VERSION);
assert_eq!("", wf.to_string());

let wf = debian_watch::WatchFile::new(Some(4));
assert_eq!(wf.version(), 4);
assert_eq!("version=4\n", wf.to_string());

let wf: debian_watch::WatchFile = r#"version=4
opts=foo=blah https://foo.com/bar .*/v?(\d\S+)\.tar\.gz
"#.parse().unwrap();
assert_eq!(wf.version(), 4);
assert_eq!(wf.entries().collect::<Vec<_>>().len(), 1);
let entry = wf.entries().next().unwrap();
assert_eq!(entry.opts(), maplit::hashmap! {
   "foo".to_string() => "blah".to_string(),
});
assert_eq!(&entry.url(), "https://foo.com/bar");
assert_eq!(entry.matching_pattern().as_deref(), Some(".*/v?(\\d\\S+)\\.tar\\.gz"));

Structs§

Entry
A node in the syntax tree for $ast
WatchFile
A node in the syntax tree for $ast

Enums§

ComponentType
The type of the component
Compression
Compression type
GitExport
Git export mode
GitMode
Git clone operation mode
Mode
Archive download mode
PgpMode
PGP verification mode
Pretty
How to generate upstream version string from git tags
SearchMode
How to search for the upstream tarball
VersionPolicy
The version policy to use when downloading upstream tarballs

Constants§

DEFAULT_VERSION
Any watch files without a version are assumed to be version 1.