diff --git a/Cargo.lock b/Cargo.lock index b4ca6a00460c5bea8e8b4cbaab699786d57cbc89..ad5fe13cb3c208e63b77acf3745afa824a060806 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -813,15 +813,6 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d36fab90f82edc3c747f9d438e06cf0a491055896f2a279638bb5beed6c40177" -[[package]] -name = "heck" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" -dependencies = [ - "unicode-segmentation", -] - [[package]] name = "hermit-abi" version = "0.1.15" @@ -904,7 +895,6 @@ dependencies = [ "serial_test_derive", "small", "smallvec 1.4.2", - "structopt", "types-rs", "unicode-segmentation", "users", @@ -2154,30 +2144,6 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c" -[[package]] -name = "structopt" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6cc388d94ffabf39b5ed5fadddc40147cb21e605f53db6f8f36a625d27489ac5" -dependencies = [ - "clap", - "lazy_static", - "structopt-derive", -] - -[[package]] -name = "structopt-derive" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e2513111825077552a6751dfad9e11ce0fba07d7276a3943a037d7e93e64c5f" -dependencies = [ - "heck", - "proc-macro-error", - "proc-macro2 1.0.21", - "quote 1.0.7", - "syn 1.0.40", -] - [[package]] name = "syn" version = "0.15.44" diff --git a/Cargo.toml b/Cargo.toml index 64476c427f2ba0b6e75af237dfb76f7ac4f41385..a41ead01077231f11a53b5e97fe924241ada6d17 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,6 @@ gitlab = { repository = "https://gitlab.redox-os.org/redox-os/ion", branch = "ma maintenance = { status = "experimental" } [features] -advanced_arg_parsing = [] man = ["builtins-proc/man"] piston = ["piston-ai_behavior", "piston_window", "piston2d-sprite"] unicode = ["regex/unicode"] @@ -75,7 +74,6 @@ itertools = "0.9" lexical = "5.2" object-pool = "0.5" auto_enums = "0.7" -structopt = "0.3" atty = "0.2" permutate = "0.3" xdg = "2.2" diff --git a/src/binary/mod.rs b/src/binary/mod.rs index 89e10a320f381330ef4ec7842519c584fb6222cb..63d41682ff7b30c4cfdcbf91bbe8995c6cf2e3ad 100644 --- a/src/binary/mod.rs +++ b/src/binary/mod.rs @@ -26,7 +26,6 @@ use std::{ }; use xdg::BaseDirectories; -#[cfg(not(feature = "advanced_arg_parsing"))] pub const MAN_ION: &str = r#"ion 1.0.0-alpha The fast, safe, modern rust shell. Ion is a commandline shell created to be a faster and easier to use alternative to the currently available shells. It is not POSIX compliant. diff --git a/src/main.rs b/src/main.rs index c44abbe91f7e23d846ab8de6a196a349c0de139f..6ed108e3fbf0d70bb087e83b197de94a33509c30 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,74 +13,39 @@ use std::{ sync::Arc, }; -#[cfg(not(feature = "advanced_arg_parsing"))] use crate::binary::MAN_ION; -#[cfg(not(feature = "advanced_arg_parsing"))] use std::env; -#[cfg(feature = "advanced_arg_parsing")] -use std::str::FromStr; -#[cfg(feature = "advanced_arg_parsing")] -use structopt::StructOpt; mod binary; struct KeyBindingsWrapper(KeyBindings); -#[cfg(feature = "advanced_arg_parsing")] -impl FromStr for KeyBindingsWrapper { - type Err = String; - - fn from_str(input: &str) -> Result<Self, Self::Err> { - match input { - "vi" => Ok(KeyBindingsWrapper(KeyBindings::Vi)), - "emacs" => Ok(KeyBindingsWrapper(KeyBindings::Emacs)), - _ => Err("unknown key bindings".to_string()), - } - } -} /// The fast, safe, modern rust shell. /// Ion is a commandline shell created to be a faster and easier to use /// alternative to the currently available shells. It is not POSIX compliant. -#[cfg_attr(feature = "advanced_arg_parsing", derive(StructOpt))] -#[cfg_attr(feature = "advanced_arg_parsing", structopt(name = "ion"))] struct CommandLineArgs { /// Shortcut layout. Valid options: "vi", "emacs" - #[cfg_attr(feature = "advanced_arg_parsing", structopt(short = "-o"))] key_bindings: Option<KeyBindingsWrapper>, /// Print commands before execution - #[cfg_attr(feature = "advanced_arg_parsing", structopt(short = "-x"))] print_commands: bool, /// Use a fake interactive mode, where errors don't exit the shell - #[cfg_attr( - feature = "advanced_arg_parsing", - structopt(short = "-f", long = "--fake-interactive") - )] fake_interactive: bool, /// Force interactive mode - #[cfg_attr(feature = "advanced_arg_parsing", structopt(short = "-i", long = "--interactive"))] interactive: bool, /// Do not execute any commands, perform only syntax checking - #[cfg_attr(feature = "advanced_arg_parsing", structopt(short = "-n", long = "--no-execute"))] no_execute: bool, /// Evaluate given commands instead of reading from the commandline - #[cfg_attr(feature = "advanced_arg_parsing", structopt(short = "-c"))] command: Option<String>, /// Print the version, platform and revision of Ion then exit - #[cfg_attr(feature = "advanced_arg_parsing", structopt(short = "-v", long = "--version"))] version: bool, /// Script arguments (@args). If the -c option is not specified, /// the first parameter is taken as a filename to execute - #[cfg_attr(feature = "advanced_arg_parsing", structopt())] args: Vec<String>, } fn version() -> String { include!(concat!(env!("OUT_DIR"), "/version_string")).to_string() } -#[cfg(feature = "advanced_arg_parsing")] -fn parse_args() -> CommandLineArgs { CommandLineArgs::from_args() } - -#[cfg(not(feature = "advanced_arg_parsing"))] fn parse_args() -> CommandLineArgs { let mut args = env::args().skip(1); let mut command = None; diff --git a/tests/run_examples.sh b/tests/run_examples.sh index 0be04ecc099ba97d67d39859c385b8505b2f3b73..d590e909386c2cfe842459fe053dcd37f872ec1a 100755 --- a/tests/run_examples.sh +++ b/tests/run_examples.sh @@ -66,9 +66,3 @@ test_generic test_params set +u - -if [ -n "$FULL" ]; then - # Build debug binary for testing structopt argument parsing - cargo +$TOOLCHAIN build --features=advanced_arg_parsing - test_params -fi