File tree Expand file tree Collapse file tree 4 files changed +10
-16
lines changed Expand file tree Collapse file tree 4 files changed +10
-16
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ These defaults require some adoption from existing users but feel more natural t
35
35
### Fixes
36
36
* stash window empty after file history popup closes ([ #1986 ] ( https://github.com/extrawurst/gitui/issues/1986 ) )
37
37
* allow push to empty remote ([ #1919 ] ( https://github.com/extrawurst/gitui/issues/1919 ) )
38
+ * better diagnostics for theme file loading ([ #2007 ] ( https://github.com/extrawurst/gitui/issues/2007 ) )
38
39
39
40
## [ 0.24.3] - 2023-09-09
40
41
Original file line number Diff line number Diff line change @@ -121,7 +121,6 @@ pub fn tag_commit(
121
121
122
122
#[ cfg( test) ]
123
123
mod tests {
124
-
125
124
use crate :: error:: Result ;
126
125
use crate :: sync:: tags:: Tag ;
127
126
use crate :: sync:: RepoPath ;
Original file line number Diff line number Diff line change @@ -48,11 +48,7 @@ pub fn process_cmdline() -> Result<CliArgs> {
48
48
. get_one :: < String > ( "theme" )
49
49
. map_or_else ( || PathBuf :: from ( "theme.ron" ) , PathBuf :: from) ;
50
50
51
- let theme = if get_app_config_path ( ) ?. join ( & arg_theme) . is_file ( ) {
52
- get_app_config_path ( ) ?. join ( arg_theme)
53
- } else {
54
- get_app_config_path ( ) ?. join ( "theme.ron" )
55
- } ;
51
+ let theme = get_app_config_path ( ) ?. join ( arg_theme) ;
56
52
57
53
let notify_watcher: bool =
58
54
* arg_matches. get_one ( "watcher" ) . unwrap_or ( & false ) ;
@@ -82,10 +78,11 @@ fn app() -> ClapApp {
82
78
)
83
79
. arg (
84
80
Arg :: new ( "theme" )
85
- . help ( "Set the color theme (defaults to theme.ron) " )
81
+ . help ( "Set color theme filename loaded from config directory " )
86
82
. short ( 't' )
87
83
. long ( "theme" )
88
- . value_name ( "THEME" )
84
+ . value_name ( "THEME_FILE" )
85
+ . default_value ( "theme.ron" )
89
86
. num_args ( 1 ) ,
90
87
)
91
88
. arg (
Original file line number Diff line number Diff line change @@ -274,13 +274,7 @@ impl Theme {
274
274
fn load_patch ( theme_path : & PathBuf ) -> Result < ThemePatch > {
275
275
let file = File :: open ( theme_path) ?;
276
276
277
- let load_result = ron:: de:: from_reader ( file) ;
278
-
279
- if let Err ( e) = & load_result {
280
- log:: error!( "theme error [{:?}]: {e}" , theme_path) ;
281
- }
282
-
283
- Ok ( load_result?)
277
+ Ok ( ron:: de:: from_reader ( file) ?)
284
278
}
285
279
286
280
fn load_old_theme ( theme_path : & PathBuf ) -> Result < Self > {
@@ -303,7 +297,10 @@ impl Theme {
303
297
pub fn init ( theme_path : & PathBuf ) -> Self {
304
298
let mut theme = Self :: default ( ) ;
305
299
306
- if let Ok ( patch) = Self :: load_patch ( theme_path) {
300
+ if let Ok ( patch) = Self :: load_patch ( theme_path) . map_err ( |e| {
301
+ log:: error!( "theme error [{:?}]: {e}" , theme_path) ;
302
+ e
303
+ } ) {
307
304
theme. apply ( patch) ;
308
305
} else if let Ok ( old_theme) = Self :: load_old_theme ( theme_path)
309
306
{
You can’t perform that action at this time.
0 commit comments