mirror of
https://github.com/nushell/nushell
synced 2025-01-14 22:24:54 +00:00
finish hooking up completion descriptions (#5047)
This commit is contained in:
parent
d89ad4fafd
commit
05f7d7d38b
1 changed files with 3 additions and 2 deletions
|
@ -257,6 +257,7 @@ impl NuCompleter {
|
||||||
let mut output = vec![];
|
let mut output = vec![];
|
||||||
|
|
||||||
for named in &sig.named {
|
for named in &sig.named {
|
||||||
|
let flag_desc = &named.desc;
|
||||||
if let Some(short) = named.short {
|
if let Some(short) = named.short {
|
||||||
let mut named = vec![0; short.len_utf8()];
|
let mut named = vec![0; short.len_utf8()];
|
||||||
short.encode_utf8(&mut named);
|
short.encode_utf8(&mut named);
|
||||||
|
@ -264,7 +265,7 @@ impl NuCompleter {
|
||||||
if named.starts_with(&prefix) {
|
if named.starts_with(&prefix) {
|
||||||
output.push(Suggestion {
|
output.push(Suggestion {
|
||||||
value: String::from_utf8_lossy(&named).to_string(),
|
value: String::from_utf8_lossy(&named).to_string(),
|
||||||
description: None,
|
description: Some(flag_desc.to_string()),
|
||||||
span: reedline::Span {
|
span: reedline::Span {
|
||||||
start: new_span.start - offset,
|
start: new_span.start - offset,
|
||||||
end: new_span.end - offset,
|
end: new_span.end - offset,
|
||||||
|
@ -283,7 +284,7 @@ impl NuCompleter {
|
||||||
if named.starts_with(&prefix) {
|
if named.starts_with(&prefix) {
|
||||||
output.push(Suggestion {
|
output.push(Suggestion {
|
||||||
value: String::from_utf8_lossy(&named).to_string(),
|
value: String::from_utf8_lossy(&named).to_string(),
|
||||||
description: None,
|
description: Some(flag_desc.to_string()),
|
||||||
span: reedline::Span {
|
span: reedline::Span {
|
||||||
start: new_span.start - offset,
|
start: new_span.start - offset,
|
||||||
end: new_span.end - offset,
|
end: new_span.end - offset,
|
||||||
|
|
Loading…
Reference in a new issue