@@ -21,15 +21,15 @@ def __init__(self):
21
21
self ._sort_status = True
22
22
self ._colored = True
23
23
24
- def load (self ):
24
+ def load (self , no_excludes : bool = False ):
25
25
config_home = os .path .expanduser ("~/" + self ._configname )
26
26
if os .path .exists (config_home ):
27
- self ._load_config (config_home )
27
+ self ._load_config (config_home , no_excludes )
28
28
config_local = "./" + self ._configname
29
29
if os .path .exists (config_local ):
30
- self ._load_config (config_local )
30
+ self ._load_config (config_local , no_excludes )
31
31
32
- def _load_config (self , configfile ):
32
+ def _load_config (self , configfile , no_excludes : bool ):
33
33
config = configparser .ConfigParser ()
34
34
config .read (configfile )
35
35
if "gitall" in config :
@@ -44,9 +44,9 @@ def _load_config(self, configfile):
44
44
if sort != "" :
45
45
self ._sort = (sort != "no" )
46
46
self ._sort_status = (sort == "status" )
47
- # Not a very safe way of splitting path lists, but better than nothing and good enough for me ..
48
- excluded = [ e .strip () for e in excluded .split ("\n " ) ]
49
- self .exclude (excluded )
47
+ if not no_excludes :
48
+ excluded = [ e .strip () for e in excluded .split ("\n " ) ]
49
+ self .exclude (excluded )
50
50
51
51
def exclude (self , excluded_dirs : []):
52
52
for d in excluded_dirs :
@@ -218,14 +218,17 @@ def main():
218
218
"Can be specified multiple times." )
219
219
parser .add_argument ("-e" , "--exclude" , action = "append" , type = str , default = [],
220
220
help = "Specify directories to exclude from the search. Can be specified multiple times." )
221
+ parser .add_argument ("-x" , "--ignore-config-excludes" , action = argparse .BooleanOptionalAction , default = False ,
222
+ dest = "ignore_excludes" ,
223
+ help = "Ignore exclude paths from config files, ie., only use exclude paths from command line." )
221
224
parser .add_argument ("-u" , "--subrepos" , action = argparse .BooleanOptionalAction , default = None ,
222
- help = "Search for git repositories within git repositories." )
225
+ help = "Search for git repositories within git repositories (default: False) ." )
223
226
parser .add_argument ("-s" , "--sort" , choices = ["no" , "path" , "status" ], default = None ,
224
- help = "Sort repositories based on status, list modified repos last." )
227
+ help = "Sort repositories based on status, list modified repos last (default: status) ." )
225
228
parser .add_argument ("-t" , "--status" , action = argparse .BooleanOptionalAction , default = None ,
226
229
help = "Check and print the status of the repositories (default: True)." )
227
- parser .add_argument ("-x " , "--abort" , action = argparse .BooleanOptionalAction , default = False , dest = "abort_on_error" ,
228
- help = "Abort on first git command error." )
230
+ parser .add_argument ("-a " , "--abort" , action = argparse .BooleanOptionalAction , default = False , dest = "abort_on_error" ,
231
+ help = "Abort on first git command error (default: False) ." )
229
232
parser .add_argument ("command" , metavar = "command" , type = str , nargs = argparse .REMAINDER )
230
233
231
234
args = parser .parse_args ()
@@ -238,7 +241,7 @@ def main():
238
241
# Setup configuration
239
242
config = Config ()
240
243
# Load config file
241
- config .load ()
244
+ config .load (args . ignore_excludes )
242
245
# Override config with commandline args
243
246
config .exclude (args .exclude )
244
247
if args .sort is not None :
0 commit comments