commit c1894900b732bbf79747e0e6e2fc44acbb2af67b Author: Drew Short Date: Tue Mar 3 19:12:07 2020 -0600 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d347bac --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +#IDEA files +.idea/ + +#Added by cargo +/target diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..e7e9d11 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,2 @@ +# Default ignored files +/workspace.xml diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..e002d46 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,123 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "ansi_term" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" +dependencies = [ + "winapi", +] + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi", + "libc", + "winapi", +] + +[[package]] +name = "bitflags" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" + +[[package]] +name = "clap" +version = "2.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" +dependencies = [ + "ansi_term", + "atty", + "bitflags", + "strsim", + "textwrap", + "unicode-width", + "vec_map", +] + +[[package]] +name = "clap-nested" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1ab824df748169c5e36e28f7d6dfe0459d5b3a9bbfe2839df1c606653663d81" +dependencies = [ + "clap", +] + +[[package]] +name = "hermit-abi" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1010591b26bbfe835e9faeabeb11866061cc7dcebffd56ad7d0942d0e61aefd8" +dependencies = [ + "libc", +] + +[[package]] +name = "libc" +version = "0.2.67" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb147597cdf94ed43ab7a9038716637d2d1bf2bc571da995d0028dec06bd3018" + +[[package]] +name = "strsim" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" + +[[package]] +name = "textwrap" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +dependencies = [ + "unicode-width", +] + +[[package]] +name = "unicode-width" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479" + +[[package]] +name = "vec_map" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" + +[[package]] +name = "walkman_tools" +version = "0.1.0" +dependencies = [ + "clap", + "clap-nested", +] + +[[package]] +name = "winapi" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..a4a43f5 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "walkman_tools" +version = "0.1.0" +authors = ["Drew Short "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +clap-nested = "0.3.1" +clap = "2.33.0" diff --git a/src/command/dedupe.rs b/src/command/dedupe.rs new file mode 100644 index 0000000..83f533a --- /dev/null +++ b/src/command/dedupe.rs @@ -0,0 +1,10 @@ +use clap_nested::{Command}; + +pub fn get_command<'a>() -> Command<'a, str>{ + Command::new("dedupe") + .description("dedupe a m3u playlist") + .runner(| args, _matches| { + println!("Running dedupe, logging = {}", args); + Ok(()) + }) +} diff --git a/src/command/mod.rs b/src/command/mod.rs new file mode 100644 index 0000000..da5d458 --- /dev/null +++ b/src/command/mod.rs @@ -0,0 +1 @@ +pub mod dedupe; \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..e69de29 diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..f2abc9c --- /dev/null +++ b/src/main.rs @@ -0,0 +1,33 @@ +use clap::{Arg}; +use clap_nested::{Commander}; + +mod command; + +fn main() { + match Commander::new() + .options(|app| { + app.name("Walkman Tools") + .version("1.0") + .author("Drew Short ") + .about("Management tool for walkman mp3 players") + .arg( + Arg::with_name("verbose") + .short("v") + .long("verbose") + .global(true) + .takes_value(true) + .value_name("VERBOSITY") + .help("Sets the logging verbosity, defaults to \"INFO\""), + ) + }) + .args(|_args, matches| matches.value_of("verbose").unwrap_or("INFO")) + .add_cmd(command::dedupe::get_command()) + .no_cmd(|_args, _matches| { + println!("No subcommand matched"); + Ok(()) + }) + .run() { + Ok(result) => std::process::exit(0), + Err(err) => println!("{}", err) + } +} \ No newline at end of file