(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_id: Redir_DLessDash fd: 16777215 body: { (DQ ('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') ) } do_expansion: True here_end: EOT was_filled: T spids: [68] ) ] ) ] ) left_token: <Left_CommandSub '$('> spids: [65 85] ) ) } spids: [63] ) ] spids: [61] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:KOALEPHANT_TOOL_ARGUMENTS) op: Equal rhs: {(DQ (executable))} spids: [91] ) ] spids: [89] ) (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: [121] ) ] spids: [119] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:description) op:Equal rhs:{(DQ )} spids:[129])] spids: [127] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:section) op:Equal rhs:{(DQ (1))} spids:[136])] spids: [134] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:source) op:Equal rhs:{(DQ )} spids:[144])] spids: [142] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:versionCommand) op: Equal rhs: {(DQ (--version))} spids: [151] ) ] spids: [149] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:output) op: Equal rhs: {(/dev/stdout)} spids: [159] ) ] spids: [157] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:changeDir) op:Equal rhs:{(false)} spids:[165])] spids: [163] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:alternativeName) op: Equal rhs: {(DQ )} spids: [171] ) ] spids: [169] ) (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: [203 206 215 16777215] ) (case_arm pat_list: [{(-c)} {(--cd)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:changeDir) op: Equal rhs: {(true)} spids: [225] ) ] spids: [225] ) (C {(shift)}) ] spids: [219 222 232 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: [244 250] ) ) } spids: [242] ) ] spids: [242] ) (C {(shift)} {(2)}) ] spids: [236 239 259 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: [271 277] ) ) } spids: [269] ) ] spids: [269] ) (C {(shift)} {(2)}) ] spids: [263 266 286 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: [298 304] ) ) } spids: [296] ) ] spids: [296] ) (C {(shift)} {(2)}) ] spids: [290 293 313 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: [323] ) ] spids: [323] ) (C {(shift)} {(2)}) ] spids: [317 320 334 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: [346 352] ) ) } spids: [344] ) ] spids: [344] ) (C {(shift)} {(2)}) ] spids: [338 341 361 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: [373 379] ) ) } spids: [371] ) ] spids: [371] ) (C {(shift)} {(2)}) ] spids: [365 368 388 16777215] ) (case_arm pat_list: [{(-v)} {(--version)}] action: [(C {(k_version)}) (ControlFlow token:<ControlFlow_Exit exit>)] spids: [392 395 404 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: [416 422] ) ) } spids: [414] ) ] spids: [414] ) (C {(shift)} {(2)}) ] spids: [408 411 431 16777215] ) (case_arm pat_list: [{(-) (Lit_Other '*')}] action: [ (SimpleCommand words: [{(echo)} {(DQ ('Unknown option: ') (${ VSub_Number 1))}] redirects: [ (Redir op_id: Redir_GreatAnd fd: 16777215 arg_word: {(2)} spids: [449] ) ] ) (C {(k_usage)}) (ControlFlow token: <ControlFlow_Exit exit> arg_word: {(1)} ) ] spids: [435 437 461 16777215] ) (case_arm pat_list: [{(--)}] action: [(C {(shift)}) (ControlFlow token:<ControlFlow_Break break>)] spids: [465 466 475 16777215] ) (case_arm pat_list: [{(Lit_Other '*')}] action: [(ControlFlow token:<ControlFlow_Break break>)] spids: [479 480 486 16777215] ) ] spids: [193 199 489] ) ] spids: [190 492] ) ) (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: [500 508] ) ) } spids: [498] ) ] spids: [496] ) (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: [516 526] ) ) } spids: [514] ) ] spids: [512] ) (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: [534 542] ) ) } spids: [532] ) ] spids: [530] ) (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: [548] ) ] spids: [546] ) (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: [569 571] ) ) } spids: [567] ) ] spids: [565] ) (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 591] ) (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: [615 648] ) ] spids: [16777215 672] ) (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: [710 718] ) ) } spids: [707] ) ] spids: [707] ) ] spids: [16777215 691] ) ] spids: [16777215 722] ) (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: [746 776] ) ) } spids: [744] ) ] spids: [744] ) ] spids: [16777215 741] ) ] spids: [16777215 780] ) (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: [797 811] ) ) } {(DQ (${ VSub_Name description))} ] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(DQ (${ VSub_Name tmpIncludeFile))} spids: [820] ) ] ) (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_id: Redir_DGreat fd: 16777215 arg_word: {(DQ (${ VSub_Name tmpIncludeFile))} spids: [855] ) ] ) ] spids: [16777215 844] ) ] spids: [16777215 864] ) (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_id: Redir_Great fd: 16777215 arg_word: {(${ VSub_Name output)} spids: [930] ) ] ) ] spids: [41] ) spids: [37 40] ) (C {(k_help2man)} {(DQ ($ VSub_At '$@'))}) ] )