feat: swap println for eprintln or debug_eprintln
Unified expected output to always eprintln so outputs can be piped to other processes. Added debug_eprintln and switched all occurances of debug_println.
This commit is contained in:
@@ -10,7 +10,7 @@ use crate::{create_file, safe_create_file};
|
||||
|
||||
fn get_django_settings_module() -> Result<String> {
|
||||
let dsm = env::var("DJANGO_SETTINGS_MODULE")?;
|
||||
println!("USING: {dsm}");
|
||||
eprintln!("USING: {dsm}");
|
||||
|
||||
Ok(dsm)
|
||||
}
|
||||
@@ -32,7 +32,7 @@ pub fn make_command(app: &PathBuf, name: &str) -> Result<()> {
|
||||
return Err(anyhow!("directory {app_name} does not exist"));
|
||||
}
|
||||
|
||||
println!("found app {app_name}");
|
||||
eprintln!("found app {app_name}");
|
||||
|
||||
let management_dir = app_dir.join("management");
|
||||
|
||||
@@ -41,7 +41,7 @@ pub fn make_command(app: &PathBuf, name: &str) -> Result<()> {
|
||||
create_dir(&management_dir)?;
|
||||
create_file(management_dir.join("__init__.py"))?;
|
||||
|
||||
println!("created module {app_name}.management")
|
||||
eprintln!("created module {app_name}.management")
|
||||
};
|
||||
|
||||
let commands_dir = management_dir.join("commands");
|
||||
@@ -51,20 +51,20 @@ pub fn make_command(app: &PathBuf, name: &str) -> Result<()> {
|
||||
create_dir(&commands_dir)?;
|
||||
create_file(commands_dir.join("__init__.py"))?;
|
||||
|
||||
println!("created module {app_name}.management.commands")
|
||||
eprintln!("created module {app_name}.management.commands")
|
||||
};
|
||||
|
||||
let mut file = safe_create_file(commands_dir.join(format!("{name}.py")))?;
|
||||
file.write_all(DEBUG_TEMPLATE.as_bytes())?;
|
||||
|
||||
println!("created command {app_name}.management.commands.{name}");
|
||||
eprintln!("created command {app_name}.management.commands.{name}");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
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}");
|
||||
let command = format!("run --rm appserver python manage.py {joined} --settings={dsm}");
|
||||
CommandBuilder::docker_compose().args(&command).exec()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user