feat: finish postgres cli

Implemented basic wanted functionality for postgres subcommands. We
currently assume that postgres is running in docker-compose project in a
service named "postgresdb". This could be looked at and changed at some
point in the future.
This commit is contained in:
2023-05-23 23:40:29 +02:00
parent 7b64d6192a
commit a625d5f43c
2 changed files with 76 additions and 9 deletions

View File

@@ -7,7 +7,7 @@ use std::{
ffi::OsStr,
fs::{File, OpenOptions},
path::PathBuf,
process::Command,
process::{Command, Stdio},
};
use anyhow::{Context, Result};
@@ -47,6 +47,12 @@ impl DockerCommand {
self.command.spawn()?.wait()?;
Ok(())
}
fn write_stdout(mut self, stdio: Stdio) -> Result<()> {
self.command.stdout(stdio);
self.spawn_wait()?;
Ok(())
}
}
fn safe_create_file(path: PathBuf) -> Result<File, std::io::Error> {