mirror of
https://github.com/nushell/nushell
synced 2024-12-27 05:23:11 +00:00
parent
abaeffab91
commit
709927cee4
1 changed files with 20 additions and 5 deletions
|
@ -80,11 +80,11 @@ impl Command for ListKeybindings {
|
||||||
|
|
||||||
fn get_records(entry_type: &str, span: &Span) -> Vec<Value> {
|
fn get_records(entry_type: &str, span: &Span) -> Vec<Value> {
|
||||||
let values = match entry_type {
|
let values = match entry_type {
|
||||||
"modifiers" => get_reedline_keybinding_modifiers(),
|
"modifiers" => get_reedline_keybinding_modifiers().sorted(),
|
||||||
"keycodes" => get_reedline_keycodes(),
|
"keycodes" => get_reedline_keycodes().sorted(),
|
||||||
"edits" => get_reedline_edit_commands(),
|
"edits" => get_reedline_edit_commands().sorted(),
|
||||||
"modes" => get_reedline_prompt_edit_modes(),
|
"modes" => get_reedline_prompt_edit_modes().sorted(),
|
||||||
"events" => get_reedline_reedline_events(),
|
"events" => get_reedline_reedline_events().sorted(),
|
||||||
_ => Vec::new(),
|
_ => Vec::new(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -112,3 +112,18 @@ fn convert_to_record(edit: &str, entry_type: &str, span: &Span) -> Value {
|
||||||
span: *span,
|
span: *span,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Helper to sort a vec and return a vec
|
||||||
|
trait SortedImpl {
|
||||||
|
fn sorted(self) -> Self;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<E> SortedImpl for Vec<E>
|
||||||
|
where
|
||||||
|
E: std::cmp::Ord,
|
||||||
|
{
|
||||||
|
fn sorted(mut self) -> Self {
|
||||||
|
self.sort();
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue