feat: open psql in the database container
This commit is contained in:
@@ -4,6 +4,7 @@ use super::{Argv, Cmd};
|
||||
pub struct Exec {
|
||||
container: String,
|
||||
interactive: bool,
|
||||
tty: bool,
|
||||
inner: Argv,
|
||||
}
|
||||
|
||||
@@ -12,10 +13,17 @@ impl Exec {
|
||||
Self {
|
||||
container: container.to_string(),
|
||||
interactive: false,
|
||||
tty: false,
|
||||
inner,
|
||||
}
|
||||
}
|
||||
|
||||
// a terminal, for a command that is a shell rather than a pipe stage
|
||||
pub fn tty(mut self, tty: bool) -> Self {
|
||||
self.tty = tty;
|
||||
self
|
||||
}
|
||||
|
||||
// keep stdin open, for a command that is fed a dump
|
||||
pub fn interactive(mut self) -> Self {
|
||||
self.interactive = true;
|
||||
@@ -31,6 +39,10 @@ impl Cmd for Exec {
|
||||
argv = argv.arg("--interactive");
|
||||
}
|
||||
|
||||
if self.tty {
|
||||
argv = argv.arg("--tty");
|
||||
}
|
||||
|
||||
argv.arg(&self.container).args(self.inner.words())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user