Skip to content

Commit

Permalink
0.12.1: Fix batch jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
DoumanAsh committed Mar 8, 2019
1 parent e4c5a4c commit 8db02d0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fie"
version = "0.12.0"
version = "0.12.1"
authors = ["Douman <[email protected]>"]
repository = "https://github.com/DoumanAsh/fie"
description = "Small and cute social media utility."
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
[![Build status](https://ci.appveyor.com/api/projects/status/oc937oppd38x1y4y/branch/master?svg=true)](https://ci.appveyor.com/project/DoumanAsh/fie/branch/master)
[![Build Status](https://travis-ci.org/DoumanAsh/fie.svg?branch=master)](https://travis-ci.org/DoumanAsh/fie)
[![Crates.io](https://img.shields.io/crates/v/fie.svg)](https://crates.io/crates/fie)
[![Dependency status](https://deps.rs/crate/fie/0.12.0/status.svg)](https://deps.rs/crate/fie)
[![Dependency status](https://deps.rs/crate/fie/0.12.1/status.svg)](https://deps.rs/crate/fie)

Small and cute social media CLI.

![Icon](icon.jpg)

## Download links

* Windows [32bit](https://github.com/DoumanAsh/fie/releases/download/0.12.0/fie-0.12.0-i686-pc-windows-msvc.zip)
* Windows [64bit](https://github.com/DoumanAsh/fie/releases/download/0.12.0/fie-0.12.0-x86_64-pc-windows-msvc.zip)
* Linux [64bit](https://github.com/DoumanAsh/fie/releases/download/0.12.0/fie-0.12.0-x86_64-unknown-linux-gnu.zip)
* OSX [64bit](https://github.com/DoumanAsh/fie/releases/download/0.12.0/fie-0.12.0-x86_64-apple-darwin.zip)
* Windows [32bit](https://github.com/DoumanAsh/fie/releases/download/0.12.1/fie-0.12.1-i686-pc-windows-msvc.zip)
* Windows [64bit](https://github.com/DoumanAsh/fie/releases/download/0.12.1/fie-0.12.1-x86_64-pc-windows-msvc.zip)
* Linux [64bit](https://github.com/DoumanAsh/fie/releases/download/0.12.1/fie-0.12.1-x86_64-unknown-linux-gnu.zip)
* OSX [64bit](https://github.com/DoumanAsh/fie/releases/download/0.12.1/fie-0.12.1-x86_64-apple-darwin.zip)

## Supported social platforms:

Expand Down
11 changes: 9 additions & 2 deletions src/cli/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#![cfg_attr(feature = "cargo-clippy", allow(clippy::style))]

use serde_derive::Deserialize;

mod config;
mod cli;

Expand Down Expand Up @@ -67,7 +69,12 @@ fn handle_post_result(result: fie::api::PostResult) {
handle_inner("Minds", minds);
}

fn open_batch(path: &str) -> io::Result<Vec<fie::data::Post>> {
#[derive(Deserialize, Debug)]
pub struct Batch {
post: Vec<fie::data::Post>,
}

fn open_batch(path: &str) -> io::Result<Batch> {
config::load_from_file(Path::new(path))
}

Expand All @@ -83,7 +90,7 @@ fn run() -> io::Result<()> {
cli::Command::Batch(batch) => {
let api = create_api(config)?;

for (idx, post) in open_batch(&batch.file)?.drain(..).enumerate() {
for (idx, post) in open_batch(&batch.file)?.post.drain(..).enumerate() {
println!(">>>Post #{}:", idx + 1);
match api.send(post) {
Ok(result) => handle_post_result(result),
Expand Down

0 comments on commit 8db02d0

Please sign in to comment.