Simply no argument parsing
This commit is contained in:
parent
9932a98c6f
commit
eb09f9a5d1
1 changed files with 12 additions and 32 deletions
|
@ -128,46 +128,26 @@ pub fn command(s: &str) -> Result<Command, cli::Error> {
|
||||||
}
|
}
|
||||||
Ok(Command::Open(args[0].clone()))
|
Ok(Command::Open(args[0].clone()))
|
||||||
});
|
});
|
||||||
|
|
||||||
let no_arg_parser = || arguments()
|
|
||||||
.skip(spaces())
|
|
||||||
.skip(eof());
|
|
||||||
|
|
||||||
let close_parser = string(CLOSE_COMMAND)
|
let close_parser = string(CLOSE_COMMAND)
|
||||||
.with(no_arg_parser())
|
.skip(spaces())
|
||||||
.map(|args| {
|
.skip(eof())
|
||||||
if !args.is_empty() {
|
.map(|_| Ok(Command::Close) );
|
||||||
bail!(cli::ErrorKind::CommandParse(format!("Unrecognized argument {:?}", args[0])) );
|
|
||||||
}
|
|
||||||
Ok(Command::Close)
|
|
||||||
});
|
|
||||||
|
|
||||||
let schema_parser = string(SCHEMA_COMMAND)
|
let schema_parser = string(SCHEMA_COMMAND)
|
||||||
.with(no_arg_parser())
|
.skip(spaces())
|
||||||
.map(|args| {
|
.skip(eof())
|
||||||
if !args.is_empty() {
|
.map(|_| Ok(Command::Schema));
|
||||||
bail!(cli::ErrorKind::CommandParse(format!("Unrecognized argument {:?}", args[0])) );
|
|
||||||
}
|
|
||||||
Ok(Command::Schema)
|
|
||||||
});
|
|
||||||
|
|
||||||
let attributes_parser = string(ATTRIBUTES_COMMAND)
|
let attributes_parser = string(ATTRIBUTES_COMMAND)
|
||||||
.with(no_arg_parser())
|
.skip(spaces())
|
||||||
.map(|args| {
|
.skip(eof())
|
||||||
if !args.is_empty() {
|
.map(|_| Ok(Command::Attributes));
|
||||||
bail!(cli::ErrorKind::CommandParse(format!("Unrecognized argument {:?}", args[0])) );
|
|
||||||
}
|
|
||||||
Ok(Command::Attributes)
|
|
||||||
});
|
|
||||||
|
|
||||||
let exit_parser = try(string(LONG_EXIT_COMMAND)).or(try(string(SHORT_EXIT_COMMAND)))
|
let exit_parser = try(string(LONG_EXIT_COMMAND)).or(try(string(SHORT_EXIT_COMMAND)))
|
||||||
.with(no_arg_parser())
|
.skip(spaces())
|
||||||
.map(|args| {
|
.skip(eof())
|
||||||
if !args.is_empty() {
|
.map(|_| Ok(Command::Exit) );
|
||||||
bail!(cli::ErrorKind::CommandParse(format!("Unrecognized argument {:?}", args[0])) );
|
|
||||||
}
|
|
||||||
Ok(Command::Exit)
|
|
||||||
});
|
|
||||||
|
|
||||||
let edn_arg_parser = || spaces()
|
let edn_arg_parser = || spaces()
|
||||||
.with(look_ahead(string("[").or(string("{")))
|
.with(look_ahead(string("[").or(string("{")))
|
||||||
|
|
Loading…
Reference in a new issue