Rename library functions from "main"

This commit is contained in:
George Kaklamanos 2023-06-30 18:02:40 +03:00
parent 6e6d4b227d
commit 983456997b
5 changed files with 8 additions and 8 deletions

View file

@ -62,7 +62,7 @@ fn auth_user(username: String, resource: String) -> Result<(), ()> {
return ret;
}
pub fn main() {
pub fn csv() {
let args: Vec<String> = std::env::args().collect();
let method = String::from(&args[1]);
let identifier = String::from(&args[2]);

View file

@ -1,6 +1,6 @@
use gpio_cdev::{Chip, LineRequestFlags};
pub fn main() {
pub fn gpio() {
let mut chip = Chip::new("/dev/gpiochip0").unwrap();
let handle = chip
.get_line(6)

View file

@ -30,7 +30,7 @@ async fn on_room_message(event: SyncMessageEvent<MessageEventContent>, room: Roo
}
#[tokio::main]
pub async fn main(username: String, password: String) -> Result<()> {
pub async fn matrix(username: String, password: String) -> Result<()> {
let user = UserId::try_from(username)?;
let client = Client::new_from_user_id(user.clone()).await?;

View file

@ -43,7 +43,7 @@ async fn answer(
}
#[tokio::main]
pub async fn main(token: String) {
pub async fn telegram(token: String) {
teloxide::enable_logging!();
log::info!("Starting labadoor Telegram bot...");
let bot = Bot::new(token).auto_send();

View file

@ -5,19 +5,19 @@ fn main() {
match &cli.command {
#[cfg(feature = "telegram")]
cli::Command::Telegram(_) => {
labadoor_telegram::main();
labadoor_telegram::telegram();
}
#[cfg(feature = "matrix")]
cli::Command::Matrix(_) => {
labadoor_matrix::main();
labadoor_matrix::matrix();
}
#[cfg(feature = "csv")]
cli::Command::CSV => {
labadoor_csv::main();
labadoor_csv::csv();
}
#[cfg(feature = "gpio")]
cli::Command::GPIO => {
labadoor_gpio::main();
labadoor_gpio::gpio();
}
}
}