Add basic command arguments documentation

This commit is contained in:
2025-08-10 23:24:27 -03:00
parent b96474d0fb
commit 689bde0acc
2 changed files with 96 additions and 3 deletions
+32
View File
@@ -96,6 +96,38 @@ impl FromArguments for NeedyString {
}
}
pub struct NeedyGreedyString(pub String);
impl Deref for NeedyGreedyString {
type Target = String;
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl DerefMut for NeedyGreedyString {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl fmt::Display for NeedyGreedyString {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.0.fmt(f)
}
}
impl FromArguments for NeedyGreedyString {
fn from_args(args: &str) -> Result<(Self, &str), ArgumentParsingError> {
if !args.is_empty() {
Ok((Self(args.to_string()), ""))
} else {
Err(ArgumentParsingError::MissingArgument)
}
}
}
impl FromArguments for bool {
fn from_args(args: &str) -> Result<(Self, &str), ArgumentParsingError> {
let arg: &str;