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]
|
||||
clap = { version = "4.3.10", features = ["derive"] }
|
||||
labadoor-telegram = { path = "../labadoor-telegram" }
|
||||
labadoor-matrix = { path = "../labadoor-matrix" }
|
||||
labadoor-csv = { path = "../labadoor-csv" }
|
||||
labadoor-gpio = { path = "../labadoor-gpio" }
|
||||
labadoor-telegram = { path = "../labadoor-telegram", optional = true }
|
||||
labadoor-matrix = { path = "../labadoor-matrix", optional = true }
|
||||
labadoor-csv = { path = "../labadoor-csv", optional = true }
|
||||
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)]
|
||||
enum Command {
|
||||
#[cfg(feature = "telegram")]
|
||||
Telegram,
|
||||
#[cfg(feature = "matrix")]
|
||||
Matrix,
|
||||
#[cfg(feature = "csv")]
|
||||
CSV,
|
||||
#[cfg(feature = "gpio")]
|
||||
GPIO,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let cli = Cli::parse();
|
||||
match &cli.command {
|
||||
#[cfg(feature = "telegram")]
|
||||
Command::Telegram => {
|
||||
labadoor_telegram::main();
|
||||
}
|
||||
#[cfg(feature = "matrix")]
|
||||
Command::Matrix => {
|
||||
labadoor_matrix::main();
|
||||
}
|
||||
#[cfg(feature = "csv")]
|
||||
Command::CSV => {
|
||||
labadoor_csv::main();
|
||||
}
|
||||
#[cfg(feature = "gpio")]
|
||||
Command::GPIO => {
|
||||
labadoor_gpio::main();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue