exporter: Switch to clap 3.0
This commit is contained in:
parent
1a267cfa85
commit
f195d254ec
|
@ -721,6 +721,7 @@ dependencies = [
|
||||||
name = "exporter"
|
name = "exporter"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"clap 3.0.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"futures 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"futures 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"image 0.23.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"image 0.23.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -730,7 +731,6 @@ dependencies = [
|
||||||
"ruffle_core 0.1.0",
|
"ruffle_core 0.1.0",
|
||||||
"ruffle_render_wgpu 0.1.0",
|
"ruffle_render_wgpu 0.1.0",
|
||||||
"sample 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"sample 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"structopt 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"wgpu 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"wgpu 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"wgpu-native 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"wgpu-native 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
|
@ -6,13 +6,13 @@ edition = "2018"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
clap = "3.0.0-beta.1"
|
||||||
ruffle_core = { path = "../core" }
|
ruffle_core = { path = "../core" }
|
||||||
ruffle_render_wgpu = { path = "../render/wgpu" }
|
ruffle_render_wgpu = { path = "../render/wgpu" }
|
||||||
env_logger = "0.7.1"
|
env_logger = "0.7.1"
|
||||||
image = "0.23.8"
|
image = "0.23.8"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
sample = "0.11.0"
|
sample = "0.11.0"
|
||||||
structopt = "0.3.15"
|
|
||||||
futures = "0.3.4"
|
futures = "0.3.4"
|
||||||
wgpu = "0.5"
|
wgpu = "0.5"
|
||||||
wgpu-native = "0.5"
|
wgpu-native = "0.5"
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
use clap::Clap;
|
||||||
use futures::executor::block_on;
|
use futures::executor::block_on;
|
||||||
use image::RgbaImage;
|
use image::RgbaImage;
|
||||||
use indicatif::{ProgressBar, ProgressStyle};
|
use indicatif::{ProgressBar, ProgressStyle};
|
||||||
|
@ -14,28 +15,28 @@ use std::fs::create_dir_all;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use structopt::StructOpt;
|
|
||||||
use walkdir::{DirEntry, WalkDir};
|
use walkdir::{DirEntry, WalkDir};
|
||||||
|
|
||||||
#[derive(StructOpt, Debug, Copy, Clone)]
|
#[derive(Clap, Debug, Copy, Clone)]
|
||||||
struct SizeOpt {
|
struct SizeOpt {
|
||||||
/// The amount to scale the page size with
|
/// The amount to scale the page size with
|
||||||
#[structopt(long = "scale", default_value = "1.0")]
|
#[clap(long = "scale", default_value = "1.0")]
|
||||||
scale: f32,
|
scale: f32,
|
||||||
|
|
||||||
/// Optionaly override the output width
|
/// Optionaly override the output width
|
||||||
#[structopt(long = "width")]
|
#[clap(long = "width")]
|
||||||
width: Option<u32>,
|
width: Option<u32>,
|
||||||
|
|
||||||
/// Optionaly override the output height
|
/// Optionaly override the output height
|
||||||
#[structopt(long = "height")]
|
#[clap(long = "height")]
|
||||||
height: Option<u32>,
|
height: Option<u32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(StructOpt, Debug)]
|
#[derive(Clap, Debug)]
|
||||||
|
#[clap(name = "Ruffle Exporter", author, version)]
|
||||||
struct Opt {
|
struct Opt {
|
||||||
/// The file or directory of files to export frames from
|
/// The file or directory of files to export frames from
|
||||||
#[structopt(name = "swf", parse(from_os_str))]
|
#[clap(name = "swf", parse(from_os_str))]
|
||||||
swf: PathBuf,
|
swf: PathBuf,
|
||||||
|
|
||||||
/// The file or directory (if multiple frames/files) to store the capture in.
|
/// The file or directory (if multiple frames/files) to store the capture in.
|
||||||
|
@ -43,22 +44,22 @@ struct Opt {
|
||||||
/// - If given one swf and one frame, the name of the swf + ".png"
|
/// - If given one swf and one frame, the name of the swf + ".png"
|
||||||
/// - If given one swf and multiple frames, the name of the swf as a directory
|
/// - If given one swf and multiple frames, the name of the swf as a directory
|
||||||
/// - If given multiple swfs, this field is required.
|
/// - If given multiple swfs, this field is required.
|
||||||
#[structopt(name = "output", parse(from_os_str))]
|
#[clap(name = "output", parse(from_os_str))]
|
||||||
output_path: Option<PathBuf>,
|
output_path: Option<PathBuf>,
|
||||||
|
|
||||||
/// Number of frames to capture per file
|
/// Number of frames to capture per file
|
||||||
#[structopt(short = "f", long = "frames", default_value = "1")]
|
#[clap(short = "f", long = "frames", default_value = "1")]
|
||||||
frames: u32,
|
frames: u32,
|
||||||
|
|
||||||
/// Number of frames to skip
|
/// Number of frames to skip
|
||||||
#[structopt(long = "skipframes", default_value = "0")]
|
#[clap(long = "skipframes", default_value = "0")]
|
||||||
skipframes: u32,
|
skipframes: u32,
|
||||||
|
|
||||||
/// Don't show a progress bar
|
/// Don't show a progress bar
|
||||||
#[structopt(short, long)]
|
#[clap(short, long)]
|
||||||
silent: bool,
|
silent: bool,
|
||||||
|
|
||||||
#[structopt(flatten)]
|
#[clap(flatten)]
|
||||||
size: SizeOpt,
|
size: SizeOpt,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -330,7 +331,7 @@ fn capture_multiple_swfs(
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() -> Result<(), Box<dyn Error>> {
|
fn main() -> Result<(), Box<dyn Error>> {
|
||||||
let opt: Opt = Opt::from_args();
|
let opt: Opt = Opt::parse();
|
||||||
let adapter = block_on(wgpu::Adapter::request(
|
let adapter = block_on(wgpu::Adapter::request(
|
||||||
&wgpu::RequestAdapterOptions {
|
&wgpu::RequestAdapterOptions {
|
||||||
power_preference: wgpu::PowerPreference::Default,
|
power_preference: wgpu::PowerPreference::Default,
|
||||||
|
|
Loading…
Reference in New Issue