blob: 27d4e6c673d91715014172a90f07a3b8baad418f (
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
|
//! # Iris
//! A locking plugin manager for vim
mod model;
pub use model::{config::Config, plugin::Plugin, repo::Repository};
mod parse;
mod error;
pub use error::{Error, Result};
pub mod path;
use std::{
fs::File,
io::{BufWriter, Write},
path::Path,
};
/// Iris copyright header prepended to all generated files
const COPYRIGHT_HEADER: &str = "\
IRIS - A locking plugin manager for vim
Copyright © 2025 Freya Murphy <contact@freyacat.org>
This file is part of IRIS
IRIS is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or (at
your option) any later version.
IRIS is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with IRIS. If not, see <http://www.gnu.org/licenses/>.";
/// Opens file writer at `path` with copyright header already written
pub(crate) fn get_writer<P>(path: P, c: char) -> Result<BufWriter<File>>
where
P: AsRef<Path>,
{
let file = File::create(path)?;
let mut w = BufWriter::new(file);
for line in COPYRIGHT_HEADER.lines() {
writeln!(w, "{c}{c}{c} {line}")?;
}
writeln!(w)?;
Ok(w)
}
|