mirror of
https://github.com/Noratrieb/badargs.git
synced 2026-01-14 19:55:08 +01:00
making optionality a bool
This commit is contained in:
parent
346c8835cd
commit
a33b81c58e
5 changed files with 47 additions and 34 deletions
11
src/parse.rs
11
src/parse.rs
|
|
@ -1,5 +1,5 @@
|
|||
use crate::error::CallError;
|
||||
use crate::schema::{Schema, SchemaKind, SchemaKindType};
|
||||
use crate::schema::{Schema, SchemaKind};
|
||||
use std::any::Any;
|
||||
use std::collections::HashMap;
|
||||
use std::iter::Peekable;
|
||||
|
|
@ -60,13 +60,8 @@ fn parse_shorts(
|
|||
.short(flag)
|
||||
.ok_or_else(|| CallError::ShortFlagNotFound(flag))?;
|
||||
|
||||
let inner_kind = match command.kind {
|
||||
SchemaKind::Required(inner) => inner,
|
||||
SchemaKind::Optional(inner) => inner,
|
||||
};
|
||||
|
||||
match inner_kind {
|
||||
SchemaKindType::String => {
|
||||
match command.kind {
|
||||
SchemaKind::String => {
|
||||
let next = args
|
||||
.next()
|
||||
.ok_or_else(|| CallError::ExpectedValue(command.long.to_string()))?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue