finish hooking up completion descriptions (#5047)

This commit is contained in:
Darren Schroeder 2022-03-31 11:13:16 -05:00 committed by GitHub
parent d89ad4fafd
commit 05f7d7d38b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -257,6 +257,7 @@ impl NuCompleter {
let mut output = vec![];
for named in &sig.named {
let flag_desc = &named.desc;
if let Some(short) = named.short {
let mut named = vec![0; short.len_utf8()];
short.encode_utf8(&mut named);
@ -264,7 +265,7 @@ impl NuCompleter {
if named.starts_with(&prefix) {
output.push(Suggestion {
value: String::from_utf8_lossy(&named).to_string(),
description: None,
description: Some(flag_desc.to_string()),
span: reedline::Span {
start: new_span.start - offset,
end: new_span.end - offset,
@ -283,7 +284,7 @@ impl NuCompleter {
if named.starts_with(&prefix) {
output.push(Suggestion {
value: String::from_utf8_lossy(&named).to_string(),
description: None,
description: Some(flag_desc.to_string()),
span: reedline::Span {
start: new_span.start - offset,
end: new_span.end - offset,