(command.CommandList children: [ (command.ShFunction name: k_script_build body: (BraceGroup children: [ (C {<local>} {<Id.Lit_VarLike 'KOALEPHANT_TOOL_VERSION='> (DQ <1.0.0>)}) (C {<local>} {<Id.Lit_VarLike 'KOALEPHANT_TOOL_DESCRIPTION='> (DQ < 'Process shell source (.) statements into absolute references or inline the script' > ) } ) (C {<local>} {<Id.Lit_VarLike 'KOALEPHANT_TOOL_OPTIONS='> (DQ (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.Simple words: [{<cat>}] redirects: [ (redir op: <Id.Redir_DLessDash '<<-'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {<EOT>} here_end_span_id: 70 stdin_parts: [ <'Options:\n'> <'\n'> < ' -c, --cd change to the input file directory before building\n' > < ' -f, --file file the source to read. If not specified, defaults to stdin\n' > < ' -o, --output file the file to write to. If not specified, defaults to stdout\n' > < ' -d, --define var=val define simple replacements to be performed while processing e.g. LIB_PATH=/foo\n' > < ' -i, --inline, --static path dir or file path to explicitly inline. Can be specified multiple times\n' > < ' -l, --link, --dynamic path=abs dir or file path to explicitly link to. Can be specified multiple times\n' > < ' -r, --report process input and report all discovered inclusions\n' > < ' -x, --executable mark the resulting file (if not stdout) executable\n' > <' -h, --help show this help\n'> <' -v, --version show the version\n'> <' -V, --verbose show verbose output\n'> <' -D, --debug show debug output\n'> < ' -q, --quiet suppress all output except errors\n' > <'\n'> ] ) ) ] do_fork: T ) ) ) } ) (C {<local>} {<Id.Lit_VarLike 'FIND_SOURCE_LINES='> (DQ <'s/^'> <Id.Lit_BadBackslash '\\'> <'s*'> <Id.Lit_BadBackslash '\\'> <'. (.*)/K_SCRIPT_BUILD_REPORT'> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\\'>) <'1/p'> ) } ) (C {<readonly>} {<FIND_SOURCE_LINES>}) (C {<local>} {<Id.Lit_VarLike 'FIX_NEWLINES='> (SQ <'$a\\\\'>)}) (C {<readonly>} {<FIX_NEWLINES>}) (C {<local>} {<Id.Lit_VarLike 'infile='> <'/dev/stdin'>}) (C {<local>} {<Id.Lit_VarLike 'outfile='> <'/dev/stdout'>}) (C {<local>} {<Id.Lit_VarLike 'executable='> <false>}) (C {<local>} {<Id.Lit_VarLike 'report='> <false>}) (C {<local>} {<Id.Lit_VarLike 'changeDir='> <false>}) (C {<local>} {<Id.Lit_VarLike 'changeDirPath='> (DQ )}) (C {<local>} {<Id.Lit_VarLike 'sourcePaths='> (DQ )}) (C {<local>} {<Id.Lit_VarLike 'definitions='> (DQ )}) (C {<local>} {<Id.Lit_VarLike 'newline='> (DQ (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<printf>} {(SQ <'\\n '>)}) ) ) } ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:newline) op: assign_op.Equal rhs: { (DQ (braced_var_sub token: <Id.VSub_Name newline> suffix_op: (suffix_op.Unary tok:<Id.VOp1_Percent '%'> arg_word:{<' '>}) ) ) } spids: [179] ) ] ) (C {<.>} {<'./shell-script-library.lib.sh'>}) (command.Simple words: [{<k_log_level>} {(${ Id.VSub_Name KOALEPHANT_LOG_LEVEL_NOTICE)}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<'/dev/null'>})] do_fork: T ) (command.ShFunction name: add_source_path body: (BraceGroup children: [ (C {<local>} {<Id.Lit_VarLike 'type='> (DQ ($ Id.VSub_Number '$1'))}) (C {<local>} {<Id.Lit_VarLike 'source='> (DQ ($ Id.VSub_Number '$2'))}) (C {<local>} {<Id.Lit_VarLike 'value='> (DQ (braced_var_sub token: <Id.VSub_Number 3> suffix_op: (suffix_op.Unary tok:<Id.VTest_ColonHyphen ':-'> arg_word:(word.Empty)) ) ) } ) (C {<local>} {<Id.Lit_VarLike 'sep='> (DQ )}) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {<-n>} {(DQ (${ Id.VSub_Name sourcePaths))} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:sep) op: assign_op.Equal rhs: {(DQ <Id.Lit_BadBackslash '\\'> <n>)} spids: [267] ) ] ) ] spids: [249 264] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:sourcePaths) op: assign_op.Equal rhs: { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<printf>} {(DQ <'%s'> (${ Id.VSub_Name sep) <'%s#%s#%s'>)} {(DQ (${ Id.VSub_Name sourcePaths))} {(DQ (${ Id.VSub_Name type))} {(DQ (${ Id.VSub_Name source))} {(DQ (${ Id.VSub_Name value))} ) ) ) } spids: [278] ) ] ) ] ) ) (command.ShFunction name: add_dynamic_mapping body: (BraceGroup children: [ (C {<local>} {<Id.Lit_VarLike 'find='> (DQ ($ Id.VSub_Number '$1'))}) (C {<local>} {<Id.Lit_VarLike 'target='> (DQ ($ Id.VSub_Number '$2'))}) (C {<k_log_info>} { (DQ <'Adding dynamic mapping for \''> (${ Id.VSub_Name find) <'\' => \''> (${ Id.VSub_Name target) <'\''> ) } ) (C {<add_source_path>} {<dynamic>} {(DQ (${ Id.VSub_Name find))} {(DQ (${ Id.VSub_Name target))} ) ] ) ) (command.ShFunction name: add_static_path body: (BraceGroup children: [ (C {<local>} {<Id.Lit_VarLike 'path='> (DQ ($ Id.VSub_Number '$1'))}) (C {<k_log_info>} {(DQ <'Adding static path for \''> (${ Id.VSub_Name path) <'\''>)}) (C {<add_source_path>} {<static>} {(DQ (${ Id.VSub_Name path))}) ] ) ) (command.ShFunction name: add_definition body: (BraceGroup children: [ (C {<local>} {<Id.Lit_VarLike 'definition='> (DQ ($ Id.VSub_Number '$1'))}) (C {<local>} {<Id.Lit_VarLike 'value='> (DQ ($ Id.VSub_Number '$2'))}) (C {<local>} {<Id.Lit_VarLike 'sep='> (DQ )}) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {<-n>} {(DQ (${ Id.VSub_Name definitions))} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:sep) op: assign_op.Equal rhs: {(DQ <Id.Lit_BadBackslash '\\'> <n>)} spids: [472] ) ] ) ] spids: [454 469] ) ] ) (C {<k_log_info>} { (DQ <'Adding definition for \''> (${ Id.VSub_Name definition) <'\' with value \''> (${ Id.VSub_Name value) <'\''> ) } ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:definitions) op: assign_op.Equal rhs: { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<printf>} {(DQ <'%s'> (${ Id.VSub_Name sep) <'%s %s'>)} {(DQ (${ Id.VSub_Name definitions))} {(DQ ($ Id.VSub_DollarName '$definition'))} {(DQ (${ Id.VSub_Name value))} ) ) ) } spids: [499] ) ] ) ] ) ) (command.ShFunction name: get_definition_pattern body: (BraceGroup children: [ (command.Pipeline children: [ (C {<echo>} {(DQ (${ Id.VSub_Name definitions))}) (command.WhileUntil keyword: <Id.KW_While while> cond: (condition.Shell commands: [ (command.Sentence child: (command.Simple words: [{<read>} {<-r>} {<key>} {<value>}] more_env: [(env_pair name:IFS val:{(DQ <' '>)} spids:[554])] do_fork: T ) terminator: <Id.Op_Semi _> ) ] ) body: (command.DoGroup children: [ (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {<-z>} {(DQ (${ Id.VSub_Name key))} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ControlFlow token: <Id.ControlFlow_Continue continue> ) ] spids: [571 586] ) ] ) (C {<k_log_debug>} { (DQ <'Using definition: \''> (${ Id.VSub_Name key) <'\' = \''> (${ Id.VSub_Name value) <'\''> ) } ) (C {<printf>} { (DQ <'s#([^A-Za-z0-9_])%s([^A-Za-z0-9_])#'> (word_part.EscapedLiteral token: <Id.Lit_EscapedChar '\\\\'> ) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\\'>) <'1%s'> (word_part.EscapedLiteral token: <Id.Lit_EscapedChar '\\\\'> ) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\\'>) <'2#g; '> ) } {(DQ (${ Id.VSub_Name key))} {(DQ (${ Id.VSub_Name value))} ) ] ) ) ] negated: F ) ] ) ) (command.ShFunction name: get_include_pattern body: (BraceGroup children: [ (command.Pipeline children: [ (C {<echo>} {(DQ (${ Id.VSub_Name sourcePaths))}) (command.WhileUntil keyword: <Id.KW_While while> cond: (condition.Shell commands: [ (command.Sentence child: (command.Simple words: [{<read>} {<-r>} {<type>} {<source>} {<value>}] more_env: [(env_pair name:IFS val:{(DQ <'#'>)} spids:[661])] do_fork: T ) terminator: <Id.Op_Semi _> ) ] ) body: (command.DoGroup children: [ (command.Case to_match: {(DQ (${ Id.VSub_Name type))} arms: [ (case_arm pat_list: [{<dynamic>}] action: [ (C {<printf>} {(DQ <'s#%s#%s#g; '>)} { (DQ <'^('> <Id.Lit_BadBackslash '\\'> <'s*'> <Id.Lit_BadBackslash '\\'> <.> <Id.Lit_BadBackslash '\\'> <'s+)(['> <Id.Lit_BadBackslash '\\'> <'\''> (word_part.EscapedLiteral token: <Id.Lit_EscapedChar '\\"'> ) <']?)('> (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<escape_sed_pattern>} {(DQ (${ Id.VSub_Name source))} ) ) <')(.*'> <Id.Lit_BadBackslash '\\'> <2> <Id.Lit_BadBackslash '\\'> <'s*)'> (word_part.EscapedLiteral token: <Id.Lit_EscapedChar '\\$'> ) ) } { (DQ <Id.Lit_BadBackslash '\\'> <1> <Id.Lit_BadBackslash '\\'> <2> (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<escape_sed_replacement>} {(DQ (${ Id.VSub_Name value))} ) ) <Id.Lit_BadBackslash '\\'> <4> ) } ) ] spids: [691 692 749 -1] ) (case_arm pat_list: [{<static>}] action: [ (C {<printf>} {(DQ <'s#%s#%s#g; '>)} { (DQ <'^('> <Id.Lit_BadBackslash '\\'> <'s*)'> <Id.Lit_BadBackslash '\\'> <.> <Id.Lit_BadBackslash '\\'> <'s+(['> <Id.Lit_BadBackslash '\\'> <'\''> (word_part.EscapedLiteral token: <Id.Lit_EscapedChar '\\"'> ) <']?)('> (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<glob_to_sed>} {(${ Id.VSub_Name source)}) ) <')'> <Id.Lit_BadBackslash '\\'> <2> <Id.Lit_BadBackslash '\\'> <'s*'> <Id.Lit_Dollar '$'> ) } {(DQ <K_SCRIPT_BUILD_INCLUDE> <Id.Lit_BadBackslash '\\'> <1> <Id.Lit_BadBackslash '\\'> <3>)} ) ] spids: [753 754 799 -1] ) ] ) ] ) ) ] negated: F ) ] ) ) (command.ShFunction name: glob_to_sed body: (BraceGroup children: [ (C {<local>} {<Id.Lit_VarLike 'pattern='> (DQ )}) (C {<local>} {<Id.Lit_VarLike 'sep='> (DQ <'|'>)}) (C {<k_log_debug>} {(DQ <'Converting glob pattern to sed: \''> ($ Id.VSub_At '$@') <'\''>)} ) (command.ForEach iter_name: file iter_words: [{(DQ ($ Id.VSub_At '$@'))}] do_arg_iter: F body: (command.DoGroup children: [ (C {<k_log_debug>} {(DQ <'Checking file exists: \''> (${ Id.VSub_Name file) <'\''>)} ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {<-e>} {(DQ (${ Id.VSub_Name file))} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:pattern) op: assign_op.Equal rhs: { (DQ (${ Id.VSub_Name pattern) (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<escape_sed_pattern>} {(DQ (${ Id.VSub_Name file))} ) ) (${ Id.VSub_Name sep) ) } spids: [887] ) ] ) ] spids: [869 884] ) ] ) ] ) ) (C {<printf>} {(DQ <'%s'>)} { (DQ (braced_var_sub token: <Id.VSub_Name pattern> suffix_op: (suffix_op.Unary tok: <Id.VOp1_Percent '%'> arg_word: {(${ Id.VSub_Name sep)} ) ) ) } ) ] ) ) (command.ShFunction name: escape_sed_pattern body: (BraceGroup children: [ (command.Pipeline children: [ (C {<echo>} {(DQ (${ Id.VSub_Number 1))}) (C {<sed>} {<-e>} {(SQ <'s/[]\\/$*.^\\|[()?+{}]/\\\\&/g'>)}) ] negated: F ) ] ) ) (command.ShFunction name: escape_sed_replacement body: (BraceGroup children: [ (C {<local>} {<Id.Lit_VarLike 'delimiter='> (DQ (braced_var_sub token: <Id.VSub_Number 2> suffix_op: (suffix_op.Unary tok: <Id.VTest_ColonHyphen ':-'> arg_word: {<Id.Lit_Slash '/'>} ) ) ) } ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} { (braced_var_sub token: <Id.VSub_Name delimiter> prefix_op: (Id.VSub_Pound) ) } {<-ne>} {<1>} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<k_log_alert>} { (DQ <'Error, pattern delimiter must be exactly one character: '> (${ Id.VSub_Name delimiter) ) } ) (command.ControlFlow token: <Id.ControlFlow_Return return> arg_word: {<2>} ) ] spids: [985 1001] ) ] ) (command.Pipeline children: [ (C {<echo>} {(DQ (${ Id.VSub_Number 1))}) (C {<sed>} {<-e>} { (DQ <'s/['> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\\'>) (${ Id.VSub_Name delimiter) <Id.Lit_BadBackslash '\\'> <'&]/'> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\\'>) (word_part.EscapedLiteral token: <Id.Lit_EscapedChar '\\\\'> ) <'&/g'> ) } ) ] negated: F ) ] ) ) (command.ShFunction name: process_stream body: (BraceGroup children: [ (C {<local>} {<Id.Lit_VarLike 'pattern='> (DQ ($ Id.VSub_Number '$1'))}) (C {<local>} {<Id.Lit_VarLike 'parentPrefix='> (DQ (braced_var_sub token: <Id.VSub_Number 2> suffix_op: (suffix_op.Unary tok:<Id.VTest_ColonHyphen ':-'> arg_word:(word.Empty)) ) ) } ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {($ Id.VSub_Pound '$#')} {<-ge>} {<2>} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [(C {<shift>} {<2>})] spids: [1082 1095] ) ] else_action: [(C {<shift>})] ) (C {<local>} {<Id.Lit_VarLike 'sedOpts='> (DQ ($ Id.VSub_Star '$*'))}) (C {<local>} {<Id.Lit_VarLike 'defPattern='> (DQ (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<get_definition_pattern>}) ) ) } ) (C {<k_log_debug>} { (DQ <'Processing stream using pattern: \''> (${ Id.VSub_Name pattern) <'\', definition pattern: \''> (${ Id.VSub_Name defPattern) <'\''> ) } ) (command.Pipeline children: [ (C {<sed>} {<-E>} {(${ Id.VSub_Name sedOpts)} {<-e>} {(DQ (${ Id.VSub_Name FIX_NEWLINES))} {<-e>} {(DQ (${ Id.VSub_Name defPattern))} {<-e>} {(DQ <'s/^/'> (${ Id.VSub_Name parentPrefix) <'/g'>)} {<-e>} {(DQ (${ Id.VSub_Name pattern))} ) (command.WhileUntil keyword: <Id.KW_While while> cond: (condition.Shell commands: [ (command.Sentence child: (command.Simple words: [{<read>} {<-r>} {<line>}] more_env: [(env_pair name:IFS val:(word.Empty) spids:[1194])] do_fork: T ) terminator: <Id.Op_Semi _> ) ] ) body: (command.DoGroup children: [ (C {<local>} {<Id.Lit_VarLike 'prefix='> (DQ (${ Id.VSub_Name parentPrefix))} ) (C {<local>} {<Id.Lit_VarLike 'includeFile='> (DQ )}) (command.Case to_match: {(DQ (${ Id.VSub_Name line))} arms: [ (case_arm pat_list: [{<K_SCRIPT_BUILD_INCLUDE> <Id.Lit_Star '*'>}] action: [ (C {<k_log_debug>} { (DQ <'Processing \'include\' line: \''> (${ Id.VSub_Name line) ) } ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:line) op: assign_op.Equal rhs: { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<k_string_remove_start>} {(DQ <K_SCRIPT_BUILD_INCLUDE>)} {(DQ (${ Id.VSub_Name line))} ) ) ) } spids: [1251] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:trimmed) op: assign_op.Equal rhs: { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<k_string_trim>} {(DQ (${ Id.VSub_Name line))} ) ) ) } spids: [1269] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:prefix) op: assign_op.Equal rhs: { (DQ (${ Id.VSub_Name prefix) (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<k_string_remove_end>} {(DQ (${ Id.VSub_Name trimmed))} {(DQ (${ Id.VSub_Name line))} ) ) ) } spids: [1283] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:includeFile) op: assign_op.Equal rhs: {(DQ (${ Id.VSub_Name trimmed))} spids: [1306] ) ] ) ] spids: [1235 1238 1314 -1] ) (case_arm pat_list: [{<K_SCRIPT_BUILD_REPORT> <Id.Lit_Star '*'>}] action: [ (C {<k_log_debug>} { (DQ <'Processing \'report\' line: \''> (${ Id.VSub_Name line) ) } ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:line) op: assign_op.Equal rhs: { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<k_string_remove_start>} {(DQ <K_SCRIPT_BUILD_REPORT>)} {(DQ (${ Id.VSub_Name line))} ) ) ) } spids: [1334] ) ] ) (C {<printf>} {(DQ <'%s'> <Id.Lit_BadBackslash '\\'> <n>)} {(DQ (${ Id.VSub_Name line))} ) ] spids: [1318 1321 1367 -1] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.AndOr ops: [Id.Op_DAmp] children: [ (C {<Id.Lit_LBracket '['>} {<-n>} {(DQ (${ Id.VSub_Name includeFile))} {<Id.Lit_RBracket ']'>} ) (C {<Id.Lit_LBracket '['>} {<-f>} {(DQ (${ Id.VSub_Name includeFile))} {<Id.Lit_RBracket ']'>} ) ] ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<k_log_debug>} { (DQ <'Including file: \''> (${ Id.VSub_Name includeFile) <'\''> ) } ) (C {<printf>} { (DQ (${ Id.VSub_Name prefix) <'#K_SCRIPT_BUILD: include(%s)'> <Id.Lit_BadBackslash '\\'> <n> ) } {(DQ (${ Id.VSub_Name includeFile))} ) (command.Simple words: [ {<process_stream>} {(DQ (${ Id.VSub_Name pattern))} {(DQ (${ Id.VSub_Name prefix))} {(${ Id.VSub_Name sedOpts)} ] redirects: [ (redir op: <Id.Redir_Less '<'> loc: (redir_loc.Fd fd:0) arg: {(DQ (${ Id.VSub_Name includeFile))} ) ] do_fork: T ) ] spids: [1374 1403] ) ] else_action: [ (C {<k_log_debug>} {(DQ <'Regular line: \''> (${ Id.VSub_Name line) <'\''>)} ) (C {<printf>} {(DQ <'%s'> <Id.Lit_BadBackslash '\\'> <n>)} {(DQ (${ Id.VSub_Name line))} ) ] ) ] ) ) ] negated: F ) ] ) ) (command.ShFunction name: handle_changedir body: (BraceGroup children: [ (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {(${ Id.VSub_Name changeDir)} {<Id.Lit_Equals '='>} {<true>} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {<-z>} {(DQ (${ Id.VSub_Name changeDirPath))} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {<-f>} {(DQ (${ Id.VSub_Name infile))} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:changeDirPath) op: assign_op.Equal rhs: { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<k_fs_dirname>} {(DQ (${ Id.VSub_Name infile))} ) ) ) } spids: [1562] ) ] ) ] spids: [1544 1559] ) ] else_action: [ (C {<k_log_err>} { (DQ < 'No directory given to -c/--cd and no -f/--file specified' > ) } ) (command.ControlFlow token: <Id.ControlFlow_Return return> arg_word: {<2>} ) ] ) ] spids: [1526 1541] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {<-f>} {(DQ (${ Id.VSub_Name infile))} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:infile) op: assign_op.Equal rhs: { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<k_fs_resolve>} {(DQ (${ Id.VSub_Name infile))}) ) ) } spids: [1617] ) ] ) ] spids: [1599 1614] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {<-n>} {(DQ (${ Id.VSub_Name outfile))} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:outfile) op: assign_op.Equal rhs: { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<k_fs_resolve>} {(DQ (${ Id.VSub_Name outfile))}) ) ) } spids: [1653] ) ] ) ] spids: [1635 1650] ) ] ) (C {<cd>} {(DQ (${ Id.VSub_Name changeDirPath))}) ] spids: [1508 1523] ) ] ) ] ) ) (command.ShFunction name: handle_executable body: (BraceGroup children: [ (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {(${ Id.VSub_Name executable)} {<Id.Lit_Equals '='>} {<true>} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {<-f>} {(DQ (${ Id.VSub_Name outfile))} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<chmod>} {<Id.Lit_Other '+'> <x>} {(DQ (${ Id.VSub_Name outfile))} ) ] spids: [1712 1727] ) ] else_action: [ (C {<k_log_err>} {(DQ <'Cannot set executable bit when output is stdout'>)} ) (command.ControlFlow token: <Id.ControlFlow_Return return> arg_word: {<2>} ) ] ) ] spids: [1694 1709] ) ] ) ] ) ) (C {<local>} {<tmpVal>}) (command.WhileUntil keyword: <Id.KW_While while> cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {($ Id.VSub_Pound '$#')} {<-gt>} {<0>} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) body: (command.DoGroup children: [ (command.Case to_match: {(DQ ($ Id.VSub_Number '$1'))} arms: [ (case_arm pat_list: [{<-h>} {<--help>}] action: [ (C {<k_usage>}) (command.ControlFlow token: <Id.ControlFlow_Exit exit> ) ] spids: [1798 1801 1810 -1] ) (case_arm pat_list: [{<-c>} {<--cd>}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:changeDir) op: assign_op.Equal rhs: {<true>} spids: [1820] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:changeDirPath) op: assign_op.Equal rhs: { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<k_option_optional_arg>} {(DQ ($ Id.VSub_At '$@'))}) ) ) } spids: [1824] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {<-n>} {(DQ (${ Id.VSub_Name changeDirPath))} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [(C {<shift>})] spids: [1836 1851] ) ] ) (C {<shift>}) ] spids: [1814 1817 1864 -1] ) (case_arm pat_list: [{<-f>} {<--file>}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:infile) op: assign_op.Equal rhs: { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<k_option_requires_arg>} {(DQ ($ Id.VSub_At '$@'))}) ) ) } spids: [1874] ) ] ) (C {<shift>} {<2>}) ] spids: [1868 1871 1891 -1] ) (case_arm pat_list: [{<-d>} {<--define>}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:tmpVal) op: assign_op.Equal rhs: { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<k_option_requires_arg>} {(DQ ($ Id.VSub_At '$@'))}) ) ) } spids: [1901] ) ] ) (C {<add_definition>} { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.Pipeline children: [ (C {<echo>} {(DQ (${ Id.VSub_Name tmpVal))}) (C {<cut>} {<-d>} {<Id.Lit_Equals '='>} {<-f>} {<1>}) ] negated: F ) ) ) } { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.Pipeline children: [ (C {<echo>} {(DQ (${ Id.VSub_Name tmpVal))}) (C {<cut>} {<-d>} {<Id.Lit_Equals '='>} {<-f>} {<2>}) ] negated: F ) ) ) } ) (C {<shift>} {<2>}) ] spids: [1895 1898 1969 -1] ) (case_arm pat_list: [{<-o>} {<--output>}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:outfile) op: assign_op.Equal rhs: { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<k_option_requires_arg>} {(DQ ($ Id.VSub_At '$@'))}) ) ) } spids: [1979] ) ] ) (C {<shift>} {<2>}) ] spids: [1973 1976 1996 -1] ) (case_arm pat_list: [{<-i>} {<--inline>} {<--static>}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:tmpVal) op: assign_op.Equal rhs: { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<k_option_optional_arg>} {(DQ ($ Id.VSub_At '$@'))}) ) ) } spids: [2008] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {<-n>} {(DQ (${ Id.VSub_Name tmpVal))} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<add_static_path>} {(DQ (${ Id.VSub_Name tmpVal))}) (C {<shift>} {<2>}) ] spids: [2020 2035] ) ] else_action: [(C {<add_static_path>} {(DQ <'./*'>)}) (C {<shift>})] ) ] spids: [2000 2005 2068 -1] ) (case_arm pat_list: [{<-l>} {<--link>} {<--dynamic>}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:tmpVal) op: assign_op.Equal rhs: { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<k_option_requires_arg>} {(DQ ($ Id.VSub_At '$@'))}) ) ) } spids: [2080] ) ] ) (C {<add_dynamic_mapping>} { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.Pipeline children: [ (C {<echo>} {(DQ (${ Id.VSub_Name tmpVal))}) (C {<cut>} {<-d>} {<Id.Lit_Equals '='>} {<-f>} {<1>}) ] negated: F ) ) ) } { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.Pipeline children: [ (C {<echo>} {(DQ (${ Id.VSub_Name tmpVal))}) (C {<cut>} {<-d>} {<Id.Lit_Equals '='>} {<-f>} {<2>}) ] negated: F ) ) ) } ) (C {<shift>} {<2>}) ] spids: [2072 2077 2148 -1] ) (case_arm pat_list: [{<-r>} {<--report>}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:report) op: assign_op.Equal rhs: {<true>} spids: [2158] ) ] ) (C {<shift>}) ] spids: [2152 2155 2165 -1] ) (case_arm pat_list: [{<-x>} {<--exec>} {<--executable>}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:executable) op: assign_op.Equal rhs: {<true>} spids: [2177] ) ] ) (C {<shift>}) ] spids: [2169 2174 2184 -1] ) (case_arm pat_list: [{<-v>} {<--version>}] action: [ (C {<k_version>}) (command.ControlFlow token: <Id.ControlFlow_Exit exit> ) ] spids: [2188 2191 2200 -1] ) (case_arm pat_list: [{<-V>} {<--verbose>}] action: [ (command.Simple words: [{<k_log_level>} {(${ Id.VSub_Name KOALEPHANT_LOG_LEVEL_INFO)}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<'/dev/null'>} ) ] do_fork: T ) (C {<shift>}) ] spids: [2204 2207 2224 -1] ) (case_arm pat_list: [{<-D>} {<--debug>}] action: [ (command.Simple words: [{<k_log_level>} {(${ Id.VSub_Name KOALEPHANT_LOG_LEVEL_DEBUG)}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<'/dev/null'>} ) ] do_fork: T ) (C {<shift>}) ] spids: [2228 2231 2248 -1] ) (case_arm pat_list: [{<-q>} {<--quiet>}] action: [ (command.Simple words: [{<k_log_level>} {(${ Id.VSub_Name KOALEPHANT_LOG_LEVEL_ERR)}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<'/dev/null'>} ) ] do_fork: T ) (C {<shift>}) ] spids: [2252 2255 2272 -1] ) (case_arm pat_list: [{<-->}] action: [ (C {<shift>}) (command.ControlFlow token: <Id.ControlFlow_Break break> ) ] spids: [2276 2277 2286 -1] ) (case_arm pat_list: [{<-> <Id.Lit_Star '*'>}] action: [ (command.Simple words: [{<echo>} {(DQ <'Unknown option: '> (${ Id.VSub_Number 1))}] redirects: [ (redir op: <Id.Redir_GreatAnd '>&'> loc: (redir_loc.Fd fd:1) arg: {<2>} ) ] do_fork: T ) (C {<k_usage>}) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) ] spids: [2290 2292 2316 -1] ) (case_arm pat_list: [{<Id.Lit_Star '*'>}] action: [(command.ControlFlow token:<Id.ControlFlow_Break break>)] spids: [2320 2321 2327 -1] ) ] ) ] ) ) (C {<handle_changedir>}) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {(${ Id.VSub_Name report)} {<Id.Lit_Equals '='>} {<true>} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.Simple words: [ {<process_stream>} {(DQ (${ Id.VSub_Name FIND_SOURCE_LINES))} {(DQ )} {<-n>} ] redirects: [ (redir op: <Id.Redir_Less '<'> loc: (redir_loc.Fd fd:0) arg: {(DQ (${ Id.VSub_Name infile))} ) (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {(DQ (${ Id.VSub_Name outfile))} ) ] do_fork: T ) (command.ControlFlow token:<Id.ControlFlow_Return return>) ] spids: [2341 2356] ) ] ) (command.Simple words: [ {<process_stream>} { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<get_include_pattern>}) ) ) } ] redirects: [ (redir op: <Id.Redir_Less '<'> loc: (redir_loc.Fd fd:0) arg: {(DQ (${ Id.VSub_Name infile))} ) (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {(DQ (${ Id.VSub_Name outfile))} ) ] do_fork: T ) (C {<handle_executable>}) ] ) ) (C {<k_script_build>} {(DQ ($ Id.VSub_At '$@'))}) ] )