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:
14
src/lib.rs
14
src/lib.rs
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user