(command.CommandList
  children: [
    (C {<Id.KW_Set set>} {<-e>})
    (command.ShFunction
      name: errexit
      body: 
        (BraceGroup
          children: [
            (C {<echo>} {(DQ ($ Id.VSub_Number '$1'))})
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
          ]
        )
    )
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (C {<Id.Lit_LBracket '['>} 
          {(DQ (command_sub left_token:<Id.Left_DollarParen '$('> child:(C {<uname>} {<-s>})))} {<Id.Lit_Equals '='> <Id.Lit_Equals '='>} {(DQ <Darwin>)} {<Id.Lit_RBracket ']'>}
        )
        (C {<errexit>} {(DQ <'This script can only be used on a Mac'>)})
      ]
    )
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (C {<Id.Lit_LBracket '['>} {($ Id.VSub_Pound '$#')} {<-eq>} {<1>} {<Id.Lit_RBracket ']'>})
        (C {<errexit>} {(DQ <'Usage: '> ($ Id.VSub_Number '$0') <' install|undo'>)})
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:BUNDLE)
          op: assign_op.Equal
          rhs: 
            {
              (DQ <'bundles/'> 
                (command_sub
                  left_token: <Id.Left_DollarParen '$('>
                  child: (C {<cat>} {<VERSION>})
                )
              )
            }
          spids: [79]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:BUNDLE_PATH)
          op: assign_op.Equal
          rhs: {(DQ ($ Id.VSub_DollarName '$PWD') <'/'> ($ Id.VSub_DollarName '$BUNDLE'))}
          spids: [89]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:CLIENT_PATH)
          op: assign_op.Equal
          rhs: {(DQ ($ Id.VSub_DollarName '$BUNDLE_PATH') <'/cross/darwin/amd64/docker'>)}
          spids: [96]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:DATABASE)
          op: assign_op.Equal
          rhs: 
            {
              (DQ ($ Id.VSub_DollarName '$HOME') 
                <'/Library/Containers/com.docker.docker/Data/database'>
              )
            }
          spids: [102]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:DATABASE_KEY)
          op: assign_op.Equal
          rhs: {(DQ ($ Id.VSub_DollarName '$DATABASE') <'/com.docker.driver.amd64-linux/bundle'>)}
          spids: [108]
        )
      ]
    )
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (C {<Id.Lit_LBracket '['>} {<-d>} {(DQ ($ Id.VSub_DollarName '$DATABASE'))} 
          {<Id.Lit_RBracket ']'>}
        )
        (C {<errexit>} {(DQ <'Docker for Mac must be installed for this script'>)})
      ]
    )
    (command.Case
      to_match: {(DQ ($ Id.VSub_Number '$1'))}
      arms: [
        (case_arm
          pat_list: [{(DQ <install>)}]
          action: [
            (command.AndOr
              ops: [Id.Op_DPipe]
              children: [
                (C {<Id.Lit_LBracket '['>} {<-d>} {(DQ ($ Id.VSub_DollarName '$BUNDLE'))} 
                  {<Id.Lit_RBracket ']'>}
                )
                (C {<errexit>} {(DQ <'cannot find bundle '> ($ Id.VSub_DollarName '$BUNDLE'))})
              ]
            )
            (command.AndOr
              ops: [Id.Op_DPipe]
              children: [
                (C {<Id.Lit_LBracket '['>} {<-e>} {(DQ ($ Id.VSub_DollarName '$CLIENT_PATH'))} 
                  {<Id.Lit_RBracket ']'>}
                )
                (C {<errexit>} {(DQ <'you need to run make cross first'>)})
              ]
            )
            (command.AndOr
              ops: [Id.Op_DPipe]
              children: [
                (C {<Id.Lit_LBracket '['>} {<-e>} 
                  {(DQ ($ Id.VSub_DollarName '$BUNDLE') <'/binary-daemon/dockerd'>)} {<Id.Lit_RBracket ']'>}
                )
                (C {<errexit>} {(DQ <'you need to build binaries first'>)})
              ]
            )
            (command.AndOr
              ops: [Id.Op_DPipe]
              children: [
                (C {<Id.Lit_LBracket '['>} {<-f>} 
                  {(DQ ($ Id.VSub_DollarName '$BUNDLE') <'/binary-client/docker'>)} {<Id.Lit_RBracket ']'>}
                )
                (C {<errexit>} {(DQ <'you need to build binaries first'>)})
              ]
            )
            (command.Simple
              words: [{<git>} {<-C>} {(DQ ($ Id.VSub_DollarName '$DATABASE'))} {<reset>} {<--hard>}]
              redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<'/dev/null'>})]
              do_fork: T
            )
            (command.Simple
              words: [{<echo>} {(DQ ($ Id.VSub_DollarName '$BUNDLE_PATH'))}]
              redirects: [
                (redir
                  op: <Id.Redir_Great '>'>
                  loc: (redir_loc.Fd fd:1)
                  arg: {(DQ ($ Id.VSub_DollarName '$DATABASE_KEY'))}
                )
              ]
              do_fork: T
            )
            (C {<git>} {<-C>} {(DQ ($ Id.VSub_DollarName '$DATABASE'))} {<add>} 
              {(DQ ($ Id.VSub_DollarName '$DATABASE_KEY'))}
            )
            (C {<git>} {<-C>} {(DQ ($ Id.VSub_DollarName '$DATABASE'))} {<commit>} {<-m>} 
              {(DQ <'update bundle to '> ($ Id.VSub_DollarName '$BUNDLE_PATH'))}
            )
            (C {<rm>} {<-f>} {<'/usr/local/bin/docker'>})
            (C {<cp>} {(DQ ($ Id.VSub_DollarName '$CLIENT_PATH'))} {<'/usr/local/bin'>})
            (C {<echo>} 
              {
                (DQ 
                  <
'Bundle installed. Restart Docker to use. To uninstall, reset Docker to factory defaults.'
                  >
                )
              }
            )
          ]
          spids: [142 145 312 -1]
        )
        (case_arm
          pat_list: [{(DQ <undo>)}]
          action: [
            (command.Simple
              words: [{<git>} {<-C>} {(DQ ($ Id.VSub_DollarName '$DATABASE'))} {<reset>} {<--hard>}]
              redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<'/dev/null'>})]
              do_fork: T
            )
            (command.AndOr
              ops: [Id.Op_DPipe]
              children: [
                (C {<Id.Lit_LBracket '['>} {<-f>} {(DQ ($ Id.VSub_DollarName '$DATABASE_KEY'))} 
                  {<Id.Lit_RBracket ']'>}
                )
                (C {<errexit>} {(DQ <'bundle not set'>)})
              ]
            )
            (C {<git>} {<-C>} {(DQ ($ Id.VSub_DollarName '$DATABASE'))} {<rm>} 
              {(DQ ($ Id.VSub_DollarName '$DATABASE_KEY'))}
            )
            (C {<git>} {<-C>} {(DQ ($ Id.VSub_DollarName '$DATABASE'))} {<commit>} {<-m>} 
              {(DQ <'remove bundle'>)}
            )
            (C {<rm>} {<-f>} {<'/usr/local/bin/docker'>})
            (C {<ln>} {<-s>} 
              {
                (DQ ($ Id.VSub_DollarName '$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: [314 317 413 -1]
        )
      ]
    )
  ]
)