1
0
Fork 0
mirror of https://codeberg.org/icewind/haze.git synced 2026-06-03 17:14:08 +02:00
This commit is contained in:
Robin Appelman 2025-03-04 22:14:12 +01:00
commit 28ad29ede3
3 changed files with 30 additions and 32 deletions

View file

@ -8,63 +8,61 @@ use std::str::FromStr;
#[derive(Debug, Clone, Eq, PartialEq)] #[derive(Debug, Clone, Eq, PartialEq)]
pub enum HazeArgs { pub enum HazeArgs {
List { /// List all instances
filter: Option<String>, List { filter: Option<String> },
}, /// Start a new instance
Start { Start { options: CloudOptions },
options: CloudOptions, /// Stop an instance
}, Stop { filter: Option<String> },
Stop { /// Run tests in a new instance
filter: Option<String>,
},
Test { Test {
options: CloudOptions, options: CloudOptions,
args: Vec<String>, args: Vec<String>,
}, },
/// Run a command in an instance
Exec { Exec {
filter: Option<String>, filter: Option<String>,
service: Option<ExecService>, service: Option<ExecService>,
command: Vec<String>, command: Vec<String>,
}, },
/// Run an occ command in an instance
Occ { Occ {
filter: Option<String>, filter: Option<String>,
command: Vec<String>, command: Vec<String>,
}, },
Db { /// Connect to the database of an instance
filter: Option<String>, Db { filter: Option<String>, root: bool },
root: bool, /// Remove all non-pinned instances
},
Clean, Clean,
/// View the logs from an instance or service
Logs { Logs {
filter: Option<String>, filter: Option<String>,
follow: bool, follow: bool,
service: Option<LogService>, service: Option<LogService>,
count: Option<usize>, count: Option<usize>,
}, },
Open { /// Open an instance in the browser
filter: Option<String>, Open { filter: Option<String> },
}, /// Run code formatting from a new instance
Fmt { Fmt { path: String },
path: String, /// Run integration tests in a new instance
},
Integration { Integration {
options: CloudOptions, options: CloudOptions,
args: Vec<String>, args: Vec<String>,
}, },
/// Start a shell in an empirical instance
Shell { Shell {
options: CloudOptions, options: CloudOptions,
command: Vec<String>, command: Vec<String>,
}, },
Pin { /// Pin an instance
filter: Option<String>, Pin { filter: Option<String> },
}, /// Unpin an instance
Unpin { Unpin { filter: Option<String> },
filter: Option<String>, /// Start the proxy
},
Proxy, Proxy,
Checkout { /// Checkout a branch in all apps
branch: String, Checkout { branch: String },
},
Env { Env {
filter: Option<String>, filter: Option<String>,
command: String, command: String,
@ -120,7 +118,7 @@ impl HazeArgs {
None => { None => {
return Ok(HazeArgs::List { return Ok(HazeArgs::List {
filter: Some(command_or_filter.into()), filter: Some(command_or_filter.into()),
}) });
} }
}; };
if !cmd.allows_filter() { if !cmd.allows_filter() {

View file

@ -350,10 +350,10 @@ async fn main() -> Result<()> {
.ok_or_else(|| Report::msg(format!("{} is not running", cloud.id)))?; .ok_or_else(|| Report::msg(format!("{} is not running", cloud.id)))?;
let db_type = match cloud.db().family() { let db_type = match cloud.db().family() {
DatabaseFamily::Sqlite => { DatabaseFamily::Sqlite => {
return Err(Report::msg("sqlite is not supported with `haze env`")) return Err(Report::msg("sqlite is not supported with `haze env`"));
} }
DatabaseFamily::Oracle => { DatabaseFamily::Oracle => {
return Err(Report::msg("oracle is not supported with `haze env`")) return Err(Report::msg("oracle is not supported with `haze env`"));
} }
DatabaseFamily::Mysql | DatabaseFamily::MariaDB => "mysql", DatabaseFamily::Mysql | DatabaseFamily::MariaDB => "mysql",
DatabaseFamily::Postgres => "postgresql", DatabaseFamily::Postgres => "postgresql",

View file

@ -1,5 +1,5 @@
use bollard::network::CreateNetworkOptions;
use bollard::Docker; use bollard::Docker;
use bollard::network::CreateNetworkOptions;
use miette::{IntoDiagnostic, Result, WrapErr}; use miette::{IntoDiagnostic, Result, WrapErr};
pub async fn clear_networks(docker: &Docker) -> Result<()> { pub async fn clear_networks(docker: &Docker) -> Result<()> {