Create skeleton plugin

This commit is contained in:
Yash Karandikar 2022-09-22 10:11:17 -05:00
parent 4eff91c9e6
commit dad395d252
3 changed files with 31 additions and 3 deletions

View file

@ -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"

28
src/lib.rs Normal file
View file

@ -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<Self, ()> {
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 <yash@karx.xyz>",
description: "Notification plugin for weechat written in Rust",
version: "0.1.0",
license: "0BSD"
}

View file

@ -1,3 +0,0 @@
fn main() {
println!("Hello, world!");
}