Commit bc9e44f 1 parent e5d37e0 commit bc9e44f Copy full SHA for bc9e44f
File tree 3 files changed +7
-4
lines changed
3 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -77,14 +77,14 @@ impl<'a> Context<'a> {
77
77
Module :: new ( name, config)
78
78
}
79
79
80
- /// Check the `disabled` configuration of the module
81
- pub fn is_module_enabled ( & self , name : & str ) -> bool {
80
+ /// Check if `disabled` option of the module is true in configuration file.
81
+ pub fn is_module_disabled_in_config ( & self , name : & str ) -> bool {
82
82
let config = self . config . get_module_config ( name) ;
83
83
84
84
// If the segment has "disabled" set to "true", don't show it
85
85
let disabled = config. and_then ( |table| table. as_table ( ) ?. get ( "disabled" ) ?. as_bool ( ) ) ;
86
86
87
- disabled ! = Some ( true )
87
+ disabled = = Some ( true )
88
88
}
89
89
90
90
// returns a new ScanDir struct with reference to current dir_files of context
Original file line number Diff line number Diff line change @@ -53,6 +53,9 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
53
53
54
54
let mut module = context. new_module ( "kubernetes" ) ;
55
55
let config: KubernetesConfig = KubernetesConfig :: try_load ( module. config ) ;
56
+ if config. disabled {
57
+ return None ;
58
+ } ;
56
59
57
60
module. set_style ( config. style ) ;
58
61
module. get_prefix ( ) . set_value ( KUBERNETES_PREFIX ) ;
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ pub fn prompt(args: ArgMatches) {
36
36
37
37
let modules = & prompt_order
38
38
. par_iter ( )
39
- . filter ( |module| context. is_module_enabled ( module) )
39
+ . filter ( |module| ! context. is_module_disabled_in_config ( module) )
40
40
. map ( |module| modules:: handle ( module, & context) ) // Compute modules
41
41
. flatten ( )
42
42
. collect :: < Vec < Module > > ( ) ; // Remove segments set to `None`
You can’t perform that action at this time.
0 commit comments