@@ -47,17 +47,19 @@ def read_config(self):
4747 with self .repo .config_reader () as config :
4848 self .mode = config .get_value (self .SECTION , 'mode' , 'reduce' )
4949 self .pattern = config .get_value (self .SECTION , 'pattern' , '' )
50- self .limit = config .get_value (self .SECTION , "limitHour" , config .get_value (self .SECTION , 'limit' , '' ))
51- if config .get_value (self .SECTION , 'limit' , False ):
50+ self .limit = config .get_value (self .SECTION , "limitHour" ,
51+ config .get_value (self .SECTION , 'limit' , '' ))
52+ if config .has_option (self .SECTION , 'limit' ):
5253 click .echo (click .wrap_text (
53- 'The option privacy.limit is deprecated and will be removed in future versions.'
54+ 'Warning: The option privacy.limit is deprecated and will be removed in future versions.'
5455 'Use privacy.limitHour instead.'
5556 ))
56- if config .get_value (self .SECTION , 'limit' , False ) and config .get_value (self .SECTION , 'limitHour' , False ):
57+ if config .has_option (self .SECTION , 'limit' ) and config .has_option (self .SECTION , 'limitHour' ):
5758 click .echo (click .wrap_text (
58- 'Not allowed to use the deprecated privacy.limit and privacy.limitHour at the same time.'
59+ 'Error: Not allowed to use the deprecated privacy.limit and privacy.limitHour at the same time.'
5960 'Only use privacy.limitHour instead.'
60- ))
61+ ), err = True )
62+ ctx .exit (1 )
6163 self .limitDay = config .get_value (self .SECTION , "limitWeekday" , '' )
6264 self .password = config .get_value (self .SECTION , 'password' , '' )
6365 self .salt = config .get_value (self .SECTION , 'salt' , '' )
@@ -104,7 +106,12 @@ def get_dateredacter(self) -> DateRedacter:
104106 "following time unit identifiers: "
105107 "M: month, d: day, h: hour, m: minute, s: second." ,
106108 preserve_paragraphs = True ))
107- return ResolutionDateRedacter (self .pattern , self .limit , self .limitDay , self .mode )
109+ try :
110+ redacter = ResolutionDateRedacter (self .pattern , self .limit , self .limitDay , self .mode )
111+ except ValueError as e :
112+ click .echo (click .wrap_text (str (e )))
113+ ctx .exit (1 )
114+ return redacter
108115
109116 def write_config (self , ** kwargs ):
110117 """Write config"""
0 commit comments