From 7b410b883fb045ca11689ac28a1e137ac1a98b45 Mon Sep 17 00:00:00 2001 From: 29 <791603901@qq.com> Date: Sat, 6 Jul 2024 21:01:24 +0800 Subject: [PATCH] Update main.rs --- .github/workflow-bin/src/main.rs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflow-bin/src/main.rs b/.github/workflow-bin/src/main.rs index f4f8fd2..9538037 100644 --- a/.github/workflow-bin/src/main.rs +++ b/.github/workflow-bin/src/main.rs @@ -1,12 +1,12 @@ use clap::Parser; use pushover_rs::{send_pushover_request, PushoverSound}; -use std::env; +use std::{env, time::Duration}; +use tokio::time::sleep; #[derive(Parser, Debug)] enum Commands { Start, - Ok, - Err, + Run, } struct Pushover { @@ -41,8 +41,15 @@ async fn main() -> Result<(), anyhow::Error> { match Commands::parse() { Commands::Start => pushover.send("Workflow开始执行!", PushoverSound::BIKE), - Commands::Ok => pushover.send("Workflow执行成功!", PushoverSound::MAGIC), - Commands::Err => pushover.send("Workflow执行失败!", PushoverSound::FALLING), + Commands::Run => { + sleep(Duration::from_secs(3)).await; + + if true { + pushover.send("Workflow执行成功!", PushoverSound::MAGIC) + } else { + pushover.send("Workflow执行失败!", PushoverSound::FALLING) + } + } } .await }