mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-22 08:34:20 +01:00
cln-plugin: Rework the plugin library using a Builder
This commit is contained in:
committed by
Rusty Russell
parent
4aba119733
commit
22618a2f94
@@ -6,17 +6,13 @@ use tokio;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), anyhow::Error> {
|
||||
let (plugin, stdin) = Builder::new((), tokio::io::stdin(), tokio::io::stdout())
|
||||
let plugin = Builder::new((), tokio::io::stdin(), tokio::io::stdout())
|
||||
.option(options::ConfigOption::new(
|
||||
"test-option",
|
||||
options::Value::Integer(42),
|
||||
"a test-option with default 42",
|
||||
))
|
||||
.build();
|
||||
|
||||
tokio::spawn(async {
|
||||
tokio::time::sleep(tokio::time::Duration::from_millis(1000)).await;
|
||||
log::info!("Hello world");
|
||||
});
|
||||
plugin.run(stdin).await
|
||||
.start()
|
||||
.await?;
|
||||
plugin.join().await
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user