
* add docsmg tool * moved to the correct scripts directory * removed test files * added install script and readme draft to docsmg * fix install script * fixed issues * Revert "fixed issues" This reverts commita51192025f
. * Revert "Revert "fixed issues"" This reverts commitab68918fea
. * added dotenv and updated readme * fixed install script * update readme to ensure that new installers of rust have envs loaded * changed docsmg from using .env to docsmg.env * fixed docsmg to fix internal links in file * fixed docsmg migrate not making directories to file * fixed docsmg migrate trying to read pngs to string * did stuff * fix links * fix links 2 * fix links 3 * fix links * fix links * fix links * fix links * fix links * fixed docsmg migrate replacing links * fixed docsmg migrate replacing links * fixed docsmg migrate replacing links * fixed docsmg migrate replacing links * fixed links * update docsmg fixing links * update docsmg fixing links * update docsmg fixing links * update docsmg removing empty directories * remove changed docs * Revert "remove changed docs" This reverts commit2e21a5bac8
. * remove changed docs * fixed readme --------- Signed-off-by: Tana M Berry <tanamarieberry@yahoo.com> Co-authored-by: Tana M Berry <tanamarieberry@yahoo.com>
37 lines
1.1 KiB
Rust
37 lines
1.1 KiB
Rust
use std::{fs::read_to_string, path::PathBuf};
|
|
|
|
pub fn read_migrate_file(file: PathBuf) -> anyhow::Result<Vec<(PathBuf, PathBuf)>> {
|
|
let contents = read_to_string(file)?;
|
|
let lines: Vec<String> = contents
|
|
.split('\n')
|
|
.map(|x| x.to_owned())
|
|
.filter(|x| x != "")
|
|
.collect();
|
|
let migrations = lines
|
|
.iter()
|
|
.filter_map(|x| x.split_once(" -> "))
|
|
.filter(|x| !(x.0 == x.1))
|
|
.map(|x| {
|
|
(
|
|
x.0.parse().expect("a valid path"),
|
|
x.1.parse().expect("a valid path"),
|
|
)
|
|
})
|
|
.collect::<Vec<_>>();
|
|
Ok(migrations)
|
|
}
|
|
|
|
pub fn read_migrate_file_left_side(file: PathBuf) -> anyhow::Result<Vec<PathBuf>> {
|
|
let contents = read_to_string(file)?;
|
|
let lines: Vec<String> = contents
|
|
.split('\n')
|
|
.map(|x| x.to_owned())
|
|
.filter(|x| x != "")
|
|
.collect();
|
|
let migrations = lines
|
|
.iter()
|
|
.map(|x| x.split(" -> ").collect::<Vec<&str>>()[0].into())
|
|
.collect::<Vec<_>>();
|
|
Ok(migrations)
|
|
}
|