mirror of
https://github.com/nushell/nushell
synced 2024-12-26 13:03:07 +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> {
|
||||
let values = match entry_type {
|
||||
"modifiers" => get_reedline_keybinding_modifiers(),
|
||||
"keycodes" => get_reedline_keycodes(),
|
||||
"edits" => get_reedline_edit_commands(),
|
||||
"modes" => get_reedline_prompt_edit_modes(),
|
||||
"events" => get_reedline_reedline_events(),
|
||||
"modifiers" => get_reedline_keybinding_modifiers().sorted(),
|
||||
"keycodes" => get_reedline_keycodes().sorted(),
|
||||
"edits" => get_reedline_edit_commands().sorted(),
|
||||
"modes" => get_reedline_prompt_edit_modes().sorted(),
|
||||
"events" => get_reedline_reedline_events().sorted(),
|
||||
_ => Vec::new(),
|
||||
};
|
||||
|
||||
|
@ -112,3 +112,18 @@ fn convert_to_record(edit: &str, entry_type: &str, span: &Span) -> Value {
|
|||
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