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 2021-03-13 22:30:18 +01:00
commit 67c2b59639
4 changed files with 21 additions and 1 deletions

10
Cargo.lock generated
View file

@ -383,6 +383,7 @@ dependencies = [
"futures-util", "futures-util",
"maplit", "maplit",
"min-id", "min-id",
"opener",
"parse-display", "parse-display",
"termion", "termion",
"tokio", "tokio",
@ -658,6 +659,15 @@ version = "1.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af8b08b04175473088b46763e51ee54da5f9a164bc162f615b91bc179dbf15a3" checksum = "af8b08b04175473088b46763e51ee54da5f9a164bc162f615b91bc179dbf15a3"
[[package]]
name = "opener"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13117407ca9d0caf3a0e74f97b490a7e64c0ae3aa90a8b7085544d0c37b6f3ae"
dependencies = [
"winapi",
]
[[package]] [[package]]
name = "owo-colors" name = "owo-colors"
version = "1.3.0" version = "1.3.0"

View file

@ -14,3 +14,4 @@ tokio = { version = "1" , features = ["fs", "macros"] }
parse-display = "0.4" parse-display = "0.4"
futures-util = "0.3" futures-util = "0.3"
termion = "1" termion = "1"
opener = "0.4"

View file

@ -49,6 +49,7 @@ pub enum HazeCommand {
Db, Db,
Clean, Clean,
Logs, Logs,
Open,
} }
impl FromStr for HazeCommand { impl FromStr for HazeCommand {
@ -65,6 +66,7 @@ impl FromStr for HazeCommand {
"db" => Ok(HazeCommand::Db), "db" => Ok(HazeCommand::Db),
"clean" => Ok(HazeCommand::Clean), "clean" => Ok(HazeCommand::Clean),
"logs" => Ok(HazeCommand::Logs), "logs" => Ok(HazeCommand::Logs),
"open" => Ok(HazeCommand::Open),
_ => Err(Report::msg(format!("Unknown command: {}", s))), _ => Err(Report::msg(format!("Unknown command: {}", s))),
} }
} }

View file

@ -99,6 +99,13 @@ async fn main() -> Result<()> {
let cloud = get_by_filter(&mut docker, None, &config).await?; let cloud = get_by_filter(&mut docker, None, &config).await?;
cloud.db.exec(&mut docker, &cloud.id).await?; cloud.db.exec(&mut docker, &cloud.id).await?;
} }
HazeCommand::Open => {
let cloud = get_by_filter(&mut docker, None, &config).await?;
match cloud.ip {
Some(ip) => opener::open(format!("http://{}", ip))?,
None => eprintln!("{} is not running", cloud.id),
}
}
HazeCommand::Test => { HazeCommand::Test => {
todo!(); todo!();
} }