forked from gkaklas/labadoor
Add crate features to select used functionality
This commit is contained in:
parent
ed628b2ee3
commit
1eef68f859
2 changed files with 18 additions and 4 deletions
|
@ -5,7 +5,13 @@ edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "4.3.10", features = ["derive"] }
|
clap = { version = "4.3.10", features = ["derive"] }
|
||||||
labadoor-telegram = { path = "../labadoor-telegram" }
|
labadoor-telegram = { path = "../labadoor-telegram", optional = true }
|
||||||
labadoor-matrix = { path = "../labadoor-matrix" }
|
labadoor-matrix = { path = "../labadoor-matrix", optional = true }
|
||||||
labadoor-csv = { path = "../labadoor-csv" }
|
labadoor-csv = { path = "../labadoor-csv", optional = true }
|
||||||
labadoor-gpio = { path = "../labadoor-gpio" }
|
labadoor-gpio = { path = "../labadoor-gpio", optional = true }
|
||||||
|
|
||||||
|
[features]
|
||||||
|
telegram = [ "dep:labadoor-telegram" ]
|
||||||
|
matrix = [ "dep:labadoor-matrix" ]
|
||||||
|
csv = [ "dep:labadoor-csv" ]
|
||||||
|
gpio = [ "dep:labadoor-gpio" ]
|
||||||
|
|
|
@ -8,24 +8,32 @@ struct Cli {
|
||||||
|
|
||||||
#[derive(Parser, Debug)]
|
#[derive(Parser, Debug)]
|
||||||
enum Command {
|
enum Command {
|
||||||
|
#[cfg(feature = "telegram")]
|
||||||
Telegram,
|
Telegram,
|
||||||
|
#[cfg(feature = "matrix")]
|
||||||
Matrix,
|
Matrix,
|
||||||
|
#[cfg(feature = "csv")]
|
||||||
CSV,
|
CSV,
|
||||||
|
#[cfg(feature = "gpio")]
|
||||||
GPIO,
|
GPIO,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let cli = Cli::parse();
|
let cli = Cli::parse();
|
||||||
match &cli.command {
|
match &cli.command {
|
||||||
|
#[cfg(feature = "telegram")]
|
||||||
Command::Telegram => {
|
Command::Telegram => {
|
||||||
labadoor_telegram::main();
|
labadoor_telegram::main();
|
||||||
}
|
}
|
||||||
|
#[cfg(feature = "matrix")]
|
||||||
Command::Matrix => {
|
Command::Matrix => {
|
||||||
labadoor_matrix::main();
|
labadoor_matrix::main();
|
||||||
}
|
}
|
||||||
|
#[cfg(feature = "csv")]
|
||||||
Command::CSV => {
|
Command::CSV => {
|
||||||
labadoor_csv::main();
|
labadoor_csv::main();
|
||||||
}
|
}
|
||||||
|
#[cfg(feature = "gpio")]
|
||||||
Command::GPIO => {
|
Command::GPIO => {
|
||||||
labadoor_gpio::main();
|
labadoor_gpio::main();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue