feat: custom command builder

Implemented custom command builder with nicer api suited for my needs.
Also returned error if there are no containers in
`scripts::postgres::get_containers`.
This commit is contained in:
2023-06-02 17:18:25 +02:00
parent e3306c494d
commit 316b37cd05
7 changed files with 132 additions and 87 deletions

View File

@@ -1,6 +1,12 @@
#![allow(unused)]
use std::{
fs::{File, OpenOptions},
path::PathBuf,
};
pub mod cli;
pub mod command_builder;
pub mod scripts;
// NOTE: stolen from https://docs.rs/debug_print/latest/debug_print/
@@ -8,3 +14,11 @@ pub mod scripts;
macro_rules! debug_println {
($($arg:tt)*) => (if ::std::cfg!(debug_assertions) { ::std::println!($($arg)*); })
}
fn safe_create_file(path: PathBuf) -> Result<File, std::io::Error> {
OpenOptions::new().write(true).create_new(true).open(path)
}
fn create_file(path: PathBuf) -> Result<File, std::io::Error> {
OpenOptions::new().write(true).create(true).open(path)
}