(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:currentVersion)
          op: assign_op.Equal
          rhs: {(DQ <1.11.1>)}
          spids: [6]
        )
      ]
    )
    (C {<declare>} {<-a>} 
      {<Id.Lit_VarLike 'tools='> 
        (sh_array_literal
          left: <Id.Op_LParen _>
          words: [
            {<currency>}
            {<stocks>}
            {<weather>}
            {<crypt>}
            {<movies>}
            {<taste>}
            {<short>}
            {<geo>}
            {<cheat>}
            {<ytview>}
            {<cloudup>}
            {<qrify>}
          ]
        )
      }
    )
    (command.ShFunction
      name: askInstall
      body: 
        (BraceGroup
          children: [
            (C {<echo>} {<-n>} {(DQ <'Do you wish to install '> ($ Id.VSub_Number '$1') <' [Y/n]: '>)})
            (C {<read>} {<-r>} {<answer>})
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (command.DBracket
                              expr: 
                                (bool_expr.LogicalOr
                                  left: 
                                    (bool_expr.Binary
                                      op_id: Id.BoolBinary_GlobDEqual
                                      left: {(DQ ($ Id.VSub_DollarName '$answer'))}
                                      right: {(DQ <Y>)}
                                    )
                                  right: 
                                    (bool_expr.Binary
                                      op_id: Id.BoolBinary_GlobDEqual
                                      left: {(DQ ($ Id.VSub_DollarName '$answer'))}
                                      right: {(DQ <y>)}
                                    )
                                )
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (command.AndOr
                      ops: [Id.Op_DPipe]
                      children: [
                        (C {<cd>} {($ Id.VSub_Number '$1')})
                        (command.ControlFlow
                          token: <Id.ControlFlow_Return return>
                          arg_word: {<1>}
                        )
                      ]
                    )
                    (C {<echo>} {<-n>} {(DQ <'Installing '> ($ Id.VSub_Number '$1') <': '>)})
                    (C {<chmod>} {<a> <Id.Lit_Other '+'> <x>} {($ Id.VSub_Number '$1')})
                    (command.AndOr
                      ops: [Id.Op_DPipe]
                      children: [
                        (command.Simple
                          words: [{<cp>} {($ Id.VSub_Number '$1')} {<'/usr/local/bin'>}]
                          redirects: [
                            (redir
                              op: <Id.Redir_Great '>'>
                              loc: (redir_loc.Fd fd:1)
                              arg: {<'/dev/null'>}
                            )
                            (redir
                              op: <Id.Redir_GreatAnd '2>&'>
                              loc: (redir_loc.Fd fd:2)
                              arg: {<1>}
                            )
                          ]
                          do_fork: T
                        )
                        (BraceGroup
                          children: [
                            (command.Sentence
                              child: (C {<echo>} {(DQ <Failure>)})
                              terminator: <Id.Op_Semi _>
                            )
                            (command.Sentence
                              child: 
                                (C {<echo>} 
                                  {(DQ <'Error copying file, try running install script as sudo'>)}
                                )
                              terminator: <Id.Op_Semi _>
                            )
                            (command.Sentence
                              child: 
                                (command.ControlFlow
                                  token: <Id.ControlFlow_Exit exit>
                                  arg_word: {<1>}
                                )
                              terminator: <Id.Op_Semi _>
                            )
                          ]
                        )
                      ]
                    )
                    (C {<echo>} {(DQ <Success>)})
                    (command.AndOr
                      ops: [Id.Op_DPipe]
                      children: [
                        (C {<cd>} {<..>})
                        (command.ControlFlow
                          token: <Id.ControlFlow_Return return>
                          arg_word: {<1>}
                        )
                      ]
                    )
                  ]
                  spids: [68 97]
                )
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: updateTool
      body: 
        (BraceGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (command.DBracket
                              expr: 
                                (bool_expr.Unary
                                  op_id: Id.BoolUnary_f
                                  child: {<'/usr/local/bin/'> ($ Id.VSub_Number '$1')}
                                )
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (command.AndOr
                      ops: [Id.Op_DPipe]
                      children: [
                        (C {<cd>} {($ Id.VSub_Number '$1')})
                        (command.ControlFlow
                          token: <Id.ControlFlow_Return return>
                          arg_word: {<1>}
                        )
                      ]
                    )
                    (C {<echo>} {<-n>} {(DQ <'Installing '> ($ Id.VSub_Number '$1') <': '>)})
                    (C {<chmod>} {<a> <Id.Lit_Other '+'> <x>} {($ Id.VSub_Number '$1')})
                    (command.AndOr
                      ops: [Id.Op_DPipe]
                      children: [
                        (command.Simple
                          words: [{<cp>} {($ Id.VSub_Number '$1')} {<'/usr/local/bin'>}]
                          redirects: [
                            (redir
                              op: <Id.Redir_Great '>'>
                              loc: (redir_loc.Fd fd:1)
                              arg: {<'/dev/null'>}
                            )
                            (redir
                              op: <Id.Redir_GreatAnd '2>&'>
                              loc: (redir_loc.Fd fd:2)
                              arg: {<1>}
                            )
                          ]
                          do_fork: T
                        )
                        (BraceGroup
                          children: [
                            (command.Sentence
                              child: (C {<echo>} {(DQ <Failure>)})
                              terminator: <Id.Op_Semi _>
                            )
                            (command.Sentence
                              child: 
                                (C {<echo>} 
                                  {(DQ <'Error copying file, try running install script as sudo'>)}
                                )
                              terminator: <Id.Op_Semi _>
                            )
                            (command.Sentence
                              child: 
                                (command.ControlFlow
                                  token: <Id.ControlFlow_Exit exit>
                                  arg_word: {<1>}
                                )
                              terminator: <Id.Op_Semi _>
                            )
                          ]
                        )
                      ]
                    )
                    (C {<echo>} {(DQ <Success>)})
                    (command.AndOr
                      ops: [Id.Op_DPipe]
                      children: [
                        (C {<cd>} {<..>})
                        (command.ControlFlow
                          token: <Id.ControlFlow_Return return>
                          arg_word: {<1>}
                        )
                      ]
                    )
                  ]
                  spids: [200 211]
                )
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: singleInstall
      body: 
        (BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DPipe]
              children: [
                (C {<cd>} {($ Id.VSub_Number '$1')})
                (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
              ]
            )
            (C {<echo>} {<-n>} {(DQ <'Installing '> ($ Id.VSub_Number '$1') <': '>)})
            (C {<chmod>} {<a> <Id.Lit_Other '+'> <x>} {($ Id.VSub_Number '$1')})
            (command.AndOr
              ops: [Id.Op_DPipe]
              children: [
                (command.Simple
                  words: [{<cp>} {($ Id.VSub_Number '$1')} {<'/usr/local/bin'>}]
                  redirects: [
                    (redir
                      op: <Id.Redir_Great '>'>
                      loc: (redir_loc.Fd fd:1)
                      arg: {<'/dev/null'>}
                    )
                    (redir
                      op: <Id.Redir_GreatAnd '2>&'>
                      loc: (redir_loc.Fd fd:2)
                      arg: {<1>}
                    )
                  ]
                  do_fork: T
                )
                (BraceGroup
                  children: [
                    (command.Sentence
                      child: (C {<echo>} {(DQ <Failure>)})
                      terminator: <Id.Op_Semi _>
                    )
                    (command.Sentence
                      child: 
                        (C {<echo>} {(DQ <'Error copying file, try running install script as sudo'>)})
                      terminator: <Id.Op_Semi _>
                    )
                    (command.Sentence
                      child: (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                )
              ]
            )
            (C {<echo>} {(DQ <Success>)})
            (command.AndOr
              ops: [Id.Op_DPipe]
              children: [
                (C {<cd>} {<..>})
                (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: copyManpage
      body: 
        (BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DPipe]
              children: [
                (command.Simple
                  words: [{<cp>} {<bash-snippets.1>} {<'/usr/local/man/man1'>}]
                  redirects: [(redir op:<Id.Redir_GreatAnd '2>&'> loc:(redir_loc.Fd fd:2) arg:{<1>})]
                  do_fork: T
                )
                (BraceGroup
                  children: [
                    (command.Sentence
                      child: (C {<echo>} {(DQ <Failure>)})
                      terminator: <Id.Op_Semi _>
                    )
                    (command.Sentence
                      child: 
                        (C {<echo>} {(DQ <'Error copying file, try running install script as sudo'>)})
                      terminator: <Id.Op_Semi _>
                    )
                    (command.Sentence
                      child: (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                )
              ]
            )
          ]
        )
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (command.DBracket
                      expr: 
                        (bool_expr.Binary
                          op_id: Id.BoolBinary_GlobDEqual
                          left: {($ Id.VSub_Pound '$#')}
                          right: {<0>}
                        )
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.ForEach
              iter_name: tool
              iter_words: [
                {
                  (DQ 
                    (braced_var_sub
                      token: <Id.VSub_Name tools>
                      bracket_op: (bracket_op.WholeArray op_id:Id.Lit_At)
                    )
                  )
                }
              ]
              do_arg_iter: F
              body: 
                (command.DoGroup
                  children: [
                    (command.AndOr
                      ops: [Id.Op_DPipe]
                      children: [
                        (C {<askInstall>} {($ Id.VSub_DollarName '$tool')})
                        (command.ControlFlow
                          token: <Id.ControlFlow_Exit exit>
                          arg_word: {<1>}
                        )
                      ]
                    )
                  ]
                )
            )
            (command.AndOr
              ops: [Id.Op_DPipe]
              children: [
                (C {<copyManpage>})
                (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
              ]
            )
          ]
          spids: [448 461]
        )
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (command.DBracket
                      expr: 
                        (bool_expr.Binary
                          op_id: Id.BoolBinary_GlobDEqual
                          left: {($ Id.VSub_Number '$1')}
                          right: {(DQ <update>)}
                        )
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (C {<echo>} {(DQ <'Updating scripts...'>)})
            (command.ForEach
              iter_name: tool
              iter_words: [
                {
                  (DQ 
                    (braced_var_sub
                      token: <Id.VSub_Name tools>
                      bracket_op: (bracket_op.WholeArray op_id:Id.Lit_At)
                    )
                  )
                }
              ]
              do_arg_iter: F
              body: 
                (command.DoGroup
                  children: [
                    (command.AndOr
                      ops: [Id.Op_DPipe]
                      children: [
                        (C {<updateTool>} {($ Id.VSub_DollarName '$tool')})
                        (command.ControlFlow
                          token: <Id.ControlFlow_Exit exit>
                          arg_word: {<1>}
                        )
                      ]
                    )
                  ]
                )
            )
            (command.AndOr
              ops: [Id.Op_DPipe]
              children: [
                (C {<copyManpage>})
                (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
              ]
            )
          ]
          spids: [505 520]
        )
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (command.DBracket
                      expr: 
                        (bool_expr.Binary
                          op_id: Id.BoolBinary_GlobDEqual
                          left: {($ Id.VSub_Number '$1')}
                          right: {(DQ <all>)}
                        )
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.ForEach
              iter_name: tool
              iter_words: [
                {
                  (DQ 
                    (braced_var_sub
                      token: <Id.VSub_Name tools>
                      bracket_op: (bracket_op.WholeArray op_id:Id.Lit_At)
                    )
                  )
                }
              ]
              do_arg_iter: F
              body: 
                (command.DoGroup
                  children: [
                    (command.AndOr
                      ops: [Id.Op_DPipe]
                      children: [
                        (C {<singleInstall>} {($ Id.VSub_DollarName '$tool')})
                        (command.ControlFlow
                          token: <Id.ControlFlow_Exit exit>
                          arg_word: {<1>}
                        )
                      ]
                    )
                  ]
                )
            )
            (command.AndOr
              ops: [Id.Op_DPipe]
              children: [
                (C {<copyManpage>})
                (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
              ]
            )
          ]
          spids: [571 585]
        )
      ]
      else_action: [
        (command.AndOr
          ops: [Id.Op_DPipe]
          children: [
            (C {<singleInstall>} {($ Id.VSub_Number '$1')})
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
          ]
        )
        (command.AndOr
          ops: [Id.Op_DPipe]
          children: [
            (C {<copyManpage>})
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
          ]
        )
      ]
    )
    (C {<echo>} {<-n>} {(DQ <'( •_•)'>)})
    (C {<sleep>} {<.75>})
    (C {<echo>} {<-n>} {<-e>} {(DQ <Id.Lit_BadBackslash '\\'> <'r( •_•)>⌐■-■'>)})
    (C {<sleep>} {<.75>})
    (C {<echo>} {<-n>} {<-e>} {(DQ <Id.Lit_BadBackslash '\\'> <'r               '>)})
    (C {<echo>} {<-e>} {(DQ <Id.Lit_BadBackslash '\\'> <'r(⌐■_■)'>)})
    (C {<sleep>} {<.5>})
    (C {<echo>} {(DQ <'Bash Snippets version '> ($ Id.VSub_DollarName '$currentVersion'))})
    (C {<echo>} {(DQ <'https://github.com/alexanderepstein/Bash-Snippets'>)})
  ]
)