feat: silence progress with --quiet
This commit is contained in:
@@ -45,11 +45,12 @@ fn restore_cluster(ctx: &Ctx, db: &Database, restore: &dyn Cmd, file: &Path) ->
|
||||
continue;
|
||||
}
|
||||
|
||||
note!("{line}");
|
||||
note!(ctx, "{line}");
|
||||
}
|
||||
|
||||
if existing > 0 {
|
||||
note!(
|
||||
ctx,
|
||||
"left {existing} existing role{} alone",
|
||||
if existing == 1 { "" } else { "s" }
|
||||
);
|
||||
@@ -66,11 +67,15 @@ pub fn import(ctx: &Ctx, file: &Path) -> Result<()> {
|
||||
let dump = Dump::of(file)?;
|
||||
let db = Database::resolve(ctx)?;
|
||||
|
||||
note!("stopping all containers");
|
||||
Stop.run(ctx)?;
|
||||
note!(ctx, "stopping all containers");
|
||||
Stop { quiet: ctx.quiet }.run(ctx)?;
|
||||
|
||||
note!("starting db container");
|
||||
Start::service(&db.service).run(ctx)?;
|
||||
note!(ctx, "starting db container");
|
||||
Start {
|
||||
service: &db.service,
|
||||
quiet: ctx.quiet,
|
||||
}
|
||||
.run(ctx)?;
|
||||
|
||||
let remote = remote_dump();
|
||||
|
||||
@@ -121,7 +126,7 @@ pub fn import(ctx: &Ctx, file: &Path) -> Result<()> {
|
||||
let restore = db.restore_with(kind);
|
||||
// the name of what actually runs, so the message cannot drift from it
|
||||
let tool = restore.argv().program().to_string();
|
||||
note!("restoring database with {tool}");
|
||||
note!(ctx, "restoring database with {tool}");
|
||||
|
||||
when_ready(
|
||||
ctx,
|
||||
@@ -149,7 +154,7 @@ pub fn import(ctx: &Ctx, file: &Path) -> Result<()> {
|
||||
|
||||
wait_until_ready(ctx, &db)?;
|
||||
if ctx.dry_run {
|
||||
note!("would restore with {tool}");
|
||||
note!(ctx, "would restore with {tool}");
|
||||
} else {
|
||||
// a directory dump was copied in whole, so pg_restore reads it from the
|
||||
// container; every other shape is fed in on stdin, through gunzip when it
|
||||
@@ -190,9 +195,9 @@ pub fn import(ctx: &Ctx, file: &Path) -> Result<()> {
|
||||
let _ = Rm::recursive(&remote).in_container(&db.container).run(ctx);
|
||||
}
|
||||
|
||||
note!("restarting containers");
|
||||
Stop.run(ctx)?;
|
||||
Up.run(ctx)?;
|
||||
note!(ctx, "restarting containers");
|
||||
Stop { quiet: ctx.quiet }.run(ctx)?;
|
||||
Up { quiet: ctx.quiet }.run(ctx)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -208,7 +213,7 @@ pub fn dump(ctx: &Ctx, file: &Path, format: Format, gzip: bool) -> Result<()> {
|
||||
return dump_directory(ctx, &db, file);
|
||||
}
|
||||
|
||||
note!("dumping to local file {}", file.to_string_lossy());
|
||||
note!(ctx, "dumping to local file {}", file.to_string_lossy());
|
||||
|
||||
// written beside the target and renamed once the dump succeeds, so a failure
|
||||
// cannot destroy the dump that is already there
|
||||
@@ -259,7 +264,7 @@ fn dump_directory(ctx: &Ctx, db: &Database, target: &Path) -> Result<()> {
|
||||
);
|
||||
}
|
||||
|
||||
note!("dumping to local directory {}", target.display());
|
||||
note!(ctx, "dumping to local directory {}", target.display());
|
||||
let remote = remote_dump();
|
||||
|
||||
PgDump::new(&db.user, &db.name, "d")
|
||||
|
||||
Reference in New Issue
Block a user