adjust to submodules

This commit is contained in:
2023-02-26 19:05:46 +03:00
parent d83af3e6cd
commit a657174b56
4 changed files with 9 additions and 1538 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
/target
Cargo.lock

1528
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -2,11 +2,11 @@ use std::env;
fn main() {
let rev = get_value_from_env("GIT_VERSION")
.or_else(|| get_value_from_command("git", &["rev-parse", "--short", "HEAD"]))
.or_else(|| get_value_from_command("git", ["rev-parse", "--short", "HEAD"]))
.unwrap_or_else(|| "unknown".to_owned());
let branch = get_value_from_env("GIT_BRANCH")
.or_else(|| get_value_from_command("git", &["rev-parse", "--abbrev-ref", "HEAD"]))
.or_else(|| get_value_from_command("git", ["rev-parse", "--abbrev-ref", "HEAD"]))
.unwrap_or_else(|| "unknown".to_owned());
println!("cargo:rustc-env=GIT_REVISION={}", rev);
@ -15,7 +15,7 @@ fn main() {
}
fn get_value_from_env(key: &str) -> Option<String> {
env::var(key).map_or_else(|_| None, |v| Some(v))
env::var(key).map_or_else(|_| None, Some)
}
fn get_value_from_command<I: IntoIterator<Item = S>, S: AsRef<std::ffi::OsStr>>(

View File

@ -1,10 +1,9 @@
use env_logger;
use envconfig::Envconfig;
use log::{debug, info, warn};
use teloxide::{prelude::*, utils::command::BotCommand};
const VERSION: &'static str = env!("GIT_REVISION");
const BRANCH: &'static str = env!("GIT_BRANCH");
const VERSION: &str = env!("GIT_REVISION");
const BRANCH: &str = env!("GIT_BRANCH");
#[tokio::main]
async fn main() {
@ -45,10 +44,9 @@ async fn run() {
teloxide::commands_repl(bot, bot_name, move |cx, command| {
let climate = settings.climate_dsn.clone();
let cmd: String = settings.hosttemp_cmd.clone();
let cmd: Vec<&str> = cmd.split(" ").collect();
let console_cmd = cmd.get(0).expect("getting console command").to_string();
let arg: String = cmd.get(1).unwrap_or_else(|| &"").to_string();
// let startup = std::sync::Arc::from(*startup);
let cmd: Vec<&str> = cmd.split(' ').collect();
let console_cmd = cmd.first().expect("getting console command").to_string();
let arg: String = cmd.get(1).unwrap_or(&"").to_string();
let startup = *startup;
async move { handler(cx, command, climate, console_cmd, arg, startup).await }