40 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Python
		
	
	
		
			Executable File
		
	
	
			
		
		
	
	
			40 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Python
		
	
	
		
			Executable File
		
	
	
| #!/usr/bin/env python
 | |
| import git_lint
 | |
| 
 | |
| def main(*args):
 | |
|     if git_lint.git_base is None:
 | |
|         sys.exit(_('A git repository was not found.'))
 | |
| 
 | |
|     (cmdline, filenames, excluded_commands) = git_lint.make_rational_options(git_lint.OPTIONS_LIST, args)
 | |
| 
 | |
|     if len(excluded_commands) > 0:
 | |
|         print(_('These command line options were ignored due to option precedence.'))
 | |
|         for exc in excluded_commands:
 | |
|             print("\t{}".format(exc))
 | |
| 
 | |
|     try:
 | |
|         config = git_lint.get_config(cmdline, git_lint.git_base)
 | |
| 
 | |
|         if 'help' in cmdline:
 | |
|             git_lint.print_help(OPTIONS_LIST, NAME)
 | |
|             return 0
 | |
| 
 | |
|         if 'version' in cmdline:
 | |
|             git_lint.print_version(NAME, VERSION)
 | |
|             return 0
 | |
| 
 | |
|         if 'linters' in cmdline:
 | |
|             git_lint.print_linters(config)
 | |
|             return 0
 | |
| 
 | |
|         return git_lint.run_gitlint(cmdline, config, filenames)
 | |
| 
 | |
|     except getopt.GetoptError as err:
 | |
|         git_lint.print_help(OPTIONS_LIST)
 | |
|         return 1
 | |
| 
 | |
| 
 | |
| if __name__ == '__main__':
 | |
|     import sys
 | |
|     sys.exit(main(*sys.argv))
 |