(CommandList
  children: [
    (C {(set)} {(-e)})
    (FuncDef
      name: errexit
      body: 
        (BraceGroup
          children: [(C {(echo)} {(DQ ($ VSub_Number '$1'))}) (C {(exit)} {(1)})]
          spids: [13]
        )
      spids: [9 12]
    )
    (AndOr
      children: [
        (C {(Lit_Other '[')} 
          {
            (DQ 
              (CommandSubPart
                command_list: (CommandList children:[(C {(uname)} {(-s)})])
                left_token: <Left_CommandSub '$('>
                spids: [33 37]
              )
            )
          } {(Lit_Other '=') (Lit_Other '=')} {(DQ (Darwin))} {(Lit_Other ']')}
        )
        (C {(errexit)} {(DQ ('This script can only be used on a Mac'))})
      ]
      op_id: Op_DPipe
    )
    (AndOr
      children: [
        (C {(Lit_Other '[')} {($ VSub_Pound '$#')} {(-eq)} {(1)} {(Lit_Other ']')})
        (C {(errexit)} {(DQ ('Usage: ') ($ VSub_Number '$0') (' install|undo'))})
      ]
      op_id: Op_DPipe
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:BUNDLE)
          op: Equal
          rhs: 
            {
              (DQ (bundles/) 
                (CommandSubPart
                  command_list: (CommandList children:[(C {(cat)} {(VERSION)})])
                  left_token: <Left_CommandSub '$('>
                  spids: [82 86]
                )
              )
            }
          spids: [79]
        )
      ]
      spids: [79]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:BUNDLE_PATH)
          op: Equal
          rhs: {(DQ ($ VSub_Name '$PWD') (/) ($ VSub_Name '$BUNDLE'))}
          spids: [89]
        )
      ]
      spids: [89]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:CLIENT_PATH)
          op: Equal
          rhs: {(DQ ($ VSub_Name '$BUNDLE_PATH') (/cross/darwin/amd64/docker))}
          spids: [96]
        )
      ]
      spids: [96]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:DATABASE)
          op: Equal
          rhs: {(DQ ($ VSub_Name '$HOME') (/Library/Containers/com.docker.docker/Data/database))}
          spids: [102]
        )
      ]
      spids: [102]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:DATABASE_KEY)
          op: Equal
          rhs: {(DQ ($ VSub_Name '$DATABASE') (/com.docker.driver.amd64-linux/bundle))}
          spids: [108]
        )
      ]
      spids: [108]
    )
    (AndOr
      children: [
        (C {(Lit_Other '[')} {(-d)} {(DQ ($ VSub_Name '$DATABASE'))} {(Lit_Other ']')})
        (C {(errexit)} {(DQ ('Docker for Mac must be installed for this script'))})
      ]
      op_id: Op_DPipe
    )
    (Case
      to_match: {(DQ ($ VSub_Number '$1'))}
      arms: [
        (case_arm
          pat_list: [{(DQ (install))}]
          action: [
            (AndOr
              children: [
                (C {(Lit_Other '[')} {(-d)} {(DQ ($ VSub_Name '$BUNDLE'))} {(Lit_Other ']')})
                (C {(errexit)} {(DQ ('cannot find bundle ') ($ VSub_Name '$BUNDLE'))})
              ]
              op_id: Op_DPipe
            )
            (AndOr
              children: [
                (C {(Lit_Other '[')} {(-e)} {(DQ ($ VSub_Name '$CLIENT_PATH'))} {(Lit_Other ']')})
                (C {(errexit)} {(DQ ('you need to run make cross first'))})
              ]
              op_id: Op_DPipe
            )
            (AndOr
              children: [
                (C {(Lit_Other '[')} {(-e)} {(DQ ($ VSub_Name '$BUNDLE') (/binary-daemon/dockerd))} 
                  {(Lit_Other ']')}
                )
                (C {(errexit)} {(DQ ('you need to build binaries first'))})
              ]
              op_id: Op_DPipe
            )
            (AndOr
              children: [
                (C {(Lit_Other '[')} {(-f)} {(DQ ($ VSub_Name '$BUNDLE') (/binary-client/docker))} 
                  {(Lit_Other ']')}
                )
                (C {(errexit)} {(DQ ('you need to build binaries first'))})
              ]
              op_id: Op_DPipe
            )
            (SimpleCommand
              words: [{(git)} {(-C)} {(DQ ($ VSub_Name '$DATABASE'))} {(reset)} {(--hard)}]
              redirects: [(Redir op_id:Redir_Great fd:16777215 arg_word:{(/dev/null)} spids:[239])]
            )
            (SimpleCommand
              words: [{(echo)} {(DQ ($ VSub_Name '$BUNDLE_PATH'))}]
              redirects: [
                (Redir
                  op_id: Redir_Great
                  fd: 16777215
                  arg_word: {(DQ ($ VSub_Name '$DATABASE_KEY'))}
                  spids: [249]
                )
              ]
            )
            (C {(git)} {(-C)} {(DQ ($ VSub_Name '$DATABASE'))} {(add)} {(DQ ($ VSub_Name '$DATABASE_KEY'))})
            (C {(git)} {(-C)} {(DQ ($ VSub_Name '$DATABASE'))} {(commit)} {(-m)} 
              {(DQ ('update bundle to ') ($ VSub_Name '$BUNDLE_PATH'))}
            )
            (C {(rm)} {(-f)} {(/usr/local/bin/docker)})
            (C {(cp)} {(DQ ($ VSub_Name '$CLIENT_PATH'))} {(/usr/local/bin)})
            (C {(echo)} 
              {
                (DQ 
                  (
'Bundle installed. Restart Docker to use. To uninstall, reset Docker to factory defaults.'
                  )
                )
              }
            )
          ]
          spids: [143 145 312 16777215]
        )
        (case_arm
          pat_list: [{(DQ (undo))}]
          action: [
            (SimpleCommand
              words: [{(git)} {(-C)} {(DQ ($ VSub_Name '$DATABASE'))} {(reset)} {(--hard)}]
              redirects: [(Redir op_id:Redir_Great fd:16777215 arg_word:{(/dev/null)} spids:[332])]
            )
            (AndOr
              children: [
                (C {(Lit_Other '[')} {(-f)} {(DQ ($ VSub_Name '$DATABASE_KEY'))} {(Lit_Other ']')})
                (C {(errexit)} {(DQ ('bundle not set'))})
              ]
              op_id: Op_DPipe
            )
            (C {(git)} {(-C)} {(DQ ($ VSub_Name '$DATABASE'))} {(rm)} {(DQ ($ VSub_Name '$DATABASE_KEY'))})
            (C {(git)} {(-C)} {(DQ ($ VSub_Name '$DATABASE'))} {(commit)} {(-m)} {(DQ ('remove bundle'))})
            (C {(rm)} {(-f)} {(/usr/local/bin/docker)})
            (C {(ln)} {(-s)} 
              {(DQ ($ VSub_Name '$HOME') ('/Library/Group Containers/group.com.docker/bin/docker'))} {(/usr/local/bin)}
            )
            (C {(echo)} 
              {
                (DQ 
                  (
'Bundle removed. Using dev versions may cause issues, a reset to factory defaults is recommended.'
                  )
                )
              }
            )
          ]
          spids: [315 317 413 16777215]
        )
      ]
      spids: [134 140 415]
    )
  ]
)