forked from MightyPork/elefren-fork
Update to the 2018 edition
Only 2 years later :eyeroll:
This commit is contained in:
@@ -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())?;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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()?;
|
||||
|
||||
|
||||
@@ -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()?;
|
||||
|
||||
|
||||
@@ -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
@@ -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)?;
|
||||
|
||||
@@ -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: ")?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user