(CommandList
  children: [
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:currentVersion) op:Equal rhs:{(DQ (1.11.1))} spids:[7])]
      spids: [7]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:configuredClient) op:Equal rhs:{(DQ )} spids:[12])]
      spids: [12]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:private) op:Equal rhs:{(DQ (0))} spids:[16])]
      spids: [16]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:all) op:Equal rhs:{(DQ (0))} spids:[24])]
      spids: [24]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: (C {(Lit_Other '[')} {(-d)} {(TildeSubPart prefix:'') (/temp)} {(Lit_Other ']')})
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (Sentence
              child: (C {(rm)} {(-rf)} {(TildeSubPart prefix:'') (/temp)})
              terminator: <Op_Semi ';'>
            )
          ]
          spids: [-1 43]
        )
      ]
      spids: [-1 53]
    )
    (FuncDef
      name: getConfiguredClient
      body: 
        (BraceGroup
          children: [
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: (C {(command)} {(-v)} {(curl)})
                      terminator: <Op_Amp '&'>
                    )
                    (Sentence
                      child: 
                        (SimpleCommand
                          redirects: [
                            (Redir
                              op_id: Redir_Great
                              fd: -1
                              arg_word: {(/dev/null)}
                              spids: [79]
                            )
                          ]
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:configuredClient)
                          op: Equal
                          rhs: {(DQ (curl))}
                          spids: [87]
                        )
                      ]
                      spids: [87]
                    )
                  ]
                  spids: [-1 84]
                )
                (if_arm
                  cond: [
                    (Sentence
                      child: (C {(command)} {(-v)} {(wget)})
                      terminator: <Op_Amp '&'>
                    )
                    (Sentence
                      child: 
                        (SimpleCommand
                          redirects: [
                            (Redir
                              op_id: Redir_Great
                              fd: -1
                              arg_word: {(/dev/null)}
                              spids: [102]
                            )
                          ]
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:configuredClient)
                          op: Equal
                          rhs: {(DQ (wget))}
                          spids: [110]
                        )
                      ]
                      spids: [110]
                    )
                  ]
                  spids: [93 107]
                )
                (if_arm
                  cond: [
                    (Sentence
                      child: (C {(command)} {(-v)} {(fetch)})
                      terminator: <Op_Amp '&'>
                    )
                    (Sentence
                      child: 
                        (SimpleCommand
                          redirects: [
                            (Redir
                              op_id: Redir_Great
                              fd: -1
                              arg_word: {(/dev/null)}
                              spids: [125]
                            )
                          ]
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:configuredClient)
                          op: Equal
                          rhs: {(DQ (fetch))}
                          spids: [133]
                        )
                      ]
                      spids: [133]
                    )
                  ]
                  spids: [116 130]
                )
              ]
              else_action: [
                (C {(echo)} 
                  {(DQ ('Error: This tool reqires either curl, wget, or fetch to be installed.'))}
                )
                (ControlFlow token:<ControlFlow_Return return> arg_word:{(1)})
              ]
              spids: [139 154]
            )
          ]
          spids: [67]
        )
      spids: [63 66]
    )
    (FuncDef
      name: checkInternet
      body: 
        (BraceGroup
          children: [
            (Pipeline
              children: [
                (C {(echo)} {(-e)} 
                  {
                    (DQ ('GET http://google.com HTTP/1.0') 
                      (EscapedLiteralPart token:<Lit_EscapedChar '\\n'>) (EscapedLiteralPart token:<Lit_EscapedChar '\\n'>)
                    )
                  }
                )
                (SimpleCommand
                  words: [{(nc)} {(google.com)} {(80)}]
                  redirects: [
                    (Redir
                      op_id: Redir_Great
                      fd: -1
                      arg_word: {(/dev/null)}
                      spids: [185]
                    )
                    (Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[189])
                  ]
                )
              ]
              negated: False
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (C {(Lit_Other '[')} {($ VSub_QMark '$?')} {(-eq)} {(0)} {(Lit_Other ']')})
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [(ControlFlow token:<ControlFlow_Return return> arg_word:{(0)})]
                  spids: [-1 209]
                )
              ]
              else_action: [
                (SimpleCommand
                  words: [{(echo)} {(DQ ('Error: no active internet connection'))}]
                  redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[229])]
                )
                (ControlFlow token:<ControlFlow_Return return> arg_word:{(1)})
              ]
              spids: [220 241]
            )
          ]
          spids: [164]
        )
      spids: [160 163]
    )
    (FuncDef
      name: httpGet
      body: 
        (BraceGroup
          children: [
            (Case
              to_match: {(DQ ($ VSub_Name '$configuredClient'))}
              arms: [
                (case_arm
                  pat_list: [{(curl)}]
                  action: [(C {(curl)} {(-A)} {(curl)} {(-s)} {(DQ ($ VSub_At '$@'))})]
                  spids: [265 266 279 -1]
                )
                (case_arm
                  pat_list: [{(wget)}]
                  action: [(C {(wget)} {(-qO-)} {(DQ ($ VSub_At '$@'))})]
                  spids: [282 283 292 -1]
                )
                (case_arm
                  pat_list: [{(fetch)}]
                  action: [(C {(fetch)} {(-o)} {(DQ (...))})]
                  spids: [295 296 305 -1]
                )
              ]
              spids: [256 262 308]
            )
          ]
          spids: [253]
        )
      spids: [249 252]
    )
    (FuncDef
      name: update
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:repositoryName)
                  op: Equal
                  rhs: {(DQ (Bash-Snippets))}
                  spids: [333]
                )
              ]
              spids: [333]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:githubUserName)
                  op: Equal
                  rhs: {(DQ (alexanderepstein))}
                  spids: [342]
                )
              ]
              spids: [342]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:nameOfInstallFile)
                  op: Equal
                  rhs: {(DQ (install.sh))}
                  spids: [351]
                )
              ]
              spids: [351]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:latestVersion)
                  op: Equal
                  rhs: 
                    {
                      (CommandSubPart
                        command_list: 
                          (CommandList
                            children: [
                              (Pipeline
                                children: [
                                  (C {(httpGet)} 
                                    {(https) (Lit_Other ':') (//api.github.com/repos/) 
                                      ($ VSub_Name '$githubUserName') (/) ($ VSub_Name '$repositoryName') (/tags)
                                    }
                                  )
                                  (C {(grep)} {(-Eo)} {(SQ <'"name":.*?[^\\\\]",'>)})
                                  (C {(head)} {(-1)})
                                  (C {(grep)} {(-Eo)} {(DQ ('[0-9.]+'))})
                                ]
                                negated: False
                              )
                            ]
                          )
                        left_token: <Left_CommandSub '$('>
                        spids: [361 397]
                      )
                    }
                  spids: [360]
                )
              ]
              spids: [360]
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: 
                            (LogicalOr
                              left: 
                                (BoolBinary
                                  op_id: BoolBinary_GlobDEqual
                                  left: {($ VSub_Name '$currentVersion')}
                                  right: {(DQ )}
                                )
                              right: 
                                (LogicalOr
                                  left: 
                                    (BoolBinary
                                      op_id: BoolBinary_GlobDEqual
                                      left: {($ VSub_Name '$repositoryName')}
                                      right: {(DQ )}
                                    )
                                  right: 
                                    (LogicalOr
                                      left: 
                                        (BoolBinary
                                          op_id: BoolBinary_GlobDEqual
                                          left: {($ VSub_Name '$githubUserName')}
                                          right: {(DQ )}
                                        )
                                      right: 
                                        (BoolBinary
                                          op_id: BoolBinary_GlobDEqual
                                          left: {($ VSub_Name '$nameOfInstallFile')}
                                          right: {(DQ )}
                                        )
                                    )
                                )
                            )
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (SimpleCommand
                      words: [
                        {(echo)}
                        {(DQ ('Error: update utility has not been configured correctly.'))}
                      ]
                      redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[453])]
                    )
                    (C {(exit)} {(1)})
                  ]
                  spids: [-1 444]
                )
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: 
                            (BoolBinary
                              op_id: BoolBinary_GlobDEqual
                              left: {($ VSub_Name '$latestVersion')}
                              right: {(DQ )}
                            )
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (SimpleCommand
                      words: [{(echo)} {(DQ ('Error: no active internet connection'))}]
                      redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[484])]
                    )
                    (C {(exit)} {(1)})
                  ]
                  spids: [462 475]
                )
              ]
              else_action: [
                (If
                  arms: [
                    (if_arm
                      cond: [
                        (Sentence
                          child: 
                            (DBracket
                              expr: 
                                (BoolBinary
                                  op_id: BoolBinary_GlobNEqual
                                  left: {(DQ ($ VSub_Name '$latestVersion'))}
                                  right: {(DQ ($ VSub_Name '$currentVersion'))}
                                )
                            )
                          terminator: <Op_Semi ';'>
                        )
                      ]
                      action: [
                        (C {(echo)} {(DQ ('Version ') ($ VSub_Name '$latestVersion') (' available'))})
                        (C {(echo)} {(-n)} 
                          {
                            (DQ ('Do you wish to update ') ($ VSub_Name '$repositoryName') (' [Y/n]: '))
                          }
                        )
                        (C {(read)} {(-r)} {(answer)})
                        (If
                          arms: [
                            (if_arm
                              cond: [
                                (Sentence
                                  child: 
                                    (DBracket
                                      expr: 
                                        (LogicalOr
                                          left: 
                                            (BoolBinary
                                              op_id: BoolBinary_GlobDEqual
                                              left: {(DQ ($ VSub_Name '$answer'))}
                                              right: {(DQ (Y))}
                                            )
                                          right: 
                                            (BoolBinary
                                              op_id: BoolBinary_GlobDEqual
                                              left: {(DQ ($ VSub_Name '$answer'))}
                                              right: {(DQ (y))}
                                            )
                                        )
                                    )
                                  terminator: <Op_Semi ';'>
                                )
                              ]
                              action: [
                                (AndOr
                                  children: [
                                    (C {(cd)} {(TildeSubPart prefix:'')})
                                    (BraceGroup
                                      children: [
                                        (Sentence
                                          child: (C {(echo)} {(SQ <'Update Failed'>)})
                                          terminator: <Op_Semi ';'>
                                        )
                                        (Sentence
                                          child: (C {(exit)} {(1)})
                                          terminator: <Op_Semi ';'>
                                        )
                                      ]
                                      spids: [581]
                                    )
                                  ]
                                  op_id: Op_DPipe
                                )
                                (If
                                  arms: [
                                    (if_arm
                                      cond: [
                                        (Sentence
                                          child: 
                                            (DBracket
                                              expr: 
                                                (BoolUnary
                                                  op_id: BoolUnary_d
                                                  child: 
                                                    {(Lit_Tilde '~') (/) 
                                                      ($ VSub_Name '$repositoryName')
                                                    }
                                                )
                                            )
                                          terminator: <Op_Semi ';'>
                                        )
                                      ]
                                      action: [
                                        (Sentence
                                          child: 
                                            (AndOr
                                              children: [
                                                (C {(rm)} {(-r)} {(-f)} {($ VSub_Name '$repositoryName')})
                                                (BraceGroup
                                                  children: [
                                                    (Sentence
                                                      child: 
                                                        (C {(echo)} 
                                                          {
                                                            (DQ 
                                                              (
'Permissions Error: try running the update as sudo'
                                                              )
                                                            )
                                                          }
                                                        )
                                                      terminator: <Op_Semi ';'>
                                                    )
                                                    (Sentence
                                                      child: (C {(exit)} {(1)})
                                                      terminator: <Op_Semi ';'>
                                                    )
                                                  ]
                                                  spids: [625]
                                                )
                                              ]
                                              op_id: Op_DPipe
                                            )
                                          terminator: <Op_Semi ';'>
                                        )
                                      ]
                                      spids: [-1 613]
                                    )
                                  ]
                                  spids: [-1 643]
                                )
                                (AndOr
                                  children: [
                                    (C {(git)} {(clone)} 
                                      {
                                        (DQ ('https://github.com/') ($ VSub_Name '$githubUserName') (/) 
                                          ($ VSub_Name '$repositoryName')
                                        )
                                      }
                                    )
                                    (BraceGroup
                                      children: [
                                        (Sentence
                                          child: 
                                            (C {(echo)} {(DQ ("Couldn't download latest version"))})
                                          terminator: <Op_Semi ';'>
                                        )
                                        (Sentence
                                          child: (C {(exit)} {(1)})
                                          terminator: <Op_Semi ';'>
                                        )
                                      ]
                                      spids: [659]
                                    )
                                  ]
                                  op_id: Op_DPipe
                                )
                                (AndOr
                                  children: [
                                    (C {(cd)} {($ VSub_Name '$repositoryName')})
                                    (BraceGroup
                                      children: [
                                        (Sentence
                                          child: (C {(echo)} {(SQ <'Update Failed'>)})
                                          terminator: <Op_Semi ';'>
                                        )
                                        (Sentence
                                          child: (C {(exit)} {(1)})
                                          terminator: <Op_Semi ';'>
                                        )
                                      ]
                                      spids: [683]
                                    )
                                  ]
                                  op_id: Op_DPipe
                                )
                                (AndOr
                                  children: [
                                    (SimpleCommand
                                      words: [
                                        {(git)}
                                        {(checkout)}
                                        {(DQ (v) ($ VSub_Name '$latestVersion'))}
                                      ]
                                      redirects: [
                                        (Redir
                                          op_id: Redir_Great
                                          fd: 2
                                          arg_word: {(/dev/null)}
                                          spids: [710]
                                        )
                                      ]
                                    )
                                    (AndOr
                                      children: [
                                        (SimpleCommand
                                          words: [
                                            {(git)}
                                            {(checkout)}
                                            {(DQ ($ VSub_Name '$latestVersion'))}
                                          ]
                                          redirects: [
                                            (Redir
                                              op_id: Redir_Great
                                              fd: 2
                                              arg_word: {(/dev/null)}
                                              spids: [724]
                                            )
                                          ]
                                        )
                                        (C {(echo)} 
                                          {
                                            (DQ 
                                              (
"Couldn't git checkout to stable release, updating to latest commit."
                                              )
                                            )
                                          }
                                        )
                                      ]
                                      op_id: Op_DPipe
                                    )
                                  ]
                                  op_id: Op_DPipe
                                )
                                (C {(chmod)} {(a) (Lit_Other '+') (x)} {(install.sh)})
                                (AndOr
                                  children: [
                                    (C {(./) ($ VSub_Name '$nameOfInstallFile')} {(DQ (update))})
                                    (C {(exit)} {(1)})
                                  ]
                                  op_id: Op_DPipe
                                )
                                (C {(cd)} {(..)})
                                (AndOr
                                  children: [
                                    (C {(rm)} {(-r)} {(-f)} {($ VSub_Name '$repositoryName')})
                                    (BraceGroup
                                      children: [
                                        (Sentence
                                          child: 
                                            (C {(echo)} 
                                              {
                                                (DQ 
                                                  (
'Permissions Error: update succesfull but cannot delete temp files located at ~/'
                                                  ) ($ VSub_Name '$repositoryName') (' delete this directory with sudo')
                                                )
                                              }
                                            )
                                          terminator: <Op_Semi ';'>
                                        )
                                        (Sentence
                                          child: (C {(exit)} {(1)})
                                          terminator: <Op_Semi ';'>
                                        )
                                      ]
                                      spids: [778]
                                    )
                                  ]
                                  op_id: Op_DPipe
                                )
                              ]
                              spids: [-1 572]
                            )
                          ]
                          else_action: [(C {(exit)} {(1)})]
                          spids: [797 805]
                        )
                      ]
                      spids: [-1 513]
                    )
                  ]
                  else_action: [
                    (C {(echo)} 
                      {(DQ ($ VSub_Name '$repositoryName') (' is already the latest version'))}
                    )
                  ]
                  spids: [808 819]
                )
              ]
              spids: [493 822]
            )
          ]
          spids: [318]
        )
      spids: [314 317]
    )
    (FuncDef
      name: getBitbucketInfo
      body: 
        (BraceGroup
          children: [
            (C {(echo)} {(-n)} {(SQ <'Enter your Bitbucket username: '>)})
            (C {(read)} {(bbUsername)})
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: 
                            (BoolBinary
                              op_id: BoolBinary_GlobDEqual
                              left: {($ VSub_Name '$bbUsername')}
                              right: {(DQ (1))}
                            )
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [(C {(echo)} {(DQ ('Using github username as bitbucket username'))})]
                  spids: [-1 866]
                )
              ]
              spids: [-1 876]
            )
            (C {(echo)} {(-n)} {(SQ <'Enter your Bitbucket password: '>)})
            (C {(read)} {(-s)} {(password)})
          ]
          spids: [835]
        )
      spids: [831 834]
    )
    (FuncDef
      name: backupRepo
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:timestamp)
                  op: Equal
                  rhs: 
                    {
                      (CommandSubPart
                        command_list: 
                          (CommandList
                            children: [
                              (Pipeline
                                children: [
                                  (C {(date)})
                                  (C {(tr)} {(DQ (' '))} {(_)})
                                  (C {(tr)} {(Lit_Other ':')} {(_)})
                                ]
                                negated: False
                              )
                            ]
                          )
                        left_token: <Left_CommandSub '$('>
                        spids: [908 929]
                      )
                    }
                  spids: [907]
                )
              ]
              spids: [907]
            )
            (AndOr
              children: [
                (C {(cd)} {(TildeSubPart prefix:'') (/temp/github/) ($ VSub_Name '$repoName')})
                (BraceGroup
                  children: [
                    (Sentence
                      child: (C {(echo)} {(DQ ('Fatal error'))})
                      terminator: <Op_Semi ';'>
                    )
                    (Sentence
                      child: (ControlFlow token:<ControlFlow_Return return> arg_word:{(1)})
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  spids: [943]
                )
              ]
              op_id: Op_DPipe
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: 
                            (BoolBinary
                              op_id: BoolBinary_GlobDEqual
                              left: {($ VSub_Name '$private')}
                              right: {(DQ (1))}
                            )
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (SimpleCommand
                      words: [
                        {(httpGet)}
                        {(--user)}
                        {($ VSub_Name '$bbUsername') (Lit_Other ':') ($ VSub_Name '$password')}
                        {(https) (Lit_Other ':') (//api.bitbucket.org/1.0/repositories/)}
                        {(--data)}
                        {(Lit_VarLike 'name=') ($ VSub_Name '$repoName') ($ VSub_Name '$timestamp')}
                        {(Lit_VarLike 'is_private=') (true)}
                      ]
                      redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[998])]
                    )
                    (C {(echo)} {(DQ (private))})
                  ]
                  spids: [-1 974]
                )
              ]
              else_action: [
                (SimpleCommand
                  words: [
                    {(httpGet)}
                    {(--user)}
                    {($ VSub_Name '$bbUsername') (Lit_Other ':') ($ VSub_Name '$password')}
                    {(https) (Lit_Other ':') (//api.bitbucket.org/1.0/repositories/)}
                    {(--data)}
                    {(Lit_VarLike 'name=') ($ VSub_Name '$repoName') ($ VSub_Name '$timestamp')}
                  ]
                  redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[1031])]
                )
              ]
              spids: [1010 1036]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:originalRepoName)
                  op: Equal
                  rhs: {($ VSub_Name '$repoName')}
                  spids: [1039]
                )
              ]
              spids: [1039]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:repoName)
                  op: Equal
                  rhs: 
                    {
                      (CommandSubPart
                        command_list: 
                          (CommandList
                            children: [
                              (Pipeline
                                children: [
                                  (C {(echo)} {($ VSub_Name '$repoName')})
                                  (C {(tr)} {(SQ <'[:upper:]'>)} {(SQ <'[:lower:]'>)})
                                ]
                                negated: False
                              )
                            ]
                          )
                        left_token: <Left_CommandSub '$('>
                        spids: [1044 1060]
                      )
                    }
                  spids: [1043]
                )
              ]
              spids: [1043]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:timestamp)
                  op: Equal
                  rhs: 
                    {
                      (CommandSubPart
                        command_list: 
                          (CommandList
                            children: [
                              (Pipeline
                                children: [
                                  (C {(echo)} {($ VSub_Name '$timestamp')})
                                  (C {(tr)} {(SQ <'[:upper:]'>)} {(SQ <'[:lower:]'>)})
                                ]
                                negated: False
                              )
                            ]
                          )
                        left_token: <Left_CommandSub '$('>
                        spids: [1064 1080]
                      )
                    }
                  spids: [1063]
                )
              ]
              spids: [1063]
            )
            (AndOr
              children: [
                (SimpleCommand
                  words: [
                    {(git)}
                    {(remote)}
                    {(set-url)}
                    {(origin)}
                    {(https) (Lit_Other ':') (//) ($ VSub_Name '$bbUsername') (Lit_Other ':') 
                      ($ VSub_Name '$password') (Lit_Other '@') (bitbucket.org/) ($ VSub_Name '$bbUsername') (/) ($ VSub_Name '$repoName') 
                      ($ VSub_Name '$timestamp') (.git)
                    }
                  ]
                  redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[1105])]
                )
                (ControlFlow token:<ControlFlow_Return return> arg_word:{(1)})
              ]
              op_id: Op_DPipe
            )
            (C {(echo)} {(DQ ('Uploading ') ($ VSub_Name '$originalRepoName') (' to bitbucket'))})
            (AndOr
              children: [
                (SimpleCommand
                  words: [{(git)} {(push)} {(-q)} {(--progress)} {(origin)} {(--all)}]
                  redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[1140])]
                )
                (ControlFlow token:<ControlFlow_Return return> arg_word:{(1)})
              ]
              op_id: Op_DPipe
            )
            (C {(echo)} {(DQ ('Uploading the tags for ') ($ VSub_Name '$originalRepoName'))})
            (AndOr
              children: [
                (SimpleCommand
                  words: [{(git)} {(push)} {(-q)} {(--progress)} {(origin)} {(--tags)}]
                  redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[1174])]
                )
                (ControlFlow token:<ControlFlow_Return return> arg_word:{(1)})
              ]
              op_id: Op_DPipe
            )
            (C {(echo)} {(DQ ('Successfully backedup ') ($ VSub_Name '$originalRepoName'))})
            (C {(rm)} {(-rf)} {(TildeSubPart prefix:'') (/temp)})
          ]
          spids: [904]
        )
      spids: [900 903]
    )
    (FuncDef
      name: getGitHubRepoInfo
      body: 
        (BraceGroup
          children: [
            (C {(echo)} {(-n)} {(SQ <'Enter the name of the repostiory to backup: '>)})
            (C {(read)} {(repoName)})
          ]
          spids: [1217]
        )
      spids: [1213 1216]
    )
    (FuncDef
      name: getGitHubUserInfo
      body: 
        (BraceGroup
          children: [
            (C {(echo)} {(-n)} {(SQ <'Enter your Github username: '>)})
            (C {(read)} {(ghUsername)})
          ]
          spids: [1243]
        )
      spids: [1239 1242]
    )
    (FuncDef
      name: cloneGitHubRepo
      body: 
        (BraceGroup
          children: [
            (C {(mkdir)} {(TildeSubPart prefix:'') (/temp)})
            (AndOr
              children: [
                (C {(cd)})
                (BraceGroup
                  children: [
                    (Sentence
                      child: (C {(echo)} {(DQ ('Fatal error'))})
                      terminator: <Op_Semi ';'>
                    )
                    (Sentence
                      child: (ControlFlow token:<ControlFlow_Return return> arg_word:{(1)})
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  spids: [1282]
                )
              ]
              op_id: Op_DPipe
            )
            (AndOr
              children: [
                (C {(mkdir)} {(TildeSubPart prefix:'') (/temp/github)})
                (BraceGroup
                  children: [
                    (Sentence
                      child: (C {(echo)} {(DQ ('Fatal error'))})
                      terminator: <Op_Semi ';'>
                    )
                    (Sentence
                      child: (ControlFlow token:<ControlFlow_Return return> arg_word:{(1)})
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  spids: [1306]
                )
              ]
              op_id: Op_DPipe
            )
            (AndOr
              children: [
                (C {(cd)} {(TildeSubPart prefix:'') (/temp/github)})
                (BraceGroup
                  children: [
                    (Sentence
                      child: (C {(echo)} {(DQ ('Fatal error'))})
                      terminator: <Op_Semi ';'>
                    )
                    (Sentence
                      child: (ControlFlow token:<ControlFlow_Return return> arg_word:{(1)})
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  spids: [1330]
                )
              ]
              op_id: Op_DPipe
            )
            (C {(echo)} {(DQ ('Cloning ') ($ VSub_Name '$repoName'))})
            (AndOr
              children: [
                (C {(git)} {(clone)} {(-q)} {(--progress)} 
                  {(https) (Lit_Other ':') (//github.com/) ($ VSub_Name '$ghUsername') (/) 
                    ($ VSub_Name '$repoName')
                  }
                )
                (ControlFlow token:<ControlFlow_Return return> arg_word:{(1)})
              ]
              op_id: Op_DPipe
            )
            (C {(echo)} {(DQ ('Successfully cloned ') ($ VSub_Name '$repoName'))})
          ]
          spids: [1269]
        )
      spids: [1265 1268]
    )
    (FuncDef
      name: getGithubRepoNames
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:response)
                  op: Equal
                  rhs: 
                    {
                      (CommandSubPart
                        command_list: 
                          (CommandList
                            children: [
                              (Pipeline
                                children: [
                                  (C {(httpGet)} 
                                    {
                                      (DQ ('https://api.github.com/users/') 
                                        ($ VSub_Name '$ghUsername') ('/repos?sort=updated&per_page=100')
                                      )
                                    }
                                  )
                                  (C {(grep)} {(-Eo)} {(SQ <'"name": "[ a-Z .  \\/ \\\\ 0-9 -- _ ]*'>)})
                                  (C {(sed)} {(s/) (SQ <'"name": "'>) (/) (DQ ) (/g)})
                                ]
                                negated: False
                              )
                            ]
                          )
                        left_token: <Left_CommandSub '$('>
                        spids: [1398 1429]
                      )
                    }
                  spids: [1397]
                )
              ]
              spids: [1397]
            )
            (ForEach
              iter_name: repo
              iter_words: [{($ VSub_Name '$response')}]
              do_arg_iter: False
              body: 
                (DoGroup
                  children: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:repoNames)
                          op: PlusEqual
                          rhs: {(ArrayLiteralPart words:[{(DQ ($ VSub_Name '$repo'))}])}
                          spids: [1444]
                        )
                      ]
                      spids: [1444]
                    )
                  ]
                  spids: [1441 1452]
                )
              spids: [1437 -1]
            )
          ]
          spids: [1394]
        )
      spids: [1390 1393]
    )
    (FuncDef
      name: usage
      body: 
        (BraceGroup
          children: [
            (C {(echo)} {(DQ (Cloudup))})
            (C {(echo)} 
              {(DQ ('Description: Backs up a users github repositories to your bitbucket account.'))}
            )
            (C {(echo)} 
              {
                (DQ ('  With no flags cloudup will guide you through backing up a single repository'))
              }
            )
            (C {(echo)} 
              {(DQ ('Usage: cloudup [flags] or cloudup [flags] [listOfGHRepoNamesSplitBySpaces]'))}
            )
            (C {(echo)} 
              {
                (DQ 
                  (
'  -p Upload the repositor(y)(ies) as private to bitbucket (must have private repo ability on bitbucket)'
                  )
                )
              }
            )
            (C {(echo)} {(DQ ('  -a Backup all github repositories'))})
            (C {(echo)} {(DQ ('  -u Update Bash-Snippet Tools'))})
            (C {(echo)} {(DQ ('  -h Show the help'))})
            (C {(echo)} {(DQ ('  -v Get the tool version'))})
            (C {(echo)} {(DQ ('Examples:'))})
            (C {(echo)} {(DQ ('   cloudup'))})
            (C {(echo)} {(DQ ('   cloudup -p -a'))})
            (C {(echo)} {(DQ ('   cloudup -p nameOfRepo1 nameOf Repo2'))})
            (C {(echo)} {(DQ ('   cloudup nameOfRepo'))})
          ]
          spids: [1461]
        )
      spids: [1457 1460]
    )
    (AndOr children:[(C {(getConfiguredClient)})(C {(exit)} {(1)})] op_id:Op_DPipe)
    (AndOr children:[(C {(checkInternet)})(C {(exit)} {(1)})] op_id:Op_DPipe)
    (While
      cond: [(Sentence child:(C {(getopts)} {(DQ (pauvh))} {(opt)}) terminator:<Op_Semi ';'>)]
      body: 
        (DoGroup
          children: [
            (Case
              to_match: {($ VSub_Name '$opt')}
              arms: [
                (case_arm
                  pat_list: [{(EscapedLiteralPart token:<Lit_EscapedChar '\\?'>)}]
                  action: [
                    (SimpleCommand
                      words: [{(echo)} {(DQ ('Invalid option: -') ($ VSub_Name '$OPTARG'))}]
                      redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[1613])]
                    )
                    (C {(exit)} {(1)})
                  ]
                  spids: [1602 1603 1622 -1]
                )
                (case_arm
                  pat_list: [{(p)}]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:private)
                          op: Equal
                          rhs: {(DQ (1))}
                          spids: [1629]
                        )
                      ]
                      spids: [1629]
                    )
                    (SimpleCommand
                      words: [
                        {(echo)}
                        {
                          (DQ 
                            (
'Feature not added yet, for now all backups must be public (can be manually set to private through bitbucket after backup)'
                            )
                          )
                        }
                      ]
                      redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[1641])]
                    )
                    (C {(exit)} {(0)})
                  ]
                  spids: [1625 1626 1650 -1]
                )
                (case_arm
                  pat_list: [{(h)}]
                  action: [(C {(usage)}) (C {(exit)} {(0)})]
                  spids: [1653 1654 1665 -1]
                )
                (case_arm
                  pat_list: [{(a)}]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:all)
                          op: Equal
                          rhs: {(DQ (1))}
                          spids: [1672]
                        )
                      ]
                      spids: [1672]
                    )
                  ]
                  spids: [1668 1669 1678 -1]
                )
                (case_arm
                  pat_list: [{(v)}]
                  action: [
                    (C {(echo)} {(DQ ('Version ') ($ VSub_Name '$currentVersion'))})
                    (C {(exit)} {(0)})
                  ]
                  spids: [1681 1682 1698 -1]
                )
                (case_arm
                  pat_list: [{(u)}]
                  action: [(C {(update)}) (C {(exit)} {(0)})]
                  spids: [1701 1702 1713 -1]
                )
                (case_arm
                  pat_list: [{(Lit_Other ':')}]
                  action: [
                    (SimpleCommand
                      words: [
                        {(echo)}
                        {(DQ ('Option -') ($ VSub_Name '$OPTARG') (' requires an argument.'))}
                      ]
                      redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[1728])]
                    )
                    (C {(exit)} {(1)})
                  ]
                  spids: [1716 1717 1737 -1]
                )
              ]
              spids: [1595 1599 1740]
            )
          ]
          spids: [1592 1742]
        )
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (DBracket
                  expr: 
                    (BoolBinary
                      op_id: BoolBinary_GlobDEqual
                      left: {($ VSub_Pound '$#')}
                      right: {(DQ (1))}
                    )
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: 
                            (BoolBinary
                              op_id: BoolBinary_GlobDEqual
                              left: {($ VSub_Number '$1')}
                              right: {(DQ (update))}
                            )
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [(C {(update)}) (C {(exit)} {(0)})]
                  spids: [-1 1779]
                )
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: 
                            (BoolBinary
                              op_id: BoolBinary_GlobDEqual
                              left: {($ VSub_Number '$1')}
                              right: {(DQ (help))}
                            )
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [(C {(usage)}) (C {(exit)} {(0)})]
                  spids: [1790 1805]
                )
              ]
              spids: [-1 1816]
            )
          ]
          spids: [-1 1762]
        )
        (if_arm
          cond: [
            (Sentence
              child: (C {(Lit_Other '[')} {($ VSub_Pound '$#')} {(-ge)} {(1)} {(Lit_Other ']')})
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (AndOr children:[(C {(getGitHubUserInfo)})(C {(exit)} {(1)})] op_id:Op_DPipe)
            (AndOr children:[(C {(getBitbucketInfo)})(C {(exit)} {(1)})] op_id:Op_DPipe)
            (C {(echo)})
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: 
                            (BoolBinary
                              op_id: BoolBinary_GlobNEqual
                              left: {($ VSub_Name '$private')}
                              right: {(DQ (1))}
                            )
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (ForEach
                      iter_name: i
                      iter_words: [{(DQ ($ VSub_At '$@'))}]
                      do_arg_iter: False
                      body: 
                        (DoGroup
                          children: [
                            (Assignment
                              keyword: Assign_None
                              pairs: [
                                (assign_pair
                                  lhs: (LhsName name:repoName)
                                  op: Equal
                                  rhs: {($ VSub_Name '$i')}
                                  spids: [1888]
                                )
                              ]
                              spids: [1888]
                            )
                            (C {(echo)} {(DQ ('Starting to backup ') ($ VSub_Name '$repoName'))})
                            (AndOr
                              children: [(C {(cloneGitHubRepo)}) (C {(exit)} {(1)})]
                              op_id: Op_DPipe
                            )
                            (AndOr
                              children: [
                                (C {(backupRepo)})
                                (BraceGroup
                                  children: [
                                    (Sentence
                                      child: 
                                        (C {(echo)} 
                                          {
                                            (DQ ('Error: couldnt backup ') 
                                              ($ VSub_Name '$originalRepoName') (' to bitbucket')
                                            )
                                          }
                                        )
                                      terminator: <Op_Semi ';'>
                                    )
                                    (Sentence
                                      child: (C {(exit)} {(1)})
                                      terminator: <Op_Semi ';'>
                                    )
                                  ]
                                  spids: [1913]
                                )
                              ]
                              op_id: Op_DPipe
                            )
                            (C {(echo)})
                          ]
                          spids: [1882 1935]
                        )
                      spids: [1876 1880]
                    )
                    (C {(exit)} {(0)})
                  ]
                  spids: [-1 1868]
                )
              ]
              else_action: [
                (ForEach
                  iter_name: i
                  iter_words: [
                    {
                      (DQ 
                        (BracedVarSub
                          token: <VSub_At '@'>
                          suffix_op: (Slice begin:(ArithWord w:{(Lit_Digits 2)}))
                          spids: [1953 1957]
                        )
                      )
                    }
                  ]
                  do_arg_iter: False
                  body: 
                    (DoGroup
                      children: [
                        (Assignment
                          keyword: Assign_None
                          pairs: [
                            (assign_pair
                              lhs: (LhsName name:repoName)
                              op: Equal
                              rhs: {($ VSub_Name '$i')}
                              spids: [1964]
                            )
                          ]
                          spids: [1964]
                        )
                        (C {(echo)} {(DQ ('Starting to backup ') ($ VSub_Name '$repoName'))})
                        (AndOr
                          children: [(C {(cloneGitHubRepo)}) (C {(exit)} {(1)})]
                          op_id: Op_DPipe
                        )
                        (AndOr
                          children: [
                            (C {(backupRepo)})
                            (BraceGroup
                              children: [
                                (Sentence
                                  child: 
                                    (C {(echo)} 
                                      {
                                        (DQ ('Error: couldnt backup ') 
                                          ($ VSub_Name '$originalRepoName') (' to bitbucket')
                                        )
                                      }
                                    )
                                  terminator: <Op_Semi ';'>
                                )
                                (Sentence
                                  child: (C {(exit)} {(1)})
                                  terminator: <Op_Semi ';'>
                                )
                              ]
                              spids: [1989]
                            )
                          ]
                          op_id: Op_DPipe
                        )
                        (C {(echo)})
                      ]
                      spids: [1961 2011]
                    )
                  spids: [1951 1959]
                )
                (C {(exit)} {(0)})
              ]
              spids: [1943 2019]
            )
          ]
          spids: [1818 1830]
        )
      ]
      spids: [-1 2021]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (DBracket
                  expr: 
                    (BoolBinary
                      op_id: BoolBinary_GlobDEqual
                      left: {($ VSub_Name '$all')}
                      right: {(DQ (0))}
                    )
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: (BoolBinary op_id:BoolBinary_GlobDEqual left:{($ VSub_Number '$1')} right:{(DQ )})
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (AndOr
                      children: [(C {(getGitHubUserInfo)}) (C {(exit)} {(1)})]
                      op_id: Op_DPipe
                    )
                    (AndOr
                      children: [(C {(getGitHubRepoInfo)}) (C {(exit)} {(1)})]
                      op_id: Op_DPipe
                    )
                    (AndOr
                      children: [(C {(getBitbucketInfo)}) (C {(exit)} {(1)})]
                      op_id: Op_DPipe
                    )
                    (C {(echo)})
                    (AndOr
                      children: [(C {(cloneGitHubRepo)}) (C {(exit)} {(1)})]
                      op_id: Op_DPipe
                    )
                    (AndOr
                      children: [
                        (C {(backupRepo)})
                        (BraceGroup
                          children: [
                            (Sentence
                              child: 
                                (C {(echo)} 
                                  {
                                    (DQ ('Error: couldnt backup ') ($ VSub_Name '$originalRepoName') 
                                      (' to bitbucket')
                                    )
                                  }
                                )
                              terminator: <Op_Semi ';'>
                            )
                            (Sentence
                              child: (C {(exit)} {(1)})
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          spids: [2101]
                        )
                      ]
                      op_id: Op_DPipe
                    )
                    (C {(exit)} {(0)})
                  ]
                  spids: [-1 2055]
                )
              ]
              else_action: [
                (AndOr
                  children: [(C {(getGitHubUserInfo)}) (C {(exit)} {(1)})]
                  op_id: Op_DPipe
                )
                (AndOr
                  children: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:repoName)
                          op: Equal
                          rhs: {($ VSub_Number '$1')}
                          spids: [2137]
                        )
                      ]
                      spids: [2137]
                    )
                    (C {(exit)} {(1)})
                  ]
                  op_id: Op_DPipe
                )
                (AndOr
                  children: [(C {(getBitbucketInfo)}) (C {(exit)} {(1)})]
                  op_id: Op_DPipe
                )
                (C {(echo)})
                (AndOr
                  children: [(C {(cloneGitHubRepo)}) (C {(exit)} {(1)})]
                  op_id: Op_DPipe
                )
                (AndOr
                  children: [
                    (C {(backupRepo)})
                    (BraceGroup
                      children: [
                        (Sentence
                          child: 
                            (C {(echo)} 
                              {
                                (DQ ('Error: couldnt backup ') ($ VSub_Name '$originalRepoName') 
                                  (' to bitbucket')
                                )
                              }
                            )
                          terminator: <Op_Semi ';'>
                        )
                        (Sentence
                          child: (C {(exit)} {(1)})
                          terminator: <Op_Semi ';'>
                        )
                      ]
                      spids: [2172]
                    )
                  ]
                  op_id: Op_DPipe
                )
                (C {(exit)} {(0)})
              ]
              spids: [2125 2196]
            )
          ]
          spids: [-1 2039]
        )
      ]
      else_action: [
        (AndOr children:[(C {(getGitHubUserInfo)})(C {(exit)} {(1)})] op_id:Op_DPipe)
        (AndOr children:[(C {(getGithubRepoNames)})(C {(exit)} {(1)})] op_id:Op_DPipe)
        (AndOr children:[(C {(getBitbucketInfo)})(C {(exit)} {(1)})] op_id:Op_DPipe)
        (C {(echo)})
        (ForEach
          iter_name: repo
          iter_words: [
            {
              (DQ 
                (BracedVarSub
                  token: <VSub_Name repoNames>
                  bracket_op: (WholeArray op_id:Lit_At)
                  spids: [2238 2243]
                )
              )
            }
          ]
          do_arg_iter: False
          body: 
            (DoGroup
              children: [
                (Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:repoName)
                      op: Equal
                      rhs: {($ VSub_Name '$repo')}
                      spids: [2250]
                    )
                  ]
                  spids: [2250]
                )
                (C {(echo)} {(DQ ('Starting to backup ') ($ VSub_Name '$repoName'))})
                (AndOr
                  children: [(C {(cloneGitHubRepo)}) (C {(exit)} {(1)})]
                  op_id: Op_DPipe
                )
                (AndOr
                  children: [
                    (C {(backupRepo)})
                    (BraceGroup
                      children: [
                        (Sentence
                          child: 
                            (C {(echo)} 
                              {
                                (DQ ('Error: couldnt backup ') ($ VSub_Name '$repoName') 
                                  (' to bitbucket')
                                )
                              }
                            )
                          terminator: <Op_Semi ';'>
                        )
                        (Sentence
                          child: (C {(exit)} {(1)})
                          terminator: <Op_Semi ';'>
                        )
                      ]
                      spids: [2275]
                    )
                  ]
                  op_id: Op_DPipe
                )
                (C {(echo)})
              ]
              spids: [2247 2297]
            )
          spids: [2236 -1]
        )
        (C {(echo)} {(DQ ('Successfully backed up all repositories'))})
        (C {(exit)} {(0)})
      ]
      spids: [2198 2312]
    )
  ]
)