(CommandList
  children: [
    (AndOr
      children: [
        (FuncDef
          name: _portupgrade
          body: 
            (BraceGroup
              children: [
                (Assignment
                  keyword: Assign_Local
                  pairs: [
                    (assign_pair lhs:(LhsName name:cur) op:Equal spids:[13])
                    (assign_pair lhs:(LhsName name:prev) op:Equal spids:[15])
                    (assign_pair lhs:(LhsName name:words) op:Equal spids:[17])
                    (assign_pair lhs:(LhsName name:cword) op:Equal spids:[19])
                  ]
                  spids: [11]
                )
                (AndOr
                  children: [(C {(_init_completion)}) (ControlFlow token:<ControlFlow_Return return>)]
                  op_id: Op_DPipe
                )
                (AndOr
                  children: [
                    (DBracket
                      expr: 
                        (LogicalOr
                          left: 
                            (BoolBinary
                              op_id: BoolBinary_GlobDEqual
                              left: {(DQ ($ VSub_Name '$prev'))}
                              right: {(-l)}
                            )
                          right: 
                            (LogicalOr
                              left: 
                                (BoolBinary
                                  op_id: BoolBinary_GlobDEqual
                                  left: {(DQ ($ VSub_Name '$prev'))}
                                  right: {(BoolUnary_L -L)}
                                )
                              right: 
                                (BoolBinary
                                  op_id: BoolBinary_GlobDEqual
                                  left: {(DQ ($ VSub_Name '$prev'))}
                                  right: {(BoolUnary_o -o)}
                                )
                            )
                        )
                    )
                    (ControlFlow token:<ControlFlow_Return return> arg_word:{(0)})
                  ]
                  op_id: Op_DAmp
                )
                (Assignment
                  keyword: Assign_Local
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:pkgdir)
                      op: Equal
                      rhs: 
                        {
                          (BracedVarSub
                            token: <VSub_Name PKG_DBDIR>
                            suffix_op: 
                              (StringUnary
                                op_id: VTest_ColonHyphen
                                arg_word: {(Lit_Slash /) (var) (Lit_Slash /) (db) (Lit_Slash /) (pkg)}
                              )
                            spids: [73 82]
                          ) (/)
                        }
                      spids: [72]
                    )
                  ]
                  spids: [70]
                )
                (Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:COMPREPLY)
                      op: Equal
                      rhs: 
                        {
                          (ArrayLiteralPart
                            words: [
                              {
                                (CommandSubPart
                                  command_list: 
                                    (CommandList
                                      children: [
                                        (C {(compgen)} {(-d)} {(--)} 
                                          {(DQ ($ VSub_Name '$pkgdir') ($ VSub_Name '$cur'))}
                                        )
                                      ]
                                    )
                                  left_token: <Left_CommandSub '$('>
                                  spids: [90 103]
                                )
                              }
                            ]
                          )
                        }
                      spids: [87]
                    )
                  ]
                  spids: [87]
                )
                (Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:COMPREPLY)
                      op: Equal
                      rhs: 
                        {
                          (ArrayLiteralPart
                            words: [
                              {
                                (BracedVarSub
                                  token: <VSub_Name COMPREPLY>
                                  bracket_op: (WholeArray op_id:Lit_At)
                                  suffix_op: 
                                    (StringUnary
                                      op_id: VOp1_Pound
                                      arg_word: {($ VSub_Name '$pkgdir')}
                                    )
                                  spids: [111 118]
                                )
                              }
                            ]
                          )
                        }
                      spids: [108]
                    )
                  ]
                  spids: [108]
                )
                (Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:COMPREPLY)
                      op: Equal
                      rhs: 
                        {
                          (ArrayLiteralPart
                            words: [
                              {
                                (BracedVarSub
                                  token: <VSub_Name COMPREPLY>
                                  bracket_op: (WholeArray op_id:Lit_At)
                                  suffix_op: (StringUnary op_id:VOp1_Percent arg_word:{('-*')})
                                  spids: [126 133]
                                )
                              }
                            ]
                          )
                        }
                      spids: [123]
                    )
                  ]
                  spids: [123]
                )
                (ControlFlow token:<ControlFlow_Return return> arg_word:{(0)})
              ]
              spids: [8]
            )
          spids: [4 7]
        )
        (C {(complete)} {(-F)} {(_portupgrade)} {(-o)} {(dirnames)} {(portupgrade)})
      ]
      op_id: Op_DAmp
    )
  ]
)