(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: [7] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:configuredClient) op: assign_op.Equal rhs: {(DQ )} spids: [12] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:private) op: assign_op.Equal rhs: {(DQ <0>)} spids: [16] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:all) op: assign_op.Equal rhs: {(DQ <0>)} spids: [24] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {<-d>} {(word_part.TildeSub token:<Id.Lit_TildeLike '~'>) <'/temp'>} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.Sentence child: (C {<rm>} {<-rf>} {(word_part.TildeSub token:<Id.Lit_TildeLike '~'>) <'/temp'>}) terminator: <Id.Op_Semi _> ) ] spids: [32 43] ) ] ) (command.ShFunction name: getConfiguredClient body: (BraceGroup children: [ (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.Simple words: [{<command>} {<-v>} {<curl>}] redirects: [ (redir op: <Id.Redir_AndGreat '&>'> loc: (redir_loc.Fd fd:1) arg: {<'/dev/null'>} ) ] do_fork: T ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:configuredClient) op: assign_op.Equal rhs: {(DQ <curl>)} spids: [86] ) ] ) ] spids: [70 83] ) (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.Simple words: [{<command>} {<-v>} {<wget>}] redirects: [ (redir op: <Id.Redir_AndGreat '&>'> loc: (redir_loc.Fd fd:1) arg: {<'/dev/null'>} ) ] do_fork: T ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:configuredClient) op: assign_op.Equal rhs: {(DQ <wget>)} spids: [108] ) ] ) ] spids: [92 105] ) (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.Simple words: [{<command>} {<-v>} {<fetch>}] redirects: [ (redir op: <Id.Redir_AndGreat '&>'> loc: (redir_loc.Fd fd:1) arg: {<'/dev/null'>} ) ] do_fork: T ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:configuredClient) op: assign_op.Equal rhs: {(DQ <fetch>)} spids: [130] ) ] ) ] spids: [114 127] ) ] else_action: [ (C {<echo>} {(DQ <'Error: This tool reqires either curl, wget, or fetch to be installed.'>)} ) (command.ControlFlow token: <Id.ControlFlow_Return return> arg_word: {<1>} ) ] ) ] ) ) (command.ShFunction name: checkInternet body: (BraceGroup children: [ (command.Pipeline children: [ (C {<echo>} {<-e>} { (DQ <'GET http://google.com HTTP/1.0'> <Id.Lit_BadBackslash '\\'> <n> <Id.Lit_BadBackslash '\\'> <n> ) } ) (command.Simple words: [{<nc>} {<google.com>} {<80>}] 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 ) ] negated: F ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {($ Id.VSub_QMark '$?')} {<-eq>} {<0>} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [(command.ControlFlow token:<Id.ControlFlow_Return return> arg_word:{<0>})] spids: [195 208] ) ] else_action: [ (command.Simple words: [{<echo>} {(DQ <'Error: no active internet connection'>)}] redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})] do_fork: T ) (command.ControlFlow token: <Id.ControlFlow_Return return> arg_word: {<1>} ) ] ) ] ) ) (command.ShFunction name: httpGet body: (BraceGroup children: [ (command.Case to_match: {(DQ ($ Id.VSub_DollarName '$configuredClient'))} arms: [ (case_arm pat_list: [{<curl>}] action: [(C {<curl>} {<-A>} {<curl>} {<-s>} {(DQ ($ Id.VSub_At '$@'))})] spids: [264 265 278 -1] ) (case_arm pat_list: [{<wget>}] action: [(C {<wget>} {<-qO->} {(DQ ($ Id.VSub_At '$@'))})] spids: [281 282 291 -1] ) (case_arm pat_list: [{<fetch>}] action: [(C {<fetch>} {<-o>} {(DQ <...>)})] spids: [294 295 304 -1] ) ] ) ] ) ) (command.ShFunction name: update body: (BraceGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:repositoryName) op: assign_op.Equal rhs: {(DQ <Bash-Snippets>)} spids: [332] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:githubUserName) op: assign_op.Equal rhs: {(DQ <alexanderepstein>)} spids: [341] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:nameOfInstallFile) op: assign_op.Equal rhs: {(DQ <install.sh>)} spids: [350] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:latestVersion) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.Pipeline children: [ (C {<httpGet>} {<https> <Id.Lit_Colon ':'> <'//api.github.com/repos/'> ($ Id.VSub_DollarName '$githubUserName') <'/'> ($ Id.VSub_DollarName '$repositoryName') <'/tags'> } ) (C {<grep>} {<-Eo>} {(SQ <'"name":.*?[^\\\\]",'>)}) (C {<head>} {<-1>}) (C {<grep>} {<-Eo>} {(DQ <'[0-9.]+'>)}) ] negated: F ) ) } spids: [359] ) ] ) (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: {($ Id.VSub_DollarName '$currentVersion')} right: {(DQ )} ) right: (bool_expr.LogicalOr left: (bool_expr.Binary op_id: Id.BoolBinary_GlobDEqual left: {($ Id.VSub_DollarName '$repositoryName')} right: {(DQ )} ) right: (bool_expr.LogicalOr left: (bool_expr.Binary op_id: Id.BoolBinary_GlobDEqual left: {($ Id.VSub_DollarName '$githubUserName')} right: {(DQ )} ) right: (bool_expr.Binary op_id: Id.BoolBinary_GlobDEqual left: {($ Id.VSub_DollarName '$nameOfInstallFile')} right: {(DQ )} ) ) ) ) ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.Simple words: [ {<echo>} {(DQ <'Error: update utility has not been configured correctly.'>)} ] redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})] do_fork: T ) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) ] spids: [403 443] ) (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobDEqual left: {($ Id.VSub_DollarName '$latestVersion')} right: {(DQ )} ) ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.Simple words: [{<echo>} {(DQ <'Error: no active internet connection'>)}] redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})] do_fork: T ) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) ] spids: [461 474] ) ] else_action: [ (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobNEqual left: {(DQ ($ Id.VSub_DollarName '$latestVersion'))} right: {(DQ ($ Id.VSub_DollarName '$currentVersion'))} ) ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<echo>} {(DQ <'Version '> ($ Id.VSub_DollarName '$latestVersion') <' available'>)} ) (C {<echo>} {<-n>} { (DQ <'Do you wish to update '> ($ Id.VSub_DollarName '$repositoryName') <' [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>} {(word_part.TildeSub token:<Id.Lit_TildeLike '~'>)}) (BraceGroup children: [ (command.Sentence child: (C {<echo>} {(SQ <'Update Failed'>)}) 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.Unary op_id: Id.BoolUnary_d child: { (word_part.TildeSub token: <Id.Lit_TildeLike '~'> ) <'/'> ($ Id.VSub_DollarName '$repositoryName') } ) ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.Sentence child: (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<rm>} {<-r>} {<-f>} {($ Id.VSub_DollarName '$repositoryName')} ) (BraceGroup children: [ (command.Sentence child: (C {<echo>} { (DQ < 'Permissions Error: try running the update as sudo' > ) } ) terminator: <Id.Op_Semi _> ) (command.Sentence child: (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) terminator: <Id.Op_Semi _> ) ] ) ] ) terminator: <Id.Op_Semi _> ) ] spids: [599 612] ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<git>} {<clone>} { (DQ <'https://github.com/'> ($ Id.VSub_DollarName '$githubUserName') <'/'> ($ Id.VSub_DollarName '$repositoryName') ) } ) (BraceGroup children: [ (command.Sentence child: (C {<echo>} {(DQ <'Couldn\'t download latest version'>)}) terminator: <Id.Op_Semi _> ) (command.Sentence child: (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) terminator: <Id.Op_Semi _> ) ] ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<cd>} {($ Id.VSub_DollarName '$repositoryName')}) (BraceGroup children: [ (command.Sentence child: (C {<echo>} {(SQ <'Update Failed'>)}) terminator: <Id.Op_Semi _> ) (command.Sentence child: (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) terminator: <Id.Op_Semi _> ) ] ) ] ) (command.AndOr ops: [Id.Op_DPipe Id.Op_DPipe] children: [ (command.Simple words: [ {<git>} {<checkout>} {(DQ <v> ($ Id.VSub_DollarName '$latestVersion'))} ] redirects: [ (redir op: <Id.Redir_Great '2>'> loc: (redir_loc.Fd fd:2) arg: {<'/dev/null'>} ) ] do_fork: T ) (command.Simple words: [ {<git>} {<checkout>} {(DQ ($ Id.VSub_DollarName '$latestVersion'))} ] redirects: [ (redir op: <Id.Redir_Great '2>'> loc: (redir_loc.Fd fd:2) arg: {<'/dev/null'>} ) ] do_fork: T ) (C {<echo>} { (DQ < 'Couldn\'t git checkout to stable release, updating to latest commit.' > ) } ) ] ) (C {<chmod>} {<a> <Id.Lit_Other '+'> <x>} {<install.sh>}) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<'./'> ($ Id.VSub_DollarName '$nameOfInstallFile')} {(DQ <update>)} ) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) ] ) (C {<cd>} {<..>}) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<rm>} {<-r>} {<-f>} {($ Id.VSub_DollarName '$repositoryName')}) (BraceGroup children: [ (command.Sentence child: (C {<echo>} { (DQ < 'Permissions Error: update succesfull but cannot delete temp files located at ~/' > ($ Id.VSub_DollarName '$repositoryName') <' delete this directory with sudo'> ) } ) terminator: <Id.Op_Semi _> ) (command.Sentence child: (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) terminator: <Id.Op_Semi _> ) ] ) ] ) ] spids: [542 571] ) ] else_action: [ (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) ] ) ] spids: [495 512] ) ] else_action: [ (C {<echo>} { (DQ ($ Id.VSub_DollarName '$repositoryName') <' is already the latest version'> ) } ) ] ) ] ) ] ) ) (command.ShFunction name: getBitbucketInfo body: (BraceGroup children: [ (C {<echo>} {<-n>} {(SQ <'Enter your Bitbucket username: '>)}) (C {<read>} {<bbUsername>}) (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_DollarName '$bbUsername')} right: {(DQ <1>)} ) ) terminator: <Id.Op_Semi _> ) ] ) action: [(C {<echo>} {(DQ <'Using github username as bitbucket username'>)})] spids: [851 865] ) ] ) (C {<echo>} {<-n>} {(SQ <'Enter your Bitbucket password: '>)}) (C {<read>} {<-s>} {<password>}) ] ) ) (command.ShFunction name: backupRepo body: (BraceGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:timestamp) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.Pipeline children: [ (C {<date>}) (C {<tr>} {(DQ <' '>)} {<Id.Lit_Underscore _>}) (C {<tr>} {<Id.Lit_Colon ':'>} {<Id.Lit_Underscore _>}) ] negated: F ) ) } spids: [906] ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<cd>} {(word_part.TildeSub token:<Id.Lit_TildeLike '~'>) <'/temp/github/'> ($ Id.VSub_DollarName '$repoName') } ) (BraceGroup children: [ (command.Sentence child: (C {<echo>} {(DQ <'Fatal error'>)}) terminator: <Id.Op_Semi _> ) (command.Sentence child: (command.ControlFlow token:<Id.ControlFlow_Return return> 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_DollarName '$private')} right: {(DQ <1>)} ) ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.Simple words: [ {<httpGet>} {<--user>} {($ Id.VSub_DollarName '$bbUsername') <Id.Lit_Colon ':'> ($ Id.VSub_DollarName '$password') } {<https> <Id.Lit_Colon ':'> <'//api.bitbucket.org/1.0/repositories/'>} {<--data>} {<Id.Lit_VarLike 'name='> ($ Id.VSub_DollarName '$repoName') ($ Id.VSub_DollarName '$timestamp') } {<Id.Lit_VarLike 'is_private='> <true>} ] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<'/dev/null'>} ) ] do_fork: T ) (C {<echo>} {(DQ <private>)}) ] spids: [959 973] ) ] else_action: [ (command.Simple words: [ {<httpGet>} {<--user>} {($ Id.VSub_DollarName '$bbUsername') <Id.Lit_Colon ':'> ($ Id.VSub_DollarName '$password') } {<https> <Id.Lit_Colon ':'> <'//api.bitbucket.org/1.0/repositories/'>} {<--data>} {<Id.Lit_VarLike 'name='> ($ Id.VSub_DollarName '$repoName') ($ Id.VSub_DollarName '$timestamp') } ] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<'/dev/null'>} ) ] do_fork: T ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:originalRepoName) op: assign_op.Equal rhs: {($ Id.VSub_DollarName '$repoName')} spids: [1038] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:repoName) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.Pipeline children: [ (C {<echo>} {($ Id.VSub_DollarName '$repoName')}) (C {<tr>} {(SQ <'[:upper:]'>)} {(SQ <'[:lower:]'>)}) ] negated: F ) ) } spids: [1042] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:timestamp) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.Pipeline children: [ (C {<echo>} {($ Id.VSub_DollarName '$timestamp')}) (C {<tr>} {(SQ <'[:upper:]'>)} {(SQ <'[:lower:]'>)}) ] negated: F ) ) } spids: [1062] ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (command.Simple words: [ {<git>} {<remote>} {<set-url>} {<origin>} {<https> <Id.Lit_Colon ':'> <'//'> ($ Id.VSub_DollarName '$bbUsername') <Id.Lit_Colon ':'> ($ Id.VSub_DollarName '$password') <Id.Lit_Splice '@bitbucket'> <'.org/'> ($ Id.VSub_DollarName '$bbUsername') <'/'> ($ Id.VSub_DollarName '$repoName') ($ Id.VSub_DollarName '$timestamp') <.git> } ] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<'/dev/null'>} ) ] do_fork: T ) (command.ControlFlow token: <Id.ControlFlow_Return return> arg_word: {<1>} ) ] ) (C {<echo>} {(DQ <'Uploading '> ($ Id.VSub_DollarName '$originalRepoName') <' to bitbucket'>)} ) (command.AndOr ops: [Id.Op_DPipe] children: [ (command.Simple words: [{<git>} {<push>} {<-q>} {<--progress>} {<origin>} {<--all>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<'/dev/null'>} ) ] do_fork: T ) (command.ControlFlow token: <Id.ControlFlow_Return return> arg_word: {<1>} ) ] ) (C {<echo>} {(DQ <'Uploading the tags for '> ($ Id.VSub_DollarName '$originalRepoName'))}) (command.AndOr ops: [Id.Op_DPipe] children: [ (command.Simple words: [{<git>} {<push>} {<-q>} {<--progress>} {<origin>} {<--tags>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<'/dev/null'>} ) ] do_fork: T ) (command.ControlFlow token: <Id.ControlFlow_Return return> arg_word: {<1>} ) ] ) (C {<echo>} {(DQ <'Successfully backedup '> ($ Id.VSub_DollarName '$originalRepoName'))}) (C {<rm>} {<-rf>} {(word_part.TildeSub token:<Id.Lit_TildeLike '~'>) <'/temp'>}) ] ) ) (command.ShFunction name: getGitHubRepoInfo body: (BraceGroup children: [ (C {<echo>} {<-n>} {(SQ <'Enter the name of the repostiory to backup: '>)}) (C {<read>} {<repoName>}) ] ) ) (command.ShFunction name: getGitHubUserInfo body: (BraceGroup children: [ (C {<echo>} {<-n>} {(SQ <'Enter your Github username: '>)}) (C {<read>} {<ghUsername>}) ] ) ) (command.ShFunction name: cloneGitHubRepo body: (BraceGroup children: [ (C {<mkdir>} {(word_part.TildeSub token:<Id.Lit_TildeLike '~'>) <'/temp'>}) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<cd>}) (BraceGroup children: [ (command.Sentence child: (C {<echo>} {(DQ <'Fatal error'>)}) terminator: <Id.Op_Semi _> ) (command.Sentence child: (command.ControlFlow token:<Id.ControlFlow_Return return> arg_word:{<1>}) terminator: <Id.Op_Semi _> ) ] ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<mkdir>} {(word_part.TildeSub token:<Id.Lit_TildeLike '~'>) <'/temp/github'>}) (BraceGroup children: [ (command.Sentence child: (C {<echo>} {(DQ <'Fatal error'>)}) terminator: <Id.Op_Semi _> ) (command.Sentence child: (command.ControlFlow token:<Id.ControlFlow_Return return> arg_word:{<1>}) terminator: <Id.Op_Semi _> ) ] ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<cd>} {(word_part.TildeSub token:<Id.Lit_TildeLike '~'>) <'/temp/github'>}) (BraceGroup children: [ (command.Sentence child: (C {<echo>} {(DQ <'Fatal error'>)}) terminator: <Id.Op_Semi _> ) (command.Sentence child: (command.ControlFlow token:<Id.ControlFlow_Return return> arg_word:{<1>}) terminator: <Id.Op_Semi _> ) ] ) ] ) (C {<echo>} {(DQ <'Cloning '> ($ Id.VSub_DollarName '$repoName'))}) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<git>} {<clone>} {<-q>} {<--progress>} {<https> <Id.Lit_Colon ':'> <'//github.com/'> ($ Id.VSub_DollarName '$ghUsername') <'/'> ($ Id.VSub_DollarName '$repoName') } ) (command.ControlFlow token: <Id.ControlFlow_Return return> arg_word: {<1>} ) ] ) (C {<echo>} {(DQ <'Successfully cloned '> ($ Id.VSub_DollarName '$repoName'))}) ] ) ) (command.ShFunction name: getGithubRepoNames body: (BraceGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:response) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.Pipeline children: [ (C {<httpGet>} { (DQ <'https://api.github.com/users/'> ($ Id.VSub_DollarName '$ghUsername') <'/repos?sort=updated&per_page=100'> ) } ) (C {<grep>} {<-Eo>} {(SQ <'"name": "[ a-Z . \\/ \\\\ 0-9 -- _ ]*'>)}) (C {<sed>} {<'s/'> (SQ <'"name": "'>) <'/'> (DQ ) <'/g'>}) ] negated: F ) ) } spids: [1396] ) ] ) (command.ForEach iter_name: repo iter_words: [{($ Id.VSub_DollarName '$response')}] do_arg_iter: F body: (command.DoGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:repoNames) op: assign_op.PlusEqual rhs: { (sh_array_literal left: <Id.Op_LParen _> words: [{(DQ ($ Id.VSub_DollarName '$repo'))}] ) } spids: [1443] ) ] ) ] ) ) ] ) ) (command.ShFunction 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'>)}) ] ) ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<getConfiguredClient>}) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>}) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<checkInternet>}) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>}) ] ) (command.WhileUntil keyword: <Id.KW_While while> cond: (condition.Shell commands: [ (command.Sentence child: (C {<getopts>} {(DQ <pauvh>)} {<opt>}) terminator: <Id.Op_Semi _> ) ] ) body: (command.DoGroup children: [ (command.Case to_match: {($ Id.VSub_DollarName '$opt')} arms: [ (case_arm pat_list: [{(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\?'>)}] action: [ (command.Simple words: [{<echo>} {(DQ <'Invalid option: -'> ($ Id.VSub_DollarName '$OPTARG'))}] redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})] do_fork: T ) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) ] spids: [1601 1602 1621 -1] ) (case_arm pat_list: [{<p>}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:private) op: assign_op.Equal rhs: {(DQ <1>)} spids: [1628] ) ] ) (command.Simple 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 '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})] do_fork: T ) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<0>} ) ] spids: [1624 1625 1649 -1] ) (case_arm pat_list: [{<h>}] action: [ (C {<usage>}) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<0>} ) ] spids: [1652 1653 1664 -1] ) (case_arm pat_list: [{<a>}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:all) op: assign_op.Equal rhs: {(DQ <1>)} spids: [1671] ) ] ) ] spids: [1667 1668 1677 -1] ) (case_arm pat_list: [{<v>}] action: [ (C {<echo>} {(DQ <'Version '> ($ Id.VSub_DollarName '$currentVersion'))}) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<0>} ) ] spids: [1680 1681 1697 -1] ) (case_arm pat_list: [{<u>}] action: [ (C {<update>}) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<0>} ) ] spids: [1700 1701 1712 -1] ) (case_arm pat_list: [{<Id.Lit_Colon ':'>}] action: [ (command.Simple words: [ {<echo>} { (DQ <'Option -'> ($ Id.VSub_DollarName '$OPTARG') <' requires an argument.'>) } ] redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})] do_fork: T ) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) ] spids: [1715 1716 1736 -1] ) ] ) ] ) ) (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: {(DQ <1>)} ) ) terminator: <Id.Op_Semi _> ) ] ) action: [ (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_Number '$1')} right: {(DQ <update>)} ) ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<update>}) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<0>} ) ] spids: [1764 1778] ) (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 <help>)} ) ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<usage>}) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<0>} ) ] spids: [1789 1804] ) ] ) ] spids: [1746 1761] ) (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {($ Id.VSub_Pound '$#')} {<-ge>} {<1>} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<getGitHubUserInfo>}) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>}) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<getBitbucketInfo>}) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>}) ] ) (C {<echo>}) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobNEqual left: {($ Id.VSub_DollarName '$private')} right: {(DQ <1>)} ) ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ForEach iter_name: i iter_words: [{(DQ ($ Id.VSub_At '$@'))}] do_arg_iter: F body: (command.DoGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:repoName) op: assign_op.Equal rhs: {($ Id.VSub_DollarName '$i')} spids: [1887] ) ] ) (C {<echo>} {(DQ <'Starting to backup '> ($ Id.VSub_DollarName '$repoName'))} ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<cloneGitHubRepo>}) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<backupRepo>}) (BraceGroup children: [ (command.Sentence child: (C {<echo>} { (DQ <'Error: couldnt backup '> ($ Id.VSub_DollarName '$originalRepoName') <' to bitbucket'> ) } ) terminator: <Id.Op_Semi _> ) (command.Sentence child: (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) terminator: <Id.Op_Semi _> ) ] ) ] ) (C {<echo>}) ] ) ) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<0>} ) ] spids: [1853 1867] ) ] else_action: [ (command.ForEach iter_name: i iter_words: [ { (DQ (braced_var_sub token: <Id.VSub_At '@'> suffix_op: (suffix_op.Slice begin:{<Id.Lit_Digits 2>}) ) ) } ] do_arg_iter: F body: (command.DoGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:repoName) op: assign_op.Equal rhs: {($ Id.VSub_DollarName '$i')} spids: [1963] ) ] ) (C {<echo>} {(DQ <'Starting to backup '> ($ Id.VSub_DollarName '$repoName'))}) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<cloneGitHubRepo>}) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<backupRepo>}) (BraceGroup children: [ (command.Sentence child: (C {<echo>} { (DQ <'Error: couldnt backup '> ($ Id.VSub_DollarName '$originalRepoName') <' to bitbucket'> ) } ) terminator: <Id.Op_Semi _> ) (command.Sentence child: (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) terminator: <Id.Op_Semi _> ) ] ) ] ) (C {<echo>}) ] ) ) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<0>}) ] ) ] spids: [1817 1829] ) ] ) (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_DollarName '$all')} right: {(DQ <0>)} ) ) terminator: <Id.Op_Semi _> ) ] ) action: [ (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_Number '$1')} right: {(DQ )} ) ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<getGitHubUserInfo>}) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<getGitHubRepoInfo>}) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<getBitbucketInfo>}) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) ] ) (C {<echo>}) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<cloneGitHubRepo>}) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<backupRepo>}) (BraceGroup children: [ (command.Sentence child: (C {<echo>} { (DQ <'Error: couldnt backup '> ($ Id.VSub_DollarName '$originalRepoName') <' to bitbucket'> ) } ) terminator: <Id.Op_Semi _> ) (command.Sentence child: (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) terminator: <Id.Op_Semi _> ) ] ) ] ) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<0>} ) ] spids: [2041 2054] ) ] else_action: [ (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<getGitHubUserInfo>}) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:repoName) op: assign_op.Equal rhs: {($ Id.VSub_Number '$1')} spids: [2136] ) ] ) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<getBitbucketInfo>}) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) ] ) (C {<echo>}) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<cloneGitHubRepo>}) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<backupRepo>}) (BraceGroup children: [ (command.Sentence child: (C {<echo>} { (DQ <'Error: couldnt backup '> ($ Id.VSub_DollarName '$originalRepoName') <' to bitbucket'> ) } ) terminator: <Id.Op_Semi _> ) (command.Sentence child: (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>}) terminator: <Id.Op_Semi _> ) ] ) ] ) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<0>}) ] ) ] spids: [2024 2038] ) ] else_action: [ (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<getGitHubUserInfo>}) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>}) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<getGithubRepoNames>}) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>}) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<getBitbucketInfo>}) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>}) ] ) (C {<echo>}) (command.ForEach iter_name: repo iter_words: [ { (DQ (braced_var_sub token: <Id.VSub_Name repoNames> bracket_op: (bracket_op.WholeArray op_id:Id.Lit_At) ) ) } ] do_arg_iter: F body: (command.DoGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:repoName) op: assign_op.Equal rhs: {($ Id.VSub_DollarName '$repo')} spids: [2249] ) ] ) (C {<echo>} {(DQ <'Starting to backup '> ($ Id.VSub_DollarName '$repoName'))}) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<cloneGitHubRepo>}) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<backupRepo>}) (BraceGroup children: [ (command.Sentence child: (C {<echo>} { (DQ <'Error: couldnt backup '> ($ Id.VSub_DollarName '$repoName') <' to bitbucket'> ) } ) terminator: <Id.Op_Semi _> ) (command.Sentence child: (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>}) terminator: <Id.Op_Semi _> ) ] ) ] ) (C {<echo>}) ] ) ) (C {<echo>} {(DQ <'Successfully backed up all repositories'>)}) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<0>}) ] ) ] )