mirror of
https://github.com/nushell/nushell.git
synced 2025-05-19 01:10:48 +02:00
update SyntaxShape::OneOf Display impl
This commit is contained in:
parent
70dc4a3006
commit
6dfb7912f5
@ -250,9 +250,14 @@ impl Display for SyntaxShape {
|
||||
SyntaxShape::Error => write!(f, "error"),
|
||||
SyntaxShape::CompleterWrapper(x, _) => write!(f, "completable<{x}>"),
|
||||
SyntaxShape::OneOf(list) => {
|
||||
let arg_vec: Vec<_> = list.iter().map(|x| x.to_string()).collect();
|
||||
let arg_string = arg_vec.join(", ");
|
||||
write!(f, "one_of({arg_string})")
|
||||
write!(f, "(")?;
|
||||
if let Some((last, rest)) = list.split_last() {
|
||||
for ty in rest {
|
||||
write!(f, "{ty} | ")?;
|
||||
}
|
||||
write!(f, "{last}")?;
|
||||
}
|
||||
write!(f, ")")
|
||||
}
|
||||
SyntaxShape::Nothing => write!(f, "nothing"),
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user