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,12 +1,13 @@
use crate::scripts::{create_file, safe_create_file};
use super::DockerCommand;
use anyhow::{anyhow, Result};
use std::env;
use std::fs::create_dir;
use std::io::Write;
use std::path::{Path, PathBuf};
use anyhow::{anyhow, Result};
use crate::command_builder::CommandBuilder;
use crate::{create_file, safe_create_file};
fn get_django_settings_module() -> Result<String> {
let dsm = env::var("DJANGO_SETTINGS_MODULE")?;
println!("USING: {dsm}");
@@ -64,7 +65,7 @@ pub fn manage(rest: &[String]) -> Result<()> {
let dsm = get_django_settings_module()?;
let joined = rest.join(" ");
let command = format!("exec appserver python manage.py {joined} --settings={dsm}");
DockerCommand::docker_compose().args(&command).spawn_wait()
CommandBuilder::docker_compose().args(&command).exec()
}
// shortcuts