@@ -34,6 +34,10 @@ def _add_color_option(parser):
3434 )
3535
3636
37+ def _add_config_option (parser ):
38+ parser .add_argument ('-c' , '--config' , help = 'Path to alternate config file' )
39+
40+
3741def main (argv = None ):
3842 argv = argv if argv is not None else sys .argv [1 :]
3943 argv = [five .to_text (arg ) for arg in argv ]
@@ -89,6 +93,7 @@ def main(argv=None):
8993 help = "Auto-update pre-commit config to the latest repos' versions." ,
9094 )
9195 _add_color_option (autoupdate_parser )
96+ _add_config_option (autoupdate_parser )
9297
9398 run_parser = subparsers .add_parser ('run' , help = 'Run hooks.' )
9499 _add_color_option (run_parser )
@@ -119,6 +124,7 @@ def main(argv=None):
119124 '--hook-stage' , choices = ('commit' , 'push' ), default = 'commit' ,
120125 help = 'The stage during which the hook is fired e.g. commit or push.' ,
121126 )
127+ _add_config_option (run_parser )
122128 run_mutex_group = run_parser .add_mutually_exclusive_group (required = False )
123129 run_mutex_group .add_argument (
124130 '--all-files' , '-a' , action = 'store_true' , default = False ,
@@ -152,7 +158,10 @@ def main(argv=None):
152158
153159 with error_handler ():
154160 add_logging_handler (args .color )
155- runner = Runner .create ()
161+ runner_kwargs = {}
162+ if hasattr (args , 'config_file' ):
163+ runner_kwargs ['config_file' ] = args .config_file
164+ runner = Runner .create (** runner_kwargs )
156165 git .check_for_cygwin_mismatch ()
157166
158167 if args .command == 'install' :
0 commit comments