This PR takes the previously-implemented sbotcli functions and converts them into methods on the Sbotstruct. An init() constructor method has been added for initialising the Sbotstruct. It takes two Option<OsString> args as parameters; one representing the sbotcli path and the other representing the go-sbot working directory. None can be provided to use the default path.
usepeach_sbotcli::{Sbot,SbotCliError};fnexample()-> Result<(),SbotCliError>{// uses default paths for `sbotcli` and `go-sbot` working directory
letsbot=Sbot::init(None,None)?;letid="@p13zSAiOpguI9nsawkGijsnMfWmFd5rlUNpzekEE+vI=.ed25519";letfollow_ref=sbot.follow(id)?;letblock_ref=sbot.block(id)?;letinvite_code=sbot.create_invite()?;Ok(())}
This PR takes the previously-implemented `sbotcli` functions and converts them into methods on the `Sbot` `struct`. An `init()` constructor method has been added for initialising the `Sbot` `struct`. It takes two `Option<OsString>` args as parameters; one representing the `sbotcli` path and the other representing the `go-sbot` working directory. `None` can be provided to use the default path.
Thanks @notplants for [the suggestion](https://git.coopcloud.tech/PeachCloud/peach-sbotcli/issues/1#issuecomment-10004).
The code example tells the story:
```rust
use peach_sbotcli::{Sbot, SbotCliError};
fn example() -> Result<(), SbotCliError> {
// uses default paths for `sbotcli` and `go-sbot` working directory
let sbot = Sbot::init(None, None)?;
let id = "@p13zSAiOpguI9nsawkGijsnMfWmFd5rlUNpzekEE+vI=.ed25519";
let follow_ref = sbot.follow(id)?;
let block_ref = sbot.block(id)?;
let invite_code = sbot.create_invite()?;
Ok(())
}
```
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
This PR takes the previously-implemented
sbotclifunctions and converts them into methods on theSbotstruct. Aninit()constructor method has been added for initialising theSbotstruct. It takes twoOption<OsString>args as parameters; one representing thesbotclipath and the other representing thego-sbotworking directory.Nonecan be provided to use the default path.Thanks @notplants for the suggestion.
The code example tells the story:
LGTM
🙏 🖤