(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:state) op:Equal rhs:{(DQ )} spids:[12])] spids: [12] ) (FuncDef name: checkOpenSSL body: (BraceGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children: [ (SimpleCommand words: [{(command)} {(-v)} {(openssl)}] redirects: [ (Redir op: <Redir_AndGreat '&>'> fd: 16777215 arg_word: {(/dev/null)} ) ] ) ] negated: T ) terminator: <Op_Semi ';'> ) ] action: [ (SimpleCommand words: [{(echo)} {(DQ ('Error: to use this tool openssl must be installed'))}] redirects: [(Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})] ) (ControlFlow token:<ControlFlow_Return return> arg_word:{(1)}) ] spids: [16777215 38] ) ] else_action: [(ControlFlow token:<ControlFlow_Return return> arg_word:{(0)})] spids: [56 64] ) ] spids: [21] ) spids: [17 20] ) (FuncDef name: encrypt body: (BraceGroup children: [ (C {(echo)} {(DQ ('Encrypting ') ($ VSub_Number '$1') (...))}) (AndOr ops: [Op_DPipe] children: [ (C {(openssl)} {(enc)} {(-aes-256-cbc)} {(-salt)} {(-a)} {(-in)} {($ VSub_Number '$1')} {(-out)} {($ VSub_Number '$2')} ) (BraceGroup children: [ (Sentence child: (C {(echo)} {(DQ ('File not found'))}) terminator: <Op_Semi ';'> ) (Sentence child: (ControlFlow token:<ControlFlow_Return return> arg_word:{(1)}) terminator: <Op_Semi ';'> ) ] spids: [107] ) ] ) (C {(echo)} {(DQ ('Successfully encrypted'))}) ] spids: [75] ) spids: [71 74] ) (FuncDef name: decrypt body: (BraceGroup children: [ (C {(echo)} {(DQ ('Decrypting ') ($ VSub_Number '$1') (...))}) (AndOr ops: [Op_DPipe] children: [ (C {(openssl)} {(enc)} {(-aes-256-cbc)} {(-d)} {(-a)} {(-in)} {($ VSub_Number '$1')} {(-out)} {($ VSub_Number '$2')} ) (BraceGroup children: [ (Sentence child: (C {(echo)} {(DQ ('File not found'))}) terminator: <Op_Semi ';'> ) (Sentence child: (ControlFlow token:<ControlFlow_Return return> arg_word:{(1)}) terminator: <Op_Semi ';'> ) ] spids: [172] ) ] ) (C {(echo)} {(DQ ('Successfully decrypted'))}) ] spids: [140] ) spids: [136 139] ) (FuncDef name: update body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:repositoryName) op: Equal rhs: {(DQ (Bash-Snippets))} spids: [217] ) ] spids: [217] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:githubUserName) op: Equal rhs: {(DQ (alexanderepstein))} spids: [226] ) ] spids: [226] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:nameOfInstallFile) op: Equal rhs: {(DQ (install.sh))} spids: [235] ) ] spids: [235] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:latestVersion) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(curl)} {(-s)} {(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: F ) ] ) left_token: <Left_CommandSub '$('> spids: [245 283] ) } spids: [244] ) ] spids: [244] ) (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:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})] ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] spids: [16777215 330] ) (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:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})] ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] spids: [348 361] ) ] 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 ops: [Op_DPipe] children: [ (C {(cd)} {(TildeSubPart token:<Lit_TildeLike '~'>)}) (BraceGroup children: [ (Sentence child: (C {(echo)} {(SQ <'Update Failed'>)}) terminator: <Op_Semi ';'> ) (Sentence child: (ControlFlow token: <ControlFlow_Exit exit> arg_word: {(1)} ) terminator: <Op_Semi ';'> ) ] spids: [467] ) ] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolUnary op_id: BoolUnary_d child: {(Lit_TildeLike '~') (/) ($ VSub_Name '$repositoryName') } ) ) terminator: <Op_Semi ';'> ) ] action: [ (Sentence child: (AndOr ops: [Op_DPipe] 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: (ControlFlow token: <ControlFlow_Exit exit> arg_word: {(1)} ) terminator: <Op_Semi ';'> ) ] spids: [511] ) ] ) terminator: <Op_Semi ';'> ) ] spids: [16777215 499] ) ] spids: [16777215 529] ) (AndOr ops: [Op_DPipe] 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: (ControlFlow token: <ControlFlow_Exit exit> arg_word: {(1)} ) terminator: <Op_Semi ';'> ) ] spids: [545] ) ] ) (AndOr ops: [Op_DPipe] children: [ (C {(cd)} {($ VSub_Name '$repositoryName')}) (BraceGroup children: [ (Sentence child: (C {(echo)} {(SQ <'Update Failed'>)}) terminator: <Op_Semi ';'> ) (Sentence child: (ControlFlow token: <ControlFlow_Exit exit> arg_word: {(1)} ) terminator: <Op_Semi ';'> ) ] spids: [569] ) ] ) (AndOr ops: [Op_DPipe Op_DPipe] children: [ (SimpleCommand words: [ {(git)} {(checkout)} {(DQ (v) ($ VSub_Name '$latestVersion'))} ] redirects: [ (Redir op: <Redir_Great '2>'> fd: 2 arg_word: {(/dev/null)} ) ] ) (SimpleCommand words: [{(git)} {(checkout)} {(DQ ($ VSub_Name '$latestVersion'))}] redirects: [ (Redir op: <Redir_Great '2>'> fd: 2 arg_word: {(/dev/null)} ) ] ) (C {(echo)} { (DQ ( "Couldn't git checkout to stable release, updating to latest commit." ) ) } ) ] ) (C {(chmod)} {(a) (Lit_Other '+') (x)} {(install.sh)}) (AndOr ops: [Op_DPipe] children: [ (C {(./) ($ VSub_Name '$nameOfInstallFile')} {(DQ (update))}) (ControlFlow token: <ControlFlow_Exit exit> arg_word: {(1)} ) ] ) (C {(cd)} {(..)}) (AndOr ops: [Op_DPipe] 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: (ControlFlow token: <ControlFlow_Exit exit> arg_word: {(1)} ) terminator: <Op_Semi ';'> ) ] spids: [664] ) ] ) ] spids: [16777215 458] ) ] else_action: [(ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})] spids: [683 691] ) ] spids: [16777215 399] ) ] else_action: [ (C {(echo)} {(DQ ($ VSub_Name '$repositoryName') (' is already the latest version'))} ) ] spids: [694 705] ) ] spids: [379 708] ) ] spids: [202] ) spids: [198 201] ) (FuncDef name: usage body: (BraceGroup children: [ (C {(echo)} {(DQ (Crypt))}) (C {(echo)} { (DQ ( 'Description: A wrapper around openssl that facilitates encrypting and decrypting files.' ) ) } ) (C {(echo)} {(DQ ('Usage: crypt [flag] [inputFile] [outputFile]'))}) (C {(echo)} {(DQ (' -e Encrypt the inputFile and store it in the outputFile'))}) (C {(echo)} {(DQ (' -d Decrypt the inputFile and store it in the outputFile'))}) (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 ( ' crypt -e mySecretFile.txt myEncryptedFile.jpg (change filetype so default program is incorrect)' ) ) } ) (C {(echo)} { (DQ ( ' crypt -d myEncryptedFile.jpg thisIsNowDecrypted.txt (change filetype back so now default program is correct)' ) ) } ) ] spids: [719] ) spids: [715 718] ) (AndOr ops: [Op_DPipe] children: [(C {(checkOpenSSL)}) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})] ) (WhileUntil keyword: <KW_While while> cond: [(Sentence child:(C {(getopts)} {(DQ ('huve:d:'))} {(opt)}) terminator:<Op_Semi ';'>)] body: (DoGroup children: [ (Case to_match: {($ VSub_Name '$opt')} arms: [ (case_arm pat_list: [{(e)}] action: [ (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobNEqual left: {($ VSub_Name '$state')} right: {(DQ (decrypt))} ) ) terminator: <Op_Semi ';'> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:state) op: Equal rhs: {(DQ (encrypt))} spids: [858] ) ] spids: [858] ) ] spids: [16777215 855] ) ] else_action: [ (SimpleCommand words: [{(echo)} {(DQ ('Error: the -d and -e options are mutally exclusive'))}] redirects: [(Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})] ) (ControlFlow token: <ControlFlow_Exit exit> arg_word: {(1)} ) ] spids: [864 882] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_ne left: {($ VSub_Pound '$#')} right: {(3)} ) ) terminator: <Op_Semi ';'> ) ] action: [ (SimpleCommand words: [ {(echo)} { (DQ ( 'Option -e needs and only accepts two arguments [file to encrypt] [output file]' ) ) } ] redirects: [(Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})] ) (ControlFlow token: <ControlFlow_Exit exit> arg_word: {(1)} ) ] spids: [16777215 898] ) ] spids: [16777215 916] ) ] spids: [834 835 920 16777215] ) (case_arm pat_list: [{(EscapedLiteralPart token:<Lit_EscapedChar '\\?'>)}] action: [ (SimpleCommand words: [{(echo)} {(DQ ('Invalid option: -') ($ VSub_Name '$OPTARG'))}] redirects: [(Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})] ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] spids: [923 924 943 16777215] ) (case_arm pat_list: [{(d)}] action: [ (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobNEqual left: {($ VSub_Name '$state')} right: {(DQ (encrypt))} ) ) terminator: <Op_Semi ';'> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:state) op: Equal rhs: {(DQ (decrypt))} spids: [970] ) ] spids: [970] ) ] spids: [16777215 967] ) ] else_action: [ (SimpleCommand words: [{(echo)} {(DQ ('Error: the -e and -d options are mutally exclusive'))}] redirects: [(Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})] ) (ControlFlow token: <ControlFlow_Exit exit> arg_word: {(1)} ) ] spids: [976 994] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_ne left: {($ VSub_Pound '$#')} right: {(3)} ) ) terminator: <Op_Semi ';'> ) ] action: [ (SimpleCommand words: [ {(echo)} { (DQ ( 'Option -d needs and only accepts two arguments [file to decrypt] [output file]' ) ) } ] redirects: [(Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})] ) (ControlFlow token: <ControlFlow_Exit exit> arg_word: {(1)} ) ] spids: [16777215 1010] ) ] spids: [16777215 1028] ) ] spids: [946 947 1031 16777215] ) (case_arm pat_list: [{(u)}] action: [(C {(update)}) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(0)})] spids: [1034 1035 1046 16777215] ) (case_arm pat_list: [{(h)}] action: [(C {(usage)}) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(0)})] spids: [1049 1050 1061 16777215] ) (case_arm pat_list: [{(v)}] action: [ (C {(echo)} {(DQ ('Version ') ($ VSub_Name '$currentVersion'))}) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(0)}) ] spids: [1064 1065 1081 16777215] ) (case_arm pat_list: [{(Lit_Other ':')}] action: [ (SimpleCommand words: [ {(echo)} {(DQ ('Option -') ($ VSub_Name '$OPTARG') (' requires an argument.'))} ] redirects: [(Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})] ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] spids: [1084 1085 1108 16777215] ) ] spids: [827 831 1111] ) ] spids: [821 1113] ) ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id:BoolBinary_GlobDEqual left:{($ VSub_Pound '$#')} right:{(0)}) ) terminator: <Op_Semi ';'> ) ] action: [(C {(usage)}) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(0)})] spids: [16777215 1129] ) (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)}) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(0)})] spids: [1139 1153] ) (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)}) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(0)})] spids: [1163 1177] ) (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {($ VSub_Name '$state')} right: {(DQ (encrypt))} ) ) terminator: <Op_Semi ';'> ) ] action: [ (AndOr ops: [Op_DPipe] children: [ (C {(encrypt)} {($ VSub_Number '$2')} {($ VSub_Number '$3')}) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(0)}) ] spids: [1187 1201] ) (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {($ VSub_Name '$state')} right: {(DQ (decrypt))} ) ) terminator: <Op_Semi ';'> ) ] action: [ (AndOr ops: [Op_DPipe] children: [ (C {(decrypt)} {($ VSub_Number '$2')} {($ VSub_Number '$3')}) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(0)}) ] spids: [1221 1235] ) ] spids: [16777215 1255] ) ] )