From dad395d25284d2257d6c4c63f5a1a4c7458d9719 Mon Sep 17 00:00:00 2001 From: Yash Karandikar Date: Thu, 22 Sep 2022 10:11:17 -0500 Subject: [PATCH] Create skeleton plugin --- Cargo.toml | 3 +++ src/lib.rs | 28 ++++++++++++++++++++++++++++ src/main.rs | 3 --- 3 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 src/lib.rs delete mode 100644 src/main.rs diff --git a/Cargo.toml b/Cargo.toml index 1dff39a..52e9b0d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[lib] +name = "weechat_notify" +crate-type = ["cdylib"] [dependencies] weechat = "0.4.0" diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..1c55b06 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,28 @@ +use weechat::plugin; +use weechat::Args; +use weechat::Plugin; +use weechat::Weechat; + +struct WeechatNotify; + +impl Plugin for WeechatNotify { + fn init(_: &Weechat, _: Args) -> Result { + Weechat::print("Hello from weechat-notify!"); + Ok(Self) + } +} + +impl Drop for WeechatNotify { + fn drop(&mut self) { + Weechat::print("Bye from weechat-notify!"); + } +} + +plugin! { + WeechatNotify, + name: "weechat-notify", + author: "Yash Karandikar ", + description: "Notification plugin for weechat written in Rust", + version: "0.1.0", + license: "0BSD" +} diff --git a/src/main.rs b/src/main.rs deleted file mode 100644 index e7a11a9..0000000 --- a/src/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("Hello, world!"); -}