<s> """<STR_LIT>""" <EOL> import os <EOL> import sys <EOL> from qisys import ui <EOL> import qisrc . git <EOL> import qisrc . parsers <EOL> import qibuild . parsers <EOL> def configure_parser ( parser ) : <EOL> """<STR_LIT>""" <EOL> qisrc . parsers . worktree_parser ( parser ) <EOL> qibuild . parsers . project_parser ( parser , positional = False ) <EOL> parser . add_argument ( "<STR_LIT>" , help = "<STR_LIT>" , <EOL> default = "<STR_LIT>" , choices = [ '<STR_LIT:none>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> parser . add_argument ( "<STR_LIT>" , metavar = "<STR_LIT>" , nargs = "<STR_LIT:+>" , <EOL> help = "<STR_LIT>" ) <EOL> def do ( args ) : <EOL> """<STR_LIT>""" <EOL> git_worktree = qisrc . parsers . get_git_worktree ( args ) <EOL> git_projects = qisrc . parsers . get_git_projects ( git_worktree , args , default_all = True , <EOL> use_build_deps = args . use_deps ) <EOL> git_grep_opts = args . git_grep_opts <EOL> if args . path == '<STR_LIT:none>' : <EOL> git_grep_opts . insert ( <NUM_LIT:0> , "<STR_LIT>" ) <EOL> else : <EOL> git_grep_opts . insert ( <NUM_LIT:0> , "<STR_LIT>" ) <EOL> if args . path == '<STR_LIT>' or args . path == '<STR_LIT>' : <EOL> git_grep_opts . insert ( <NUM_LIT:0> , "<STR_LIT>" ) <EOL> git_grep_opts . insert ( <NUM_LIT:0> , "<STR_LIT>" ) <EOL> if ui . config_color ( sys . stdout ) : <EOL> git_grep_opts . insert ( <NUM_LIT:0> , "<STR_LIT>" ) <EOL> if not git_projects : <EOL> qisrc . worktree . on_no_matching_projects ( git_worktree , groups = args . groups ) <EOL> sys . exit ( <NUM_LIT:0> ) <EOL> max_src = max ( len ( x . src ) for x in git_projects ) <EOL> retcode = <NUM_LIT:1> <EOL> for i , project in enumerate ( git_projects ) : <EOL> ui . info_count ( i , len ( git_projects ) , <EOL> ui . green , "<STR_LIT>" , <EOL> ui . blue , project . src . ljust ( max_src ) , <EOL> end = "<STR_LIT:\r>" ) <EOL> git = qisrc . git . Git ( project . path ) <EOL> ( status , out ) = git . call ( "<STR_LIT>" , * git_grep_opts , raises = False ) <EOL> if out != "<STR_LIT>" : <EOL> if args . path == '<STR_LIT>' or args . path == '<STR_LIT>' : <EOL> lines = out . splitlines ( ) <EOL> out_lines = list ( ) <EOL> for line in lines : <EOL> line_split = line . split ( '<STR_LIT>' ) <EOL> prepend = project . src if args . path == '<STR_LIT>' else project . path <EOL> line_split [ <NUM_LIT:0> ] = os . path . join ( prepend , line_split [ <NUM_LIT:0> ] ) <EOL> out_lines . append ( "<STR_LIT::>" . join ( line_split ) ) <EOL> out = '<STR_LIT:\n>' . join ( out_lines ) <EOL> ui . info ( "<STR_LIT:\n>" , ui . reset , out ) <EOL> if status == <NUM_LIT:0> : <EOL> retcode = <NUM_LIT:0> <EOL> if not out : <EOL> ui . info ( ui . reset ) <EOL> sys . exit ( retcode ) </s>
