(CommandList children: [ (FuncDef name: k_help2man body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:KOALEPHANT_TOOL_VERSION) op: Equal rhs: {(DQ (2.0.0))} spids: [47] ) ] spids: [45] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:KOALEPHANT_TOOL_DESCRIPTION) op: Equal rhs: {(DQ ('Create a manpage from the help/version output of a executable/script'))} spids: [55] ) ] spids: [53] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:KOALEPHANT_TOOL_OPTIONS) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (SimpleCommand words: [{(cat)}] redirects: [ (HereDoc op: <Redir_DLessDash '<<-'> fd: 16777215 here_begin: {(EOT)} here_end_span_id: 84 stdin_parts: [ ('Options:\n') ('\n') (' -h, --help show this help\n') ( ' -H, --help-command command set the help argument/option to use\n' ) ( ' -n, --name name set the name to use for the tool\n' ) ( ' -N, --alt-name name set an alternate name for the tool\n' ) ( ' -o, --output file set the filename to output to (defaults to stdout)\n' ) ( ' -s, --section section set the manpage section\n' ) ( ' -S, --source source set the program source (i.e. a company/organisation or project/package name)\n' ) (' -v, --version show the version\n') ( ' -V, --version-command command set the version argument/option to use\n' ) ('\n') ] ) ] ) ] ) left_token: <Left_CommandSub '$('> spids: [65 86] ) ) } spids: [63] ) ] spids: [61] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:KOALEPHANT_TOOL_ARGUMENTS) op: Equal rhs: {(DQ (executable))} spids: [92] ) ] spids: [90] ) (C {(.)} {(./base.lib.sh)}) (C {(.)} {(./string.lib.sh)}) (C {(.)} {(./bool.lib.sh)}) (C {(.)} {(./fs.lib.sh)}) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:helpCommand) op: Equal rhs: {(DQ (--help))} spids: [122] ) ] spids: [120] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:description) op:Equal rhs:{(DQ )} spids:[130])] spids: [128] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:section) op:Equal rhs:{(DQ (1))} spids:[137])] spids: [135] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:source) op:Equal rhs:{(DQ )} spids:[145])] spids: [143] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:versionCommand) op: Equal rhs: {(DQ (--version))} spids: [152] ) ] spids: [150] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:output) op: Equal rhs: {(/dev/stdout)} spids: [160] ) ] spids: [158] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:changeDir) op:Equal rhs:{(false)} spids:[166])] spids: [164] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:alternativeName) op: Equal rhs: {(DQ )} spids: [172] ) ] spids: [170] ) (WhileUntil keyword: <KW_While while> cond: [ (Sentence child: (C {(Lit_Other '[')} {($ VSub_Pound '$#')} {(-gt)} {(0)} {(Lit_Other ']')}) terminator: <Op_Semi ';'> ) ] body: (DoGroup children: [ (Case to_match: {(DQ ($ VSub_Number '$1'))} arms: [ (case_arm pat_list: [{(-h)} {(--help)}] action: [(C {(k_usage)}) (ControlFlow token:<ControlFlow_Exit exit>)] spids: [204 207 216 16777215] ) (case_arm pat_list: [{(-c)} {(--cd)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:changeDir) op: Equal rhs: {(true)} spids: [226] ) ] spids: [226] ) (C {(shift)}) ] spids: [220 223 233 16777215] ) (case_arm pat_list: [{(-H)} {(--help-command)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:helpCommand) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(k_option_requires_arg)} {(DQ ($ VSub_At '$@'))}) ] ) left_token: <Left_CommandSub '$('> spids: [245 251] ) ) } spids: [243] ) ] spids: [243] ) (C {(shift)} {(2)}) ] spids: [237 240 260 16777215] ) (case_arm pat_list: [{(-d)} {(--description)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:description) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(k_option_requires_arg)} {(DQ ($ VSub_At '$@'))}) ] ) left_token: <Left_CommandSub '$('> spids: [272 278] ) ) } spids: [270] ) ] spids: [270] ) (C {(shift)} {(2)}) ] spids: [264 267 287 16777215] ) (case_arm pat_list: [{(-N)} {(--alt-name)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:alternativeName) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(k_option_requires_arg)} {(DQ ($ VSub_At '$@'))}) ] ) left_token: <Left_CommandSub '$('> spids: [299 305] ) ) } spids: [297] ) ] spids: [297] ) (C {(shift)} {(2)}) ] spids: [291 294 314 16777215] ) (case_arm pat_list: [{(-o)} {(--output)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:output) op: Equal rhs: {(DQ ($ VSub_Number '$2'))} spids: [324] ) ] spids: [324] ) (C {(shift)} {(2)}) ] spids: [318 321 335 16777215] ) (case_arm pat_list: [{(-s)} {(--section)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:section) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(k_option_requires_arg)} {(DQ ($ VSub_At '$@'))}) ] ) left_token: <Left_CommandSub '$('> spids: [347 353] ) ) } spids: [345] ) ] spids: [345] ) (C {(shift)} {(2)}) ] spids: [339 342 362 16777215] ) (case_arm pat_list: [{(-S)} {(--source)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:source) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(k_option_requires_arg)} {(DQ ($ VSub_At '$@'))}) ] ) left_token: <Left_CommandSub '$('> spids: [374 380] ) ) } spids: [372] ) ] spids: [372] ) (C {(shift)} {(2)}) ] spids: [366 369 389 16777215] ) (case_arm pat_list: [{(-v)} {(--version)}] action: [(C {(k_version)}) (ControlFlow token:<ControlFlow_Exit exit>)] spids: [393 396 405 16777215] ) (case_arm pat_list: [{(-V)} {(--version-command)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:versionCommand) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(k_option_requires_arg)} {(DQ ($ VSub_At '$@'))}) ] ) left_token: <Left_CommandSub '$('> spids: [417 423] ) ) } spids: [415] ) ] spids: [415] ) (C {(shift)} {(2)}) ] spids: [409 412 432 16777215] ) (case_arm pat_list: [{(-) (Lit_Other '*')}] action: [ (SimpleCommand words: [{(echo)} {(DQ ('Unknown option: ') (${ VSub_Number 1))}] redirects: [(Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})] ) (C {(k_usage)}) (ControlFlow token: <ControlFlow_Exit exit> arg_word: {(1)} ) ] spids: [436 438 462 16777215] ) (case_arm pat_list: [{(--)}] action: [(C {(shift)}) (ControlFlow token:<ControlFlow_Break break>)] spids: [466 467 476 16777215] ) (case_arm pat_list: [{(Lit_Other '*')}] action: [(ControlFlow token:<ControlFlow_Break break>)] spids: [480 481 487 16777215] ) ] spids: [194 200 490] ) ] spids: [191 493] ) ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:executable) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [(C {(k_fs_resolve)} {(DQ (${ VSub_Number 1))})] ) left_token: <Left_CommandSub '$('> spids: [501 509] ) ) } spids: [499] ) ] spids: [497] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:executableName) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [(C {(k_fs_basename)} {(DQ (${ VSub_Name executable))} {(.sh)})] ) left_token: <Left_CommandSub '$('> spids: [517 527] ) ) } spids: [515] ) ] spids: [513] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:dir) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [(C {(k_fs_dirname)} {(DQ (${ VSub_Name executable))})] ) left_token: <Left_CommandSub '$('> spids: [535 543] ) ) } spids: [533] ) ] spids: [531] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:includeFile) op: Equal rhs: { (DQ (${ VSub_Name dir) (/) (${ VSub_Name executableName) (.) (${ VSub_Name section) (.man) ) } spids: [549] ) ] spids: [547] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:tmpIncludeFile) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children:[(C {(k_fs_temp_file)})]) left_token: <Left_CommandSub '$('> spids: [570 572] ) ) } spids: [568] ) ] spids: [566] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(-z)} {(DQ (${ VSub_Name executable))} {(Lit_Other ']')}) terminator: <Op_Semi ';'> ) ] action: [ (Sentence child: (C {(echo)} {(DQ ('Executable (') (${ VSub_Name executable) (') not provided'))}) terminator: <Op_Semi ';'> ) (Sentence child:(C {(k_usage)}) terminator:<Op_Semi ';'>) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] spids: [16777215 592] ) (if_arm cond: [ (Sentence child: (AndOr ops: [Op_DPipe] children: [ (C {(Lit_Other '[')} {(KW_Bang '!')} {(-f)} {(DQ (${ VSub_Name executable))} {(Lit_Other ']')} ) (C {(Lit_Other '[')} {(KW_Bang '!')} {(-x)} {(DQ (${ VSub_Name executable))} {(Lit_Other ']')} ) ] ) terminator: <Op_Semi ';'> ) ] action: [ (Sentence child: (C {(echo)} { (DQ ('Executable (') (${ VSub_Name executable) (') not an executable file')) } ) terminator: <Op_Semi ';'> ) (Sentence child:(C {(k_usage)}) terminator:<Op_Semi ';'>) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] spids: [616 649] ) ] spids: [16777215 673] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(${ VSub_Name changeDir)} {(Lit_Other '=')} {(true)} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (C {(cd)} {(DQ (${ VSub_Name dir))}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:executable) op: Equal rhs: { (DQ (./) (CommandSubPart command_list: (CommandList children: [(C {(k_fs_basename)} {(DQ (${ VSub_Name executable))})] ) left_token: <Left_CommandSub '$('> spids: [711 719] ) ) } spids: [708] ) ] spids: [708] ) ] spids: [16777215 692] ) ] spids: [16777215 723] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(-z)} {(DQ (${ VSub_Name description))} {(Lit_Other ']')}) terminator: <Op_Semi ';'> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:description) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(${ VSub_Name executable)} {(${ VSub_Name helpCommand)}) (C {(sed)} {(-E)} {(-n)} {(-e)} {(SQ <'/^\\s*(Usage|\\s*or):/!p'>)} ) (C {(head)} {(-n)} {(1)}) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> spids: [747 777] ) ) } spids: [745] ) ] spids: [745] ) ] spids: [16777215 742] ) ] spids: [16777215 781] ) (SimpleCommand words: [ {(printf)} { (DQ ('[NAME]') (Lit_Other '\\') ('n%s - %s') (Lit_Other '\\') (n) (Lit_Other '\\') (n)) } { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(k_string_join)} {(DQ (', '))} {(${ VSub_Name executableName)} {(${ VSub_Name alternativeName)} ) ] ) left_token: <Left_CommandSub '$('> spids: [798 812] ) ) } {(DQ (${ VSub_Name description))} ] redirects: [ (Redir op: <Redir_Great '>'> fd: 16777215 arg_word: {(DQ (${ VSub_Name tmpIncludeFile))} ) ] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(-f)} {(DQ (${ VSub_Name includeFile))} {(Lit_Other ']')}) terminator: <Op_Semi ';'> ) ] action: [ (SimpleCommand words: [{(cat)} {(DQ (${ VSub_Name includeFile))}] redirects: [ (Redir op: <Redir_DGreat '>>'> fd: 16777215 arg_word: {(DQ (${ VSub_Name tmpIncludeFile))} ) ] ) ] spids: [16777215 845] ) ] spids: [16777215 865] ) (SimpleCommand words: [ {(help2man)} {(--section)} {(DQ (${ VSub_Name section))} {(--no-info)} {(--include)} {(DQ (${ VSub_Name tmpIncludeFile))} {(--help-option)} {(DQ (${ VSub_Name helpCommand))} {(--version-option)} {(DQ (${ VSub_Name versionCommand))} {(--source)} {(DQ (${ VSub_Name source))} {(DQ (${ VSub_Name executable))} ] redirects: [(Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(${ VSub_Name output)})] ) ] spids: [41] ) spids: [37 40] ) (C {(k_help2man)} {(DQ ($ VSub_At '$@'))}) ] )