def main(argv: Sequence[str] | None = None) -> int: parser = argparse.ArgumentParser( description='Similar to a distributed `git grep ...`.', usage='%(prog)s [options] [GIT_GREP_OPTIONS]', add_help=False, ) # Handle --help like normal, pass -h through to git grep parser.add_argument( '--help', action='help', help='show this help message and exit', ) cli.add_common_args(parser) cli.add_repos_with_matches_arg(parser) cli.add_output_paths_arg(parser) args, rest = parser.parse_known_args(argv) config = load_config(args.config_filename) if args.repos_with_matches: return repos_matching_cli(config, rest) else: return grep_cli( config, rest, output_paths=args.output_paths, use_color=args.color, )
def main(argv=None): parser = argparse.ArgumentParser( description='Similar to a distributed `git grep ...`.', usage='%(prog)s [options] [GIT_GREP_OPTIONS]', ) cli.add_common_args(parser) cli.add_repos_with_matches_arg(parser) args, rest = parser.parse_known_args(argv) config = load_config(args.config_filename) if args.repos_with_matches: return repos_matching_cli(config, rest) else: return grep_cli(config, rest, use_color=args.color)
def main(argv=None): parser = argparse.ArgumentParser( description=( 'Similar to a distributed `git ls-files | grep -P PATTERN`.'), usage='%(prog)s [options] PATTERN', ) cli.add_common_args(parser) cli.add_repos_with_matches_arg(parser) parser.add_argument('pattern', help='the python regex to match.') args = parser.parse_args(argv) config = load_config(args.config_filename) if args.repos_with_matches: return find_files_repos_cli(config, args.pattern, use_color=args.color) else: return find_files_cli(config, args.pattern, use_color=args.color)