(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:multiline) op:Equal rhs:{(DQ (0))} spids:[12])] spids: [12] ) (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: 16777215 arg_word: {(/dev/null)} spids: [38] ) ] ) terminator: <Op_Semi ';'> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:configuredClient) op: Equal rhs: {(DQ (curl))} spids: [47] ) ] spids: [47] ) ] spids: [16777215 44] ) (if_arm cond: [ (Sentence child: (C {(command)} {(-v)} {(wget)}) terminator: <Op_Amp '&'> ) (Sentence child: (SimpleCommand redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(/dev/null)} spids: [62] ) ] ) terminator: <Op_Semi ';'> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:configuredClient) op: Equal rhs: {(DQ (wget))} spids: [71] ) ] spids: [71] ) ] spids: [53 68] ) ] else_action: [ (SimpleCommand words: [ {(echo)} {(DQ ('Error: This tool requires either curl or wget to be installed.'))} ] redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[86])] ) (ControlFlow token:<ControlFlow_Return return> arg_word:{(1)}) ] spids: [77 95] ) ] spids: [26] ) spids: [22 25] ) (FuncDef name: update body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:repositoryName) op: Equal rhs: {(DQ (Bash-Snippets))} spids: [119] ) ] spids: [119] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:githubUserName) op: Equal rhs: {(DQ (alexanderepstein))} spids: [128] ) ] spids: [128] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:nameOfInstallFile) op: Equal rhs: {(DQ (install.sh))} spids: [137] ) ] spids: [137] ) (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: [147 183] ) } spids: [146] ) ] spids: [146] ) (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:16777215 arg_word:{(2)} spids:[239])] ) (C {(exit)} {(1)}) ] spids: [16777215 230] ) (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:16777215 arg_word:{(2)} spids:[270])] ) (C {(exit)} {(1)}) ] spids: [248 261] ) ] 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: [367] ) ] 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: [411] ) ] op_id: Op_DPipe ) terminator: <Op_Semi ';'> ) ] spids: [16777215 399] ) ] spids: [16777215 429] ) (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: [445] ) ] 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: [469] ) ] 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: [496] ) ] ) (AndOr children: [ (SimpleCommand words: [ {(git)} {(checkout)} {(DQ ($ VSub_Name '$latestVersion'))} ] redirects: [ (Redir op_id: Redir_Great fd: 2 arg_word: {(/dev/null)} spids: [510] ) ] ) (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: [564] ) ] op_id: Op_DPipe ) ] spids: [16777215 358] ) ] else_action: [(C {(exit)} {(1)})] spids: [583 591] ) ] spids: [16777215 299] ) ] else_action: [ (C {(echo)} {(DQ ($ VSub_Name '$repositoryName') (' is already the latest version'))} ) ] spids: [594 605] ) ] spids: [279 608] ) ] spids: [104] ) spids: [100 103] ) (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: [630 631 644 16777215] ) (case_arm pat_list: [{(wget)}] action: [(C {(wget)} {(-qO-)} {(DQ ($ VSub_At '$@'))})] spids: [647 648 657 16777215] ) ] spids: [621 627 660] ) ] spids: [618] ) spids: [614 617] ) (FuncDef name: makeqr body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:input) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Name '$input')}) (C {(sed)} {(s/) (DQ (' ')) (/) (Lit_Other '%') (20/g)}) ] negated: False ) ] ) left_token: <Left_CommandSub '$('> spids: [673 690] ) } spids: [672] ) ] spids: [672] ) (C {(httpGet)} {(qrenco.de/) ($ VSub_Name '$input')}) ] spids: [669] ) spids: [665 668] ) (FuncDef name: makeMultiLineQr body: (BraceGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobNEqual left: {($ VSub_Name '$configuredClient')} right: {(DQ (curl))} ) ) terminator: <Op_Semi ';'> ) ] action: [ (C {(echo)} {(DQ ('Multiline currently only supports curl!'))}) (ControlFlow token:<ControlFlow_Return return> arg_word:{(1)}) ] spids: [16777215 729] ) ] else_action: [ (Pipeline children: [ (C {(printf)} {(DQ ('%s'))} {(DQ ($ VSub_Star '$*'))}) (C {(curl)} {(-F-) (Lit_Other '=') (EscapedLiteralPart token:<Lit_EscapedChar '\\<'>) (-)} {(qrenco.de)} ) ] negated: False ) ] spids: [747 772] ) ] spids: [711] ) spids: [707 710] ) (FuncDef name: checkInternet body: (BraceGroup children: [ (Pipeline children: [ (C {(echo)} {(-e)} {(DQ ('GET http://google.com HTTP/1.0') (Lit_Other '\\') (n) (Lit_Other '\\') (n))} ) (SimpleCommand words: [{(nc)} {(google.com)} {(80)}] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(/dev/null)} spids: [804] ) (Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[808]) ] ) ] 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: [16777215 825] ) ] else_action: [ (SimpleCommand words: [{(echo)} {(DQ ('Error: no active internet connect'))}] redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[842])] ) (ControlFlow token:<ControlFlow_Return return> arg_word:{(1)}) ] spids: [833 851] ) ] spids: [781] ) spids: [777 780] ) (FuncDef name: usage body: (BraceGroup children: [ (C {(echo)} {(DQ (Qrify))}) (C {(echo)} {(DQ ('Usage: qrify [stringtoturnintoqrcode]'))}) (C {(echo)} {(DQ ('Description: Converts strings or urls into a qr code.'))}) (C {(echo)} {(DQ (' -u Update Bash-Snippet Tools'))}) (C {(echo)} {(DQ (' -m Enable multiline support (feature not working yet)'))}) (C {(echo)} {(DQ (' -h Show the help'))}) (C {(echo)} {(DQ (' -v Get the tool version'))}) (C {(echo)} {(DQ ('Examples:'))}) (C {(echo)} {(DQ (' qrify this is a test string'))}) (C {(echo)} { (DQ (' qrify -m two') (EscapedLiteralPart token:<Lit_EscapedChar '\\\\'>) (EscapedLiteralPart token:<Lit_EscapedChar '\\\\'>) (nlines) ) } ) (C {(echo)} {(DQ (' qrify github.com # notice no http:// or https:// this will fail'))}) ] spids: [860] ) spids: [856 859] ) (AndOr children:[(C {(getConfiguredClient)}) (C {(exit)} {(1)})] op_id:Op_DPipe) (AndOr children:[(C {(checkInternet)}) (C {(exit)} {(1)})] op_id:Op_DPipe) (While cond: [(C {(getopts)} {(m) (Lit_Other ':') (hvu) (Lit_Other '*') (Lit_Other ':')} {(option)})] body: (DoGroup children: [ (Case to_match: {(DQ (${ VSub_Name option))} arms: [ (case_arm pat_list: [{(v)}] action: [ (AndOr children: [ (C {(echo)} {(DQ ('Version ') ($ VSub_Name '$currentVersion'))}) (C {(exit)} {(0)}) ] op_id: Op_DAmp ) ] spids: [989 990 1005 16777215] ) (case_arm pat_list: [{(u)}] action: [ (AndOr children: [ (C {(update)}) (AndOr children: [(C {(exit)} {(0)}) (C {(exit)} {(1)})] op_id: Op_DPipe ) ] op_id: Op_DAmp ) ] spids: [1008 1009 1025 16777215] ) (case_arm pat_list: [{(h)}] action: [(AndOr children:[(C {(usage)}) (C {(exit)} {(0)})] op_id:Op_DAmp)] spids: [1028 1029 1039 16777215] ) (case_arm pat_list: [{(m)}] action: [ (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:multiline) op: Equal rhs: {(DQ (1))} spids: [1045] ) ] spids: [1045] ) (AndOr children: [ (C {(echo)} {(DQ ('Error this is not a supported feature yet'))}) (C {(exit)} {(1)}) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] spids: [1042 1043 1064 16777215] ) (case_arm pat_list: [{(Lit_Other '*')}] action: [(AndOr children:[(C {(usage)}) (C {(exit)} {(0)})] op_id:Op_DAmp)] spids: [1067 1068 1078 16777215] ) ] spids: [978 986 1081] ) ] spids: [975 1083] ) ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {($ VSub_Pound '$#')} right: {(DQ (0))} ) ) terminator: <Op_Semi ';'> ) ] action: [(C {(usage)}) (C {(exit)} {(0)})] spids: [16777215 1101] ) (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: [1111 1126] ) (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {($ VSub_Number '$1')} right: {(DQ (update))} ) ) terminator: <Op_Semi ';'> ) ] action: [ (AndOr children:[(C {(update)}) (C {(exit)} {(1)})] op_id:Op_DPipe) (C {(exit)} {(0)}) ] spids: [1136 1150] ) ] else_action: [ (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {($ VSub_Name '$multiline')} right: {(DQ (0))} ) ) terminator: <Op_Semi ';'> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:input) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(printf)} {(SQ <'%s '>)} {(DQ ($ VSub_At '$@'))})] ) left_token: <Left_CommandSub '$('> spids: [1187 1197] ) } spids: [1186] ) ] spids: [1186] ) (AndOr children:[(C {(makeqr)}) (C {(exit)} {(1)})] op_id:Op_DPipe) (C {(exit)} {(0)}) ] spids: [16777215 1183] ) ] else_action: [ (AndOr children: [ (C {(makeMultiLineQr)} { (DQ (BracedVarSub token: <VSub_At '@'> suffix_op: (Slice begin:(ArithWord w:{(Lit_Digits 2)})) spids: [1220 1224] ) ) } ) (C {(exit)} {(1)}) ] op_id: Op_DPipe ) (C {(exit)} {(0)}) ] spids: [1214 1242] ) ] spids: [1166 1244] ) ] )