.wrap_err(eyre!("`--threads` expects a non-negative number"))
.with_suggestion(suggestion_intended_arg.clone())
.with_section(move||max.header("Parameter given was"))?);
},
"-M"=>cfg.max_tasks=None,// this is the default, but it is possible an earlier command mutated it, so doing nothing here would be a bug for that corner case
/// Convert into a mode change if this is a mode change
// We consume the whole output here in case the mode change needs to traverse it for information. As of now, we have only one non-`Normal` mode: `Help`, which doesn't require any extra information.
/// Stop parsing arguments, add the rest of args as `Input`s
/// Stop parsing arguments, add the rest of args as `Input`s
No,
No,
/// On mode change, we don't need to parse the rest of the argument. Stop reading entirely.
/// On mode change, we don't need to parse the rest of the argument. Stop reading entirely, and optionally return the last one here, which must be a mode change argument.
Abort,
///
/// Returning this when the contained value is `Some` immediately terminates parsing and precedes to mode-switch. However, if it is `None`, parsing of chained short args is allowed to continue, although `Abort(None)` will be returned at the end regardless of subsequent `Continue` results from that change (unless one is an `Abort(Some(_))`, which immediately returns itself.)
// Box `Argument` to reduce the size of `Continue`, as it is returned from functions often and when its value is set to `Some` it will always be the last `Argument` processed anyway and the only one to be boxed here at all.
Abort(Option<Box<Argument>>),
}
}
implContinue
implContinue
@ -234,6 +247,16 @@ impl Continue
false
false
}
}
}
}
/// Is this an abort?
#[inline]pubfnis_abort(&self)-> bool
{
ifletSelf::Abort(_)=self{
true
}else{
false
}
}
}
}
implDefaultforContinue
implDefaultforContinue
@ -305,6 +328,13 @@ where I: Iterator<Item=String>