File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -143,11 +143,6 @@ pub async fn handle_args(args: impl Iterator<Item = OsString>) -> Result<()> {
143143 . filter ( |p| p. exists ( ) )
144144 . and_then ( |p| theme:: load ( & p) . ok ( ) )
145145 . unwrap_or_default ( ) ;
146- tracing:: warn!(
147- "{:?}" ,
148- dirs:: config_dir( ) . map( |dir| dir. join( "gitbutler" ) . join( "but-theme.json" ) )
149- ) ;
150- tracing:: warn!( "{:?}" , theme) ;
151146 theme:: init ( theme) ;
152147 }
153148
Original file line number Diff line number Diff line change 11//! A global, serializable color theme for CLI output.
22//!
33//! Styled output *must* begin from one of the global theme's styles. Using [`colored`] or [`Style`]
4- //! indepentently of this theme is prohibited, as that breaks user-defined theming.
4+ //! independently of this theme is prohibited, as that breaks user-defined theming.
55//!
66//! The theme controls the styling of semantic elements (branch names, commit IDs, file statuses,
77//! etc.) for human-readable output modes. It can be loaded from a JSON file so users can customize
1212//! Call [`init`] exactly once before any output is produced (typically in [`crate::handle_args`]).
1313//! After that, [`get`] returns a `&'static Theme`.
1414//!
15- //! Note that unit tests **do not need to initialize ** the theme as we always return the hard-coded
16- //! default for tests .
15+ //! Note that unit tests **do not need to initializes ** the theme as they will automatically fall
16+ //! back on the default if not initialized .
1717//!
1818//!
1919//! # Serialization
@@ -52,12 +52,7 @@ pub fn init(theme: Theme) {
5252pub fn get ( ) -> & ' static Theme {
5353 #[ cfg( test) ]
5454 {
55- let theme = THEME . get ( ) ;
56- if let Some ( theme) = theme {
57- return theme;
58- }
59- let _ = THEME . set ( Theme :: default ( ) ) ;
60- get ( )
55+ THEME . get_or_init ( Theme :: default)
6156 }
6257 #[ cfg( not( test) ) ]
6358 {
You can’t perform that action at this time.
0 commit comments