99_FLAGS_OFF = ["false" , "off" ]
1010_FLAGS_TOGGLE = _FLAGS_ON + _FLAGS_OFF
1111
12- _FLAGS = {"debug" , "label" , "screen" , "textwrap" , "bold" }
13-
1412
1513def _flag (value ):
1614 if value := value .lower ():
@@ -21,11 +19,11 @@ def _flag(value):
2119 return False
2220
2321
24- for _flag_name in _FLAGS :
22+ for _flag_name in _config . flag_names :
2523
2624 def _flag_method (name ):
2725 def fn (ctx , value ):
28- setattr ( _config , name , _flag (value ))
26+ _config . set_flag ( name , _flag (value ))
2927
3028 fn .__doc__ = f"Configure { _flag_name } config\n \n set { _flag_name } <{ '|' .join (_FLAGS_TOGGLE )} >"
3129 return fn
@@ -40,13 +38,13 @@ def bible(ctx, *args):
4038
4139 Examples:
4240 set bible kjv
43- set bible acf, nvi/pt """
41+ set bible acf, nvi"""
4442 translations = [value for arg in args for value in arg .split ("," ) if value ]
4543 ctx .bible = sorted (
4644 {_Bible (translation .lower ()) for translation in translations },
4745 key = _attrgetter ("version" ),
4846 )
49- _config .label = len (translations ) > 1
47+ _config .flags . label = len (translations ) > 1
5048
5149
5250def linesep (ctx , * args ):
@@ -60,7 +58,7 @@ def linesep(ctx, *args):
6058 value = "" .join (args )
6159 if value .isdigit ():
6260 value = int (value )
63- assert 0 <= value < 10 , "value must be a int between 0 and 10"
61+ assert 0 <= value <= 10 , "line separation value must be a int between 0 and 10"
6462 _config .linesep = value
6563 else :
66- raise AssertionError ("value should be an int" )
64+ raise AssertionError ("line separation value should be an int" )
0 commit comments