(command.AndOr ops: [Op_DAmp] children: [ (command.FuncDef name: _pkgadd body: (command.BraceGroup children: [ (command.Assignment keyword: Assign_Local pairs: [ (assign_pair lhs:(lhs_expr.LhsName name:cur) op:Equal) (assign_pair lhs:(lhs_expr.LhsName name:prev) op:Equal) (assign_pair lhs:(lhs_expr.LhsName name:words) op:Equal) (assign_pair lhs:(lhs_expr.LhsName name:cword) op:Equal) ] ) (command.AndOr ops: [Op_DPipe] children: [ (C {(_init_completion)} {(-n)} {(Lit_Other ':')}) (command.ControlFlow token:<ControlFlow_Return return>) ] ) (command.Sentence child: (command.Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:device) op: Equal rhs: {(/var/spool/pkg)} ) ] ) terminator: <Op_Semi ';'> ) (command.Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:i) op: Equal rhs: {($ VSub_DollarName '$cword')} ) ] ) (command.Sentence child: (command.WhileUntil keyword: <KW_While while> cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.BoolBinary op_id: BoolBinary_gt left: { (word_part.ArithSubPart anode: (arith_expr.UnaryAssign op_id: Node_PostDMinus child: (lhs_expr.LhsName name:i) ) ) } right: {(0)} ) ) terminator: <Op_Semi ';'> ) ] body: (command.DoGroup children: [ (command.Sentence child: (command.Case to_match: { (DQ (word_part.BracedVarSub token: <VSub_Name words> bracket_op: (bracket_op.ArrayIndex expr: (arith_expr.ArithWord w:{($ VSub_DollarName '$i')}) ) ) ) } arms: [ (case_arm pat_list: [{(-d)}] action: [ (command.Sentence child: (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:device) op: Equal rhs: { (DQ (word_part.BracedVarSub token: <VSub_Name words> bracket_op: (bracket_op.ArrayIndex expr: (arith_expr.ArithWord w: { (word_part.ArithSubPart anode: (arith_expr.ArithBinary op_id: Arith_Plus left: (arith_expr.ArithVarRef token: <Lit_ArithVarLike i> ) right: (arith_expr.ArithWord w: {(Lit_Digits 1)} ) ) ) } ) ) ) ) } ) ] ) terminator: <Op_Semi ';'> ) (command.ControlFlow token: <ControlFlow_Break break> ) ] ) ] ) terminator: <Op_Semi ';'> ) ] ) ) terminator: <Op_Semi ';'> ) (command.Case to_match: {($ VSub_DollarName '$prev')} arms: [ (case_arm pat_list: [{(-d)}] action: [(C {(_filedir)} {(pkg)}) (C {(_filedir)} {(-d)})] ) (case_arm pat_list:[{(-a)} {(-r)} {(-V)}] action:[(C {(_filedir)})]) (case_arm pat_list: [{(-k)} {(-s)} {(-R)}] action: [(C {(_filedir)} {(-d)})] ) (case_arm pat_list:[{(-P)} {(-k)} {(-x)}]) (case_arm pat_list: [{(Lit_Other '*')}] action: [ (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.BoolBinary op_id: BoolBinary_GlobDEqual left: {(${ VSub_Name cur)} right: {(-) (Lit_Other '*')} ) ) terminator: <Op_Semi ';'> ) ] action: [ (command.Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:opts) op: Equal rhs: {(DQ ('-a -A -d -k -n -M -P -r -R -s -v -V -x'))} ) ] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:COMPREPLY) op: Equal rhs: { (word_part.ArrayLiteralPart words: [ { (word_part.CommandSubPart command_list: (command.CommandList children: [ (C {(compgen)} {(-W)} {(DQ (${ VSub_Name opts))} {(--)} {(${ VSub_Name cur)} ) ] ) left_token: <Left_CommandSub '$('> ) } ] ) } ) ] ) ] ) ] else_action: [ (command.Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(lhs_expr.LhsName name:pkginst_list) op:Equal)] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.BoolUnary op_id: BoolUnary_d child: {($ VSub_DollarName '$device')} ) ) terminator: <Op_Semi ';'> ) ] action: [ (command.ForEach iter_name: filedir iter_words: [ { (word_part.CommandSubPart command_list: (command.CommandList children: [ (C {(/bin/ls)} {(-1)} {($ VSub_DollarName '$device')}) ] ) left_token: <Left_CommandSub '$('> ) } ] do_arg_iter: F body: (command.DoGroup children: [ (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.AndOr ops: [Op_DAmp] children: [ (command.DBracket expr: (bool_expr.BoolUnary op_id: BoolUnary_d child: { (DQ ($ VSub_DollarName '$device') (/) ($ VSub_DollarName '$filedir') ) } ) ) (command.DBracket expr: (bool_expr.BoolUnary op_id: BoolUnary_f child: { (DQ ($ VSub_DollarName '$device') (/) ($ VSub_DollarName '$filedir') (/pkginfo) ) } ) ) ] ) terminator: <Op_Semi ';'> ) ] action: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:pkginst_list) op: PlusEqual rhs: { (word_part.ArrayLiteralPart words: [ { (word_part.BracedVarSub token: <VSub_Name pkginst_list> bracket_op: (bracket_op.WholeArray op_id: Lit_At ) suffix_op: (suffix_op.StringUnary op_id: VTest_ColonHyphen arg_word: {} ) ) } {(DQ ($ VSub_DollarName '$filedir'))} ] ) } ) ] ) ] ) ] ) ] ) ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:pkginst_list) op: Equal rhs: { (DQ (word_part.BracedVarSub token: <VSub_Name pkginst_list> bracket_op: (bracket_op.WholeArray op_id:Lit_At) ) ) } ) ] ) ] ) ] else_action: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:pkginst_list) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(strings)} { (word_part.CommandSubPart command_list: (command.CommandList children: [ (C {(dequote)} {($ VSub_DollarName '$device')} ) ] ) left_token: <Left_CommandSub '$('> ) } ) (C {(command)} {(grep)} {(DQ ('^PKG='))}) (C {(sort)} {(-u)}) (C {(cut)} {(-d) (Lit_Other '=')} {(-f2)}) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> ) } ) ] ) ] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:COMPREPLY) op: Equal rhs: { (word_part.ArrayLiteralPart words: [ { (word_part.CommandSubPart command_list: (command.CommandList children: [ (C {(compgen)} {(-W)} {(DQ ($ VSub_DollarName '$pkginst_list'))} {(--)} {(${ VSub_Name cur)} ) ] ) left_token: <Left_CommandSub '$('> ) } ] ) } ) ] ) ] ) ] ) ] ) ] ) ) (C {(complete)} {(-F)} {(_pkgadd)} {(pkgadd)}) ] )