From c2cff416d070ea3aa86d14ccdb25dc4491086206 Mon Sep 17 00:00:00 2001 From: glyph Date: Thu, 4 Nov 2021 16:58:12 +0200 Subject: [PATCH] update code example --- README.md | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b9b05a1..10d276c 100644 --- a/README.md +++ b/README.md @@ -5,12 +5,21 @@ Rust wrapper around the Go `sbotcli` ScuttleButt tool ([cryptoscope/ssb](https:/ ## Example ```rust -let id = "@p13zSAiOpguI9nsawkGijsnMfWmFd5rlUNpzekEE+vI=.ed25519"; +use peach_sbotcli::{Sbot, SbotCliError}; -let follow_ref = peach_sbotcli::follow(id)?; -let block_ref = peach_sbotcli::block(id)?; +fn example() -> Result<(), SbotCliError> { + // uses default paths for `sbotcli` and `go-sbot` working directory + let sbot = Sbot::init(None, None)?; -let invite_code = peach_sbotcli::create_invite()?; + let id = "@p13zSAiOpguI9nsawkGijsnMfWmFd5rlUNpzekEE+vI=.ed25519"; + + let follow_ref = sbot.follow(id)?; + let block_ref = sbot.block(id)?; + + let invite_code = sbot.create_invite()?; + + Ok(()) +} ``` ## Documentation