use argparse

png-branch
an 2019-02-12 12:53:25 -05:00
parent fab076be5b
commit 3329fde767
3 changed files with 20 additions and 3 deletions

View File

@ -12,6 +12,7 @@ edition = "2018"
publish = false
[dependencies]
argparse = "0.2"
bitflags = "1.0"
failure = "0.1"
generic-array = "0.12"

View File

@ -1,6 +1,6 @@
use maraiah::{durandal::{bin::*, chunk::*, err::*, image::*, text::*},
marathon::{machdr, map, pict, shp, term, wad}};
use std::{env, fs,
use std::{fs,
io::{self, Write}};
fn write_chunk(cid: &Ident, cnk: &[u8], eid: u16) -> ResultS<()>
@ -101,9 +101,24 @@ fn process_shp(b: &[u8]) -> ResultS<()>
fn main() -> ResultS<()>
{
use argparse::*;
use memmap::Mmap;
for arg in env::args().skip(1) {
let mut args: Vec<String> = Vec::new();
{
let mut ap = ArgumentParser::new();
ap.set_description(env!("CARGO_PKG_DESCRIPTION"));
ap.add_option(&["-v", "--version"],
Print(format!("{} {}",
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_VERSION"))),
"Show the version");
ap.refer(&mut args)
.add_argument("inputs", List, "Input files");
ap.parse_args_or_exit();
}
for arg in &args {
let (typ, fna) = if let Some(st) = arg.find(':') {
arg.split_at(st + 1)
} else {

View File

@ -1,4 +1,5 @@
use crate::{durandal::{bin::*, chunk::*, err::*, fx32::*, text::mac_roman_conv},
use crate::{durandal::{bin::*, chunk::*, err::*, fx32::*,
text::mac_roman_conv},
marathon::xfer::TransferMode};
use bitflags::bitflags;
use std::fmt;