feat: add basic error handling
Add anyhow::Result<()> return signature to all scripts and main.
This commit is contained in:
parent
4762c991a3
commit
9f3cc86e3f
|
@ -36,7 +36,5 @@ fn main() -> Result<()> {
|
||||||
cli::Postgres::Import { path } => scripts::postgres::import(&path),
|
cli::Postgres::Import { path } => scripts::postgres::import(&path),
|
||||||
cli::Postgres::Dump { path } => scripts::postgres::dump(&path),
|
cli::Postgres::Dump { path } => scripts::postgres::dump(&path),
|
||||||
},
|
},
|
||||||
};
|
}
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,20 @@
|
||||||
|
use anyhow::Result;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
pub fn make_command(app: &PathBuf, command: &str) {
|
pub fn make_command(app: &PathBuf, command: &str) -> Result<()> {
|
||||||
println!("{app:?} and {command:?}");
|
println!("{app:?} and {command:?}");
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
pub fn makemigrations() {
|
pub fn makemigrations() -> Result<()> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
pub fn manage(command: &[String]) {
|
pub fn manage(command: &[String]) -> Result<()> {
|
||||||
println!("{command:?}");
|
println!("{command:?}");
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
pub fn migrate() {
|
pub fn migrate() -> Result<()> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
pub fn shell() {
|
pub fn shell() -> Result<()> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
pub fn stop_all() {
|
use anyhow::Result;
|
||||||
|
|
||||||
|
pub fn stop_all() -> Result<()> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,34 +1,35 @@
|
||||||
use super::DockerCommand;
|
use super::DockerCommand;
|
||||||
|
use anyhow::Result;
|
||||||
|
|
||||||
// simple commands
|
// simple commands
|
||||||
pub fn build() {
|
pub fn build() -> Result<()> {
|
||||||
DockerCommand::docker_compose().args("build").spawn_wait();
|
DockerCommand::docker_compose().args("build").spawn_wait()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn down() {
|
pub fn down() -> Result<()> {
|
||||||
DockerCommand::docker_compose().args("down").spawn_wait();
|
DockerCommand::docker_compose().args("down").spawn_wait()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn start() {
|
pub fn start() -> Result<()> {
|
||||||
DockerCommand::docker_compose().args("start").spawn_wait();
|
DockerCommand::docker_compose().args("start").spawn_wait()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn stop() {
|
pub fn stop() -> Result<()> {
|
||||||
DockerCommand::docker_compose().args("stop").spawn_wait();
|
DockerCommand::docker_compose().args("stop").spawn_wait()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn up() {
|
pub fn up() -> Result<()> {
|
||||||
DockerCommand::docker_compose().args("up -d").spawn_wait();
|
DockerCommand::docker_compose().args("up -d").spawn_wait()
|
||||||
}
|
}
|
||||||
|
|
||||||
// shortcuts
|
// shortcuts
|
||||||
pub fn rebuild() {
|
pub fn rebuild() -> Result<()> {
|
||||||
stop();
|
stop()?;
|
||||||
build();
|
build()?;
|
||||||
start();
|
start()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn restart() {
|
pub fn restart() -> Result<()> {
|
||||||
stop();
|
stop()?;
|
||||||
start();
|
start()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
|
use anyhow::Result;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
pub fn import(path: &PathBuf) {
|
pub fn import(path: &PathBuf) -> Result<()> {
|
||||||
println!("{path:?}");
|
println!("{path:?}");
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn dump(path: &PathBuf) {
|
pub fn dump(path: &PathBuf) -> Result<()> {
|
||||||
println!("{path:?}");
|
println!("{path:?}");
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue