adjust to submodules
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
/target
|
||||
Cargo.lock
|
||||
|
||||
1528
Cargo.lock
generated
1528
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
6
build.rs
6
build.rs
@ -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>>(
|
||||
|
||||
12
src/main.rs
12
src/main.rs
@ -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 }
|
||||
|
||||
Reference in New Issue
Block a user