(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:multiline) op: assign_op.Equal rhs: {(DQ <0>)} spids: [12] ) ] ) (command.ShFunction name: getConfiguredClient body: (BraceGroup children: [ (command.If arms: [ (if_arm cond: [ (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: [46] ) ] ) ] spids: [29 43] ) (if_arm cond: [ (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: [69] ) ] ) ] spids: [52 66] ) ] else_action: [ (command.Simple words: [ {<echo>} {(DQ <'Error: This tool requires either curl or wget to be installed.'>)} ] 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: 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: [117] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:githubUserName) op: assign_op.Equal rhs: {(DQ <alexanderepstein>)} spids: [126] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:nameOfInstallFile) op: assign_op.Equal rhs: {(DQ <install.sh>)} spids: [135] ) ] ) (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: [144] ) ] ) (command.If arms: [ (if_arm cond: [ (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: [188 228] ) (if_arm cond: [ (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: [246 259] ) ] else_action: [ (command.If arms: [ (if_arm cond: [ (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: [ (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: [ (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: [384 397] ) ] ) (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: [327 356] ) ] else_action: [ (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) ] ) ] spids: [280 297] ) ] else_action: [ (C {<echo>} { (DQ ($ Id.VSub_DollarName '$repositoryName') <' is already the latest version'> ) } ) ] ) ] ) ] ) ) (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: [628 629 642 -1] ) (case_arm pat_list: [{<wget>}] action: [(C {<wget>} {<-qO->} {(DQ ($ Id.VSub_At '$@'))})] spids: [645 646 655 -1] ) ] ) ] ) ) (command.ShFunction name: makeqr body: (BraceGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:input) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.Pipeline children: [ (C {<echo>} {($ Id.VSub_DollarName '$input')}) (C {<sed>} {<'s/'> (DQ <' '>) <'/'> <Id.Lit_Other '%'> <'20/g'>}) ] negated: F ) ) } spids: [670] ) ] ) (C {<httpGet>} {<'qrenco.de/'> ($ Id.VSub_DollarName '$input')}) ] ) ) (command.ShFunction name: makeMultiLineQr body: (BraceGroup children: [ (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobNEqual left: {($ Id.VSub_DollarName '$configuredClient')} right: {(DQ <curl>)} ) ) terminator: <Id.Op_Semi _> ) ] action: [ (C {<echo>} {(DQ <'Multiline currently only supports curl!'>)}) (command.ControlFlow token: <Id.ControlFlow_Return return> arg_word: {<1>} ) ] spids: [712 727] ) ] else_action: [ (command.Pipeline children: [ (C {<printf>} {(DQ <'%s'>)} {(DQ ($ Id.VSub_Star '$*'))}) (C {<curl>} {<-F-> <Id.Lit_Equals '='> (word_part.EscapedLiteral token: <Id.Lit_EscapedChar '\\<'> ) <-> } {<qrenco.de>} ) ] negated: F ) ] ) ] ) ) (command.ShFunction name: checkInternet body: (BraceGroup children: [ (command.Pipeline children: [ (C {<echo>} {<-e>} { (DQ <'GET http://google.com HTTP/1.0'> <Id.Lit_Other '\\'> <n> <Id.Lit_Other '\\'> <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: [ (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: [810 823] ) ] else_action: [ (command.Simple words: [{<echo>} {(DQ <'Error: no active internet connect'>)}] 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: 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'> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\\'>) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\\'>) <nlines> ) } ) (C {<echo>} {(DQ <' qrify github.com # notice no http:// or https:// this will fail'>)}) ] ) ) (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: [ (C {<getopts>} {<m> <Id.Lit_Colon ':'> <hvu> <Id.Lit_Star '*'> <Id.Lit_Colon ':'>} {<option>}) ] body: (command.DoGroup children: [ (command.Case to_match: {(DQ (${ Id.VSub_Name option))} arms: [ (case_arm pat_list: [{<v>}] action: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (C {<echo>} {(DQ <'Version '> ($ Id.VSub_DollarName '$currentVersion'))}) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<0>} ) ] ) ] spids: [987 988 1003 -1] ) (case_arm pat_list: [{<u>}] action: [ (command.AndOr ops: [Id.Op_DAmp Id.Op_DPipe] children: [ (C {<update>}) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<0>} ) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) ] ) ] spids: [1006 1007 1023 -1] ) (case_arm pat_list: [{<h>}] action: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (C {<usage>}) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<0>} ) ] ) ] spids: [1026 1027 1037 -1] ) (case_arm pat_list: [{<m>}] action: [ (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp] children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:multiline) op: assign_op.Equal rhs: {(DQ <1>)} spids: [1043] ) ] ) (C {<echo>} {(DQ <'Error this is not a supported feature yet'>)}) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) ] ) ] spids: [1040 1041 1062 -1] ) (case_arm pat_list: [{<Id.Lit_Star '*'>}] action: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (C {<usage>}) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<0>} ) ] ) ] spids: [1065 1066 1076 -1] ) ] ) ] ) ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobDEqual left: {($ Id.VSub_Pound '$#')} right: {(DQ <0>)} ) ) terminator: <Id.Op_Semi _> ) ] action: [(C {<usage>}) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<0>})] spids: [1084 1099] ) (if_arm cond: [ (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: [1109 1124] ) (if_arm cond: [ (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: [ (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<update>}) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>}) ] ) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<0>}) ] spids: [1134 1148] ) ] else_action: [ (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobDEqual left: {($ Id.VSub_DollarName '$multiline')} right: {(DQ <0>)} ) ) terminator: <Id.Op_Semi _> ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:input) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<printf>} {(SQ <'%s '>)} {(DQ ($ Id.VSub_At '$@'))}) ) } spids: [1184] ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<makeqr>}) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) ] ) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<0>}) ] spids: [1167 1181] ) ] else_action: [ (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<makeMultiLineQr>} { (DQ (braced_var_sub token: <Id.VSub_At '@'> suffix_op: (suffix_op.Slice begin:{<Id.Lit_Digits 2>}) ) ) } ) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>}) ] ) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<0>}) ] ) ] ) ] )