(command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp] children: [ (C {(_have)} {(pkg-get)}) (command.ShFunction name: _pkg-get_get_catalog_file body: (command.BraceGroup children: [ (C {(local)} {(Id.Lit_VarLike 'url=') (DQ ($ Id.VSub_Number '$1'))}) (C {(local)} {(catalog_file)} {(i)} {(conffile)}) (command.ForEach iter_name: file iter_words: [ {(/etc/opt/csw/pkg-get.conf)} {(/opt/csw/etc/pkg-get.conf)} {(/etc/pkg-get.conf)} ] do_arg_iter: F body: (command.DoGroup children: [ (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Unary op_id: Id.BoolUnary_f child: {($ Id.VSub_DollarName '$file')} ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:67) ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:conffile) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_DollarName '$file'))} spids: [72] ) ] ) (command.ControlFlow token: (Token id:Id.ControlFlow_Break val:break span_id:78) ) ] spids: [58 69] ) ] ) ] ) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:conffile) op: assign_op.Equal rhs: { (DQ (braced_var_sub token: (Token id:Id.VSub_Name val:conffile span_id:90) suffix_op: (suffix_op.Unary op_id: Id.VTest_ColonHyphen arg_word: {(Id.Lit_Slash /) (opt) (Id.Lit_Slash /) (csw) (Id.Lit_Slash /) (etc) (Id.Lit_Slash /) (pkg-get.conf) } ) ) ) } spids: [87] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Unary op_id: Id.BoolUnary_z child: {(DQ ($ Id.VSub_DollarName '$url'))} ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:116) ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:url) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:122) command_list: (command.CommandList children: [ (C {(awk)} {(-F) (Id.Lit_Equals '=')} { (SQ (Token id: Id.Lit_Chars val: ' $1=="url" { print $2 }' span_id: 129 ) ) } {($ Id.VSub_DollarName '$conffile')} ) ] ) ) } spids: [121] ) ] ) ] spids: [105 118] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:catalog_file) op: assign_op.Equal rhs: { (DQ (braced_var_sub token: (Token id:Id.VSub_Name val:url span_id:143) suffix_op: (suffix_op.Unary op_id: Id.VOp1_DPound arg_word: {('*') (Id.Lit_Slash /) (Id.Lit_Slash /)} ) ) ) } spids: [140] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:catalog_file) op: assign_op.Equal rhs: { (DQ (braced_var_sub token: (Token id:Id.VSub_Name val:catalog_file span_id:155) suffix_op: (suffix_op.Unary op_id: Id.VOp1_DPercent arg_word: {(Id.Lit_Slash /) ('*')} ) ) ) } spids: [152] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:catalog_file) op: assign_op.Equal rhs: {(DQ (/var/pkg-get/catalog-) ($ Id.VSub_DollarName '$catalog_file'))} spids: [163] ) ] ) (C {(echo)} {(DQ ($ Id.VSub_DollarName '$catalog_file'))}) ] ) ) (command.ShFunction name: _pkg-get body: (command.BraceGroup children: [ (C {(local)} {(cur)} {(prev)} {(file)} {(catalog_file)} {(url)} {(command)}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:COMPREPLY) op: assign_op.Equal rhs: {(sh_array_literal left:(Token id:Id.Op_LParen val:'(' span_id:204))} spids: [203] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:cur) op: assign_op.Equal rhs: { (DQ (braced_var_sub token: (Token id:Id.VSub_Name val:COMP_WORDS span_id:211) bracket_op: (bracket_op.ArrayIndex expr: (arith_expr.VarRef token: (Token id:Id.Lit_ArithVarLike val:COMP_CWORD span_id:213) ) ) ) ) } spids: [208] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:prev) op: assign_op.Equal rhs: { (DQ (braced_var_sub token: (Token id:Id.VSub_Name val:COMP_WORDS span_id:222) bracket_op: (bracket_op.ArrayIndex expr: (arith_expr.Binary op_id: Id.Arith_Minus left: (arith_expr.VarRef token: (Token id: Id.Lit_ArithVarLike val: COMP_CWORD span_id: 224 ) ) right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)}) ) ) ) ) } spids: [219] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobDEqual left: {(DQ (${ Id.VSub_Name prev))} right: {(DQ (-s))} ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:250) ) ] action: [ (command.ControlFlow token: (Token id:Id.ControlFlow_Return val:return span_id:255) arg_word: {(1)} ) ] spids: [233 252] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:i) op: assign_op.Equal rhs: { (braced_var_sub token: (Token id:Id.VSub_Name val:COMP_WORDS span_id:267) prefix_op: (Id.VSub_Pound) bracket_op: (bracket_op.WholeArray op_id:Id.Arith_Star) ) } spids: [264] ) ] ) (command.WhileUntil keyword: (Token id:Id.KW_While val:while span_id:275) cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_gt left: {($ Id.VSub_DollarName '$i')} right: {(0)} ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:286) ) ] body: (command.DoGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:i) op: assign_op.Equal rhs: { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Minus left: (arith_expr.VarRef token: (Token id:Id.Lit_ArithVarLike val:i span_id:293) ) right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)}) ) ) } spids: [291] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobDEqual left: { (DQ (braced_var_sub token: (Token id: Id.VSub_Name val: COMP_WORDS span_id: 306 ) bracket_op: (bracket_op.ArrayIndex expr: (arith_expr.ArithWord w: {($ Id.VSub_DollarName '$i')} ) ) ) ) } right: {(Id.BoolUnary_s -s)} ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:318) ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:url) op: assign_op.Equal rhs: { (DQ (braced_var_sub token: (Token id:Id.VSub_Name val:COMP_WORDS span_id:326) bracket_op: (bracket_op.ArrayIndex expr: (arith_expr.ArithWord w: { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Plus left: (arith_expr.VarRef token: (Token id: Id.Lit_ArithVarLike val: i span_id: 329 ) ) right: (arith_expr.ArithWord w: {(Id.Lit_Digits 1)} ) ) ) } ) ) ) ) } spids: [323] ) ] ) ] spids: [300 320] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobDEqual left: { (DQ (braced_var_sub token: (Token id: Id.VSub_Name val: COMP_WORDS span_id: 348 ) bracket_op: (bracket_op.ArrayIndex expr: (arith_expr.ArithWord w: {($ Id.VSub_DollarName '$i')} ) ) ) ) } right: { (word_part.ExtGlob op: (Token id:Id.ExtGlob_At val:'@(' span_id:357) arms: [ {('-[aDdiUu]')} {(available)} {(describe)} {(download)} {(install)} {(list)} {(updatecatalog)} {(upgrade)} ] ) } ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:376) ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:command) op: assign_op.Equal rhs: { (DQ (braced_var_sub token: (Token id:Id.VSub_Name val:COMP_WORDS span_id:384) bracket_op: (bracket_op.ArrayIndex expr: (arith_expr.ArithWord w: {($ Id.VSub_DollarName '$i')} ) ) ) ) } spids: [381] ) ] ) ] spids: [342 378] ) ] ) ] ) ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Unary op_id: Id.BoolUnary_n child: {(DQ ($ Id.VSub_DollarName '$command'))} ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:410) ) ] action: [ (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobDEqual left: {(DQ ($ Id.VSub_DollarName '$command'))} right: { (word_part.ExtGlob op: (Token id:Id.ExtGlob_At val:'@(' span_id:425) arms: [{('-[Ddi]')} {(describe)} {(download)} {(install)}] ) } ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:436) ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:catalog_file) op: assign_op.Equal rhs: { (command_sub left_token: (Token id: Id.Left_DollarParen val: '$(' span_id: 442 ) command_list: (command.CommandList children: [ (C {(_pkg-get_get_catalog_file)} {(DQ ($ Id.VSub_DollarName '$url'))} ) ] ) ) } spids: [441] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Unary op_id: Id.BoolUnary_f child: {($ Id.VSub_DollarName '$catalog_file')} ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:460) ) ] action: [ (C {(local)} {(Id.Lit_VarLike 'packages_list=') (command_sub left_token: (Token id: Id.Left_DollarParen val: '$(' span_id: 468 ) command_list: (command.CommandList children: [ (C {(awk)} { (SQ (Token id: Id.Lit_Chars val: ' $0 ~ /BEGIN PGP SIGNATURE/ { exit } $1 ~ /^Hash:/ || $1 ~ /^ *(-|#|$)/ { next } { print $1 }' span_id: 472 ) ) } {($ Id.VSub_DollarName '$catalog_file')} ) ] ) ) } ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:COMPREPLY) op: assign_op.Equal rhs: { (sh_array_literal left: (Token id:Id.Op_LParen val:'(' span_id:480) words: [ { (command_sub left_token: (Token id: Id.Left_DollarParen val: '$(' span_id: 482 ) command_list: (command.CommandList children: [ (C {(compgen)} {(-W)} {(DQ (${ Id.VSub_Name packages_list))} {(--)} {(${ Id.VSub_Name cur)} ) ] ) ) } ] ) } spids: [479] ) ] ) ] spids: [451 462] ) ] ) ] spids: [415 438] ) ] ) (command.ControlFlow token: (Token id:Id.ControlFlow_Return val:return span_id:509) arg_word: {(0)} ) ] spids: [399 412] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobDEqual left: {(${ Id.VSub_Name cur)} right: {(-) (Id.Lit_Other '*')} ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:533) ) ] action: [ (C {(local)} {(Id.Lit_VarLike 'opts=') (DQ ('-c -d -D -f -i -l -s -S -u -U -v'))}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:COMPREPLY) op: assign_op.Equal rhs: { (sh_array_literal left: (Token id:Id.Op_LParen val:'(' span_id:547) words: [ { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:549) command_list: (command.CommandList children: [ (C {(compgen)} {(-W)} {(DQ (${ Id.VSub_Name opts))} {(--)} {(${ Id.VSub_Name cur)} ) ] ) ) } ] ) } spids: [546] ) ] ) (command.ControlFlow token: (Token id:Id.ControlFlow_Return val:return span_id:570) arg_word: {(0)} ) ] spids: [518 535] ) ] else_action: [ (C {(local)} {(Id.Lit_VarLike 'commands=') (DQ ('available describe download install list ') (' updatecatalog upgrade') ) } ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:COMPREPLY) op: assign_op.Equal rhs: { (sh_array_literal left: (Token id:Id.Op_LParen val:'(' span_id:589) words: [ { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:591) command_list: (command.CommandList children: [ (C {(compgen)} {(-W)} {(DQ (${ Id.VSub_Name commands))} {(--)} {(${ Id.VSub_Name cur)} ) ] ) ) } ] ) } spids: [588] ) ] ) (command.ControlFlow token: (Token id:Id.ControlFlow_Return val:return span_id:612) arg_word: {(0)} ) ] ) ] ) ) (C {(complete)} {(-F)} {(_pkg-get)} {(pkg-get)}) ] )