Update to the 2018 edition

Only 2 years later :eyeroll:
This commit is contained in:
Paul Woolcock
2020-06-11 12:09:52 -04:00
parent 17c727f5c6
commit 16bc060407
29 changed files with 30247 additions and 88 deletions
+2 -2
View File
@@ -5,11 +5,11 @@ extern crate pretty_env_logger;
extern crate elefren;
mod register;
use register::MastodonClient;
use crate::register::MastodonClient;
use std::error;
#[cfg(feature = "toml")]
fn main() -> Result<(), Box<error::Error>> {
fn main() -> Result<(), Box<dyn error::Error>> {
let mastodon = register::get_mastodon_data()?;
let input = register::read_line("Enter the account id you'd like to follow: ")?;
let new_follow = mastodon.follow(input.trim())?;
+2 -2
View File
@@ -5,11 +5,11 @@ extern crate pretty_env_logger;
extern crate elefren;
mod register;
use register::MastodonClient;
use crate::register::MastodonClient;
use std::error;
#[cfg(feature = "toml")]
fn main() -> Result<(), Box<error::Error>> {
fn main() -> Result<(), Box<dyn error::Error>> {
let mastodon = register::get_mastodon_data()?;
for account in mastodon.follows_me()?.items_iter() {
println!("{}", account.acct);
+2 -2
View File
@@ -5,11 +5,11 @@ extern crate pretty_env_logger;
extern crate elefren;
mod register;
use register::MastodonClient;
use crate::register::MastodonClient;
use std::error;
#[cfg(feature = "toml")]
fn main() -> Result<(), Box<error::Error>> {
fn main() -> Result<(), Box<dyn error::Error>> {
let mastodon = register::get_mastodon_data()?;
let tl = mastodon.get_home_timeline()?;
+2 -2
View File
@@ -5,11 +5,11 @@ extern crate pretty_env_logger;
extern crate elefren;
mod register;
use register::MastodonClient;
use crate::register::MastodonClient;
use std::error;
#[cfg(feature = "toml")]
fn main() -> Result<(), Box<error::Error>> {
fn main() -> Result<(), Box<dyn error::Error>> {
let mastodon = register::get_mastodon_data()?;
let you = mastodon.verify_credentials()?;
+4 -4
View File
@@ -11,14 +11,14 @@ use elefren::helpers::toml;
#[allow(dead_code)]
#[cfg(feature = "toml")]
fn main() -> Result<(), Box<Error>> {
fn main() -> Result<(), Box<dyn Error>> {
register()?;
Ok(())
}
#[allow(dead_code)]
#[cfg(feature = "toml")]
pub fn get_mastodon_data() -> Result<Mastodon, Box<Error>> {
pub fn get_mastodon_data() -> Result<Mastodon, Box<dyn Error>> {
if let Ok(data) = toml::from_file("mastodon-data.toml") {
Ok(Mastodon::from(data))
} else {
@@ -27,7 +27,7 @@ pub fn get_mastodon_data() -> Result<Mastodon, Box<Error>> {
}
#[cfg(feature = "toml")]
pub fn register() -> Result<Mastodon, Box<Error>> {
pub fn register() -> Result<Mastodon, Box<dyn Error>> {
let website = read_line("Please enter your mastodon instance url:")?;
let registration = Registration::new(website.trim())
.client_name("elefren-examples")
@@ -43,7 +43,7 @@ pub fn register() -> Result<Mastodon, Box<Error>> {
}
#[cfg(feature = "toml")]
pub fn read_line(message: &str) -> Result<String, Box<Error>> {
pub fn read_line(message: &str) -> Result<String, Box<dyn Error>> {
println!("{}", message);
let mut input = String::new();
+2 -2
View File
@@ -5,11 +5,11 @@ extern crate pretty_env_logger;
extern crate elefren;
mod register;
use register::MastodonClient;
use crate::register::MastodonClient;
use std::error;
#[cfg(feature = "toml")]
fn main() -> Result<(), Box<error::Error>> {
fn main() -> Result<(), Box<dyn error::Error>> {
let mastodon = register::get_mastodon_data()?;
let input = register::read_line("Enter the term you'd like to search: ")?;
let result = mastodon.search(&input, false)?;
+2 -2
View File
@@ -5,11 +5,11 @@ extern crate pretty_env_logger;
extern crate elefren;
mod register;
use register::MastodonClient;
use crate::register::MastodonClient;
use std::error;
#[cfg(feature = "toml")]
fn main() -> Result<(), Box<error::Error>> {
fn main() -> Result<(), Box<dyn error::Error>> {
let mastodon = register::get_mastodon_data()?;
let input = register::read_line("Enter the path to the photo you'd like to post: ")?;