File tree Expand file tree Collapse file tree 1 file changed +11
-22
lines changed Expand file tree Collapse file tree 1 file changed +11
-22
lines changed Original file line number Diff line number Diff line change 1- use anyhow:: { anyhow , Result } ;
1+ use anyhow:: Result ;
22use crossterm:: event:: { KeyCode , KeyModifiers } ;
33use std:: { fs:: canonicalize, path:: PathBuf , rc:: Rc } ;
44
@@ -38,27 +38,16 @@ impl KeyConfig {
3838 key_bindings_path : Option < & PathBuf > ,
3939 key_symbols_path : Option < & PathBuf > ,
4040 ) -> Result < Self > {
41- let keys = if let Some ( path) = key_bindings_path {
42- if !path. exists ( ) {
43- return Err ( anyhow ! (
44- "The custom key bindings file dosen't exists"
45- ) ) ;
46- }
47- KeysList :: init ( path. clone ( ) )
48- } else {
49- KeysList :: init ( Self :: get_config_file ( ) ?)
50- } ;
51-
52- let symbols = if let Some ( path) = key_symbols_path {
53- if !path. exists ( ) {
54- return Err ( anyhow ! (
55- "The custom key symbols file dosen't exists"
56- ) ) ;
57- }
58- KeySymbols :: init ( path. clone ( ) )
59- } else {
60- KeySymbols :: init ( Self :: get_symbols_file ( ) ?)
61- } ;
41+ let keys = KeysList :: init (
42+ key_bindings_path
43+ . unwrap_or ( & Self :: get_config_file ( ) ?)
44+ . clone ( ) ,
45+ ) ;
46+ let symbols = KeySymbols :: init (
47+ key_symbols_path
48+ . unwrap_or ( & Self :: get_symbols_file ( ) ?)
49+ . clone ( ) ,
50+ ) ;
6251
6352 Ok ( Self { keys, symbols } )
6453 }
You can’t perform that action at this time.
0 commit comments