mirror of
https://github.com/shimunn/aria2xspf.git
synced 2023-11-17 09:27:54 +01:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
5ef68507b8
|
|||
| f2972cc688 | |||
| 8a1b718709 | |||
|
|
35b01ba152 |
54
.drone.yml
Normal file
54
.drone.yml
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
kind: pipeline
|
||||||
|
name: default
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: test
|
||||||
|
image: rust:1.35.0
|
||||||
|
environment:
|
||||||
|
CARGO_HOME: /drone/.cargo
|
||||||
|
commands:
|
||||||
|
- cargo test
|
||||||
|
- name: fmt
|
||||||
|
image: rust:1.35.0
|
||||||
|
environment:
|
||||||
|
CARGO_HOME: /drone/.cargo
|
||||||
|
commands:
|
||||||
|
- rustup component add rustfmt
|
||||||
|
- cargo fmt -- --check
|
||||||
|
- name: clippy
|
||||||
|
image: rust:1.35.0
|
||||||
|
environment:
|
||||||
|
CARGO_HOME: /drone/.cargo
|
||||||
|
commands:
|
||||||
|
- rustup component add clippy
|
||||||
|
- cargo clippy
|
||||||
|
- name: build_relase
|
||||||
|
image: rust:1.35.0
|
||||||
|
environment:
|
||||||
|
CARGO_HOME: /drone/.cargo
|
||||||
|
commands:
|
||||||
|
- mkdir bin
|
||||||
|
- export CARGO_INSTALL_ROOT=$PWD
|
||||||
|
- rustup target add x86_64-unknown-linux-musl
|
||||||
|
- cargo install --path . --target x86_64-unknown-linux-musl
|
||||||
|
- mkdir dist
|
||||||
|
- tar cvzf binary.tar.gz bin/*
|
||||||
|
when:
|
||||||
|
event:
|
||||||
|
- tag
|
||||||
|
- name: gitea_release
|
||||||
|
image: plugins/gitea-release
|
||||||
|
settings:
|
||||||
|
api_key:
|
||||||
|
from_secret: gitea_tkn
|
||||||
|
base_url:
|
||||||
|
from_secret: gitea_url
|
||||||
|
files:
|
||||||
|
- binary.tar.gz
|
||||||
|
checksum:
|
||||||
|
- md5
|
||||||
|
- sha512
|
||||||
|
when:
|
||||||
|
event:
|
||||||
|
- tag
|
||||||
|
|
||||||
14
src/main.rs
14
src/main.rs
@@ -11,13 +11,13 @@ mod conf;
|
|||||||
mod opts;
|
mod opts;
|
||||||
|
|
||||||
use conf::*;
|
use conf::*;
|
||||||
|
use dirs;
|
||||||
use opts::*;
|
use opts::*;
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::{self, Read, Write};
|
use std::io::{self, Read, Stdin, Write};
|
||||||
use std::io::{BufRead, BufReader};
|
use std::io::{BufRead, BufReader};
|
||||||
|
use std::process::exit;
|
||||||
use dirs;
|
|
||||||
use xml::writer::{EmitterConfig, EventWriter, Result as XResult, XmlEvent};
|
use xml::writer::{EmitterConfig, EventWriter, Result as XResult, XmlEvent};
|
||||||
|
|
||||||
#[derive(Builder, Debug)]
|
#[derive(Builder, Debug)]
|
||||||
@@ -82,6 +82,14 @@ fn config() -> Option<Config> {
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let opts = Opts::from_args();
|
let opts = Opts::from_args();
|
||||||
|
if opts.input == opts.output {
|
||||||
|
eprintln!("Input and output are the same file! {:?}\nContinue(y/n): ", opts.input);
|
||||||
|
match io::stdin().bytes().next() {
|
||||||
|
Some(Ok(r)) if r as char == 'y' => (),
|
||||||
|
Some(Ok(_)) => exit(1),
|
||||||
|
_ => (), //Stdin closed, assume in == out is intentional
|
||||||
|
}
|
||||||
|
}
|
||||||
let file = File::open(opts.input).expect("Failed to open file!");
|
let file = File::open(opts.input).expect("Failed to open file!");
|
||||||
let mut out = File::create(opts.output).expect("Failed to open OUTPUT file!");
|
let mut out = File::create(opts.output).expect("Failed to open OUTPUT file!");
|
||||||
let mut writer = EmitterConfig::new().perform_indent(true).create_writer(&mut out);
|
let mut writer = EmitterConfig::new().perform_indent(true).create_writer(&mut out);
|
||||||
|
|||||||
Reference in New Issue
Block a user