Commit c191d8c2 authored by matu3ba's avatar matu3ba
Browse files

fix(CLI): delete structopt due to no advantage(conflict resolution)

parent f05b74e7
......@@ -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"
......
......@@ -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"
......
......@@ -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.
......
......@@ -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;
......
......@@ -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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment