(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:configuredClient) op:Equal rhs:{(DQ )} spids:[12])] spids: [12] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:directionsFlag) op:Equal rhs:{(DQ (0))} spids:[16])] spids: [16] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:directionsMapFlag) op:Equal rhs:{(DQ (0))} spids:[21])] spids: [21] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:staticMapFlag) op:Equal rhs:{(DQ (0))} spids:[26])] spids: [26] ) (C {(source)} {(TildeSubPart prefix:"") (/.bash_profile)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:MAPQUEST_API_KEY) op: Equal rhs: {($ VSub_Name "$MAPQUEST_API_KEY")} spids: [39] ) ] spids: [39] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(-d)} {(TildeSubPart prefix:"") (/temp)} {(Lit_Other "]")}) terminator: <Op_Semi ";"> ) ] action: [ (Sentence child: (C {(rm)} {(-rf)} {(TildeSubPart prefix:"") (/temp)}) terminator: <Op_Semi ";"> ) ] spids: [-1 53] ) ] spids: [-1 62] ) (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: -1 arg_word: {(/dev/null)} spids: [83] ) ] ) terminator: <Op_Semi ";"> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:configuredClient) op: Equal rhs: {(DQ (curl))} spids: [91] ) ] spids: [91] ) ] spids: [-1 88] ) (if_arm cond: [ (Sentence child: (C {(command)} {(-v)} {(wget)}) terminator: <Op_Amp "&"> ) (Sentence child: (SimpleCommand redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(/dev/null)} spids: [106] ) ] ) terminator: <Op_Semi ";"> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:configuredClient) op: Equal rhs: {(DQ (wget))} spids: [114] ) ] spids: [114] ) ] spids: [97 111] ) (if_arm cond: [ (Sentence child: (C {(command)} {(-v)} {(fetch)}) terminator: <Op_Amp "&"> ) (Sentence child: (SimpleCommand redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(/dev/null)} spids: [129] ) ] ) terminator: <Op_Semi ";"> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:configuredClient) op: Equal rhs: {(DQ (fetch))} spids: [137] ) ] spids: [137] ) ] spids: [120 134] ) ] else_action: [ (C {(echo)} {(DQ ("Error: This tool reqires either curl, wget, or fetch to be installed."))} ) (ControlFlow token:<ControlFlow_Return return> arg_word:{(1)}) ] spids: [143 158] ) ] spids: [71] ) spids: [67 70] ) (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: [183 184 197 -1] ) (case_arm pat_list: [{(wget)}] action: [(C {(wget)} {(-qO-)} {(DQ ($ VSub_At "$@"))})] spids: [200 201 210 -1] ) (case_arm pat_list: [{(fetch)}] action: [(C {(fetch)} {(-o)} {(DQ (...))})] spids: [213 214 223 -1] ) ] spids: [174 180 226] ) ] spids: [171] ) spids: [167 170] ) (FuncDef name: checkInternet body: (BraceGroup children: [ (Pipeline children: [ (C {(echo)} {(-e)} { (DQ ("GET http://google.com HTTP/1.0") (EscapedLiteralPart token:<Lit_EscapedChar "\\n">) (EscapedLiteralPart token:<Lit_EscapedChar "\\n">) ) } ) (SimpleCommand words: [{(nc)} {(google.com)} {(80)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(/dev/null)} spids: [257] ) (Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[261]) ] ) ] 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: [-1 281] ) ] else_action: [ (SimpleCommand words: [{(echo)} {(DQ ("Error: no active internet connection"))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[301])] ) (ControlFlow token:<ControlFlow_Return return> arg_word:{(1)}) ] spids: [292 313] ) ] spids: [236] ) spids: [232 235] ) (FuncDef name: update body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:repositoryName) op: Equal rhs: {(DQ (Bash-Snippets))} spids: [337] ) ] spids: [337] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:githubUserName) op: Equal rhs: {(DQ (alexanderepstein))} spids: [346] ) ] spids: [346] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:nameOfInstallFile) op: Equal rhs: {(DQ (install.sh))} spids: [355] ) ] spids: [355] ) (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: [365 401] ) } spids: [364] ) ] spids: [364] ) (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:-1 arg_word:{(2)} spids:[457])] ) (C {(exit)} {(1)}) ] spids: [-1 448] ) (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:-1 arg_word:{(2)} spids:[488])] ) (C {(exit)} {(1)}) ] spids: [466 479] ) ] 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: [585] ) ] 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: [629] ) ] op_id: Op_DPipe ) terminator: <Op_Semi ";"> ) ] spids: [-1 617] ) ] spids: [-1 647] ) (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: [663] ) ] 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: [687] ) ] 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: [714] ) ] ) (AndOr children: [ (SimpleCommand words: [ {(git)} {(checkout)} {(DQ ($ VSub_Name "$latestVersion"))} ] redirects: [ (Redir op_id: Redir_Great fd: 2 arg_word: {(/dev/null)} spids: [728] ) ] ) (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: [782] ) ] op_id: Op_DPipe ) ] spids: [-1 576] ) ] else_action: [(C {(exit)} {(1)})] spids: [801 809] ) ] spids: [-1 517] ) ] else_action: [ (C {(echo)} {(DQ ($ VSub_Name "$repositoryName") (" is already the latest version"))} ) ] spids: [812 823] ) ] spids: [497 826] ) ] spids: [322] ) spids: [318 321] ) (FuncDef name: getDirections body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:response) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(httpGet)} { (DQ ("https://www.mapquestapi.com/directions/v2/route?key=") ($ VSub_Name "$MAPQUEST_API_KEY") ("&from=") ($ VSub_Number "$1") ("&to=") ($ VSub_Number "$2") ( "&outFormat=json&ambiguities=ignore&routeType=fastest&doReverseGeocode=false&enhancedNarrative=false&avoidTimedConditions=false" ) ) } ) ] ) left_token: <Left_CommandSub "$("> spids: [839 851] ) } spids: [838] ) ] spids: [838] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:firstDirection) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Name "$response")}) (C {(grep)} {(-Eo)} { (DQ (origNarrative) (EscapedLiteralPart token: <Lit_EscapedChar "\\\""> ) (":") (EscapedLiteralPart token:<Lit_EscapedChar "\\\"">) ("[a-Z -./0-9]*") ) } ) (C {(grep)} {(-Eo)} { (DQ ("[^origNarrative") (EscapedLiteralPart token: <Lit_EscapedChar "\\\""> ) (":][a-Z -./0-9]*") ) } ) ] negated: False ) ] ) left_token: <Left_CommandSub "$("> spids: [854 885] ) } spids: [853] ) ] spids: [853] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:tempDirections) op: Equal rhs: { (ArrayLiteralPart words: [ { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Name "$response")}) (C {(grep)} {(-Eo)} { (DQ (EscapedLiteralPart token:<Lit_EscapedChar "\\\"">) (narrative) (EscapedLiteralPart token:<Lit_EscapedChar "\\\"">) (":") (EscapedLiteralPart token: <Lit_EscapedChar "\\\""> ) ("[a-Z -./0-9]*") ) } ) ] negated: False ) ] ) left_token: <Left_CommandSub "$("> spids: [889 908] ) } ] ) } spids: [887] ) ] spids: [887] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:distances) op: Equal rhs: { (ArrayLiteralPart words: [ { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Name "$response")}) (C {(grep)} {(-Eo)} { (DQ (distance) (EscapedLiteralPart token: <Lit_EscapedChar "\\\""> ) (":[0-9]*[.][0-9]*") ) } ) (C {(grep)} {(-Eo)} { (DQ ("[^distance") (EscapedLiteralPart token: <Lit_EscapedChar "\\\""> ) (":][0-9]*[.][0-9]*") ) } ) ] negated: False ) ] ) left_token: <Left_CommandSub "$("> spids: [913 942] ) } ] ) } spids: [911] ) ] spids: [911] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:totalDist) op: Equal rhs: { (BracedVarSub token: <VSub_Name distances> bracket_op: (ArrayIndex expr:(ArithWord w:{(Lit_Digits 0)})) spids: [946 951] ) } spids: [945] ) ] spids: [945] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:count) op:Equal rhs:{(DQ (0))} spids:[953])] spids: [953] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:count) op:Equal rhs:{(DQ (-1))} spids:[958])] spids: [958] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:temp) op: Equal rhs: { (BracedVarSub token: <VSub_Name tempDirections> bracket_op: (ArrayIndex expr:(ArithWord w:{(Lit_Digits 0)})) spids: [964 969] ) } spids: [963] ) ] spids: [963] ) (ForEach iter_name: direct iter_words: [ { (DQ (BracedVarSub token: <VSub_Name tempDirections> bracket_op: (WholeArray op_id:Lit_At) spids: [978 983] ) ) } ] do_arg_iter: False body: (DoGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Name "$direct")}) (C {(grep)} {(-Eo)} {(DQ (narrative))}) ] negated: False ) ] ) left_token: <Left_CommandSub "$("> spids: [993 1008] ) } right: {(DQ (narrative))} ) ) terminator: <Op_Semi ";"> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:count) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Name "$count")} {(Lit_Other "+")} {(1)} ) (C {(bc)}) ] negated: False ) ] ) left_token: <Left_CommandSub "$("> spids: [1022 1035] ) } spids: [1021] ) ] spids: [1021] ) (C {(directions) (Lit_Other "[") ($ VSub_Name "$count") (Lit_Other "]") (Lit_Other "=") ($ VSub_Name "$temp") } ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:temp) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Name "$direct")}) (C {(grep)} {(-Eo)} { (DQ ("[^") (EscapedLiteralPart token: <Lit_EscapedChar "\\\""> ) ("narrative:") (EscapedLiteralPart token:<Lit_EscapedChar "\\\"">) ("][a-Z 0-9./]*") ) } ) ] negated: False ) ] ) left_token: <Left_CommandSub "$("> spids: [1047 1065] ) } spids: [1046] ) ] spids: [1046] ) ] spids: [-1 1018] ) ] else_action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:temp) op: Equal rhs: {(DQ ($ VSub_Name "$temp") (" ") ($ VSub_Name "$direct"))} spids: [1071] ) ] spids: [1071] ) ] spids: [1068 1079] ) ] spids: [986 1082] ) spids: [976 -1] ) (C {(directions) (Lit_Other "[") (0) (Lit_Other "]") (Lit_Other "=") ($ VSub_Name "$firstDirection") } ) ] spids: [836] ) spids: [832 835] ) (FuncDef name: getDirectionsMap body: (BraceGroup children: [ (C {(echo)} { (DQ ("Generating route map from ") ($ VSub_Name "$unformattedFromLocation") (" to ") ($ VSub_Name "$unformattedToLocation") ) } ) (AndOr children: [ (C {(mkdir)} {(TildeSubPart prefix:"") (/temp)}) (ControlFlow token:<ControlFlow_Return return> arg_word:{(1)}) ] op_id: Op_DPipe ) (AndOr children: [ (SimpleCommand words: [ {(httpGet)} { (DQ ("https://www.mapquestapi.com/staticmap/v5/map?start=") ($ VSub_Number "$1") ("&end=") ($ VSub_Number "$2") ("&size=600,400@2x&key=") ($ VSub_Name "$MAPQUEST_API_KEY") ) } ] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(TildeSubPart prefix:"") (/temp/routeImage.png)} spids: [1139] ) ] ) (ControlFlow token:<ControlFlow_Return return> arg_word:{(1)}) ] op_id: Op_DPipe ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ ($ VSub_Name "$OSTYPE"))} right: {(DQ (linux)) (Lit_Other "*")} ) ) terminator: <Op_Semi ";"> ) ] action: [ (AndOr children: [ (SimpleCommand words: [{(display)} {(TildeSubPart prefix:"") (/temp/routeImage.png)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(/dev/null)} spids: [1176] ) ] ) (ControlFlow token: <ControlFlow_Return return> arg_word: {(1)} ) ] op_id: Op_DPipe ) ] spids: [-1 1168] ) (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ ($ VSub_Name "$OSTYPE"))} right: {(DQ (darwin)) (Lit_Other "*")} ) ) terminator: <Op_Semi ";"> ) ] action: [ (SimpleCommand words: [{(open)} {(TildeSubPart prefix:"") (/temp/routeImage.png)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[1213])] ) ] spids: [1187 1205] ) ] spids: [-1 1218] ) (SimpleCommand words: [{(rm)} {(-rf)} {(TildeSubPart prefix:"") (/temp)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[1228])] ) ] spids: [1103] ) spids: [1099 1102] ) (FuncDef name: printDirections body: (BraceGroup children: [ (C {(echo)}) (C {(echo)} { (DQ ("From ") ($ VSub_Name "$unformattedFromLocation") (" to ") ($ VSub_Name "$unformattedToLocation") (" (") ($ VSub_Name "$totalDist") (" mi)") ) } ) (C {(echo)} {(DQ ("==================================================="))}) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:count) op:Equal rhs:{(0)} spids:[1265])] spids: [1265] ) (ForEach iter_name: direct iter_words: [ { (DQ (BracedVarSub token: <VSub_Name directions> bracket_op: (WholeArray op_id:Lit_At) spids: [1276 1281] ) ) } ] do_arg_iter: False body: (DoGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {($ VSub_Name "$count")} {(-ne)} {(0)} {(Lit_Other "]")} ) terminator: <Op_Semi ";"> ) ] action: [ (Sentence child: (C {(echo)} {(-n)} { (DQ (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Name "$count")}) (C {(bc)}) ] negated: False ) ] ) left_token: <Left_CommandSub "$("> spids: [1307 1315] ) ("). ") ) } ) terminator: <Op_Semi ";"> ) ] spids: [-1 1300] ) ] spids: [-1 1319] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobNEqual left: {($ VSub_Name "$direct")} right: {(DQ )} ) ) terminator: <Op_Semi ";"> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:direct) op: Equal rhs: { (DQ ($ VSub_Name "$direct") (" (") (BracedVarSub token: <VSub_Name distances> bracket_op: (ArrayIndex expr: (ArithWord w: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Name "$count")} {(Lit_Other "+")} {(1)} ) (C {(bc)}) ] negated: False ) ] ) left_token: <Left_CommandSub "$("> spids: [1348 1360] ) } ) ) spids: [1345 1362] ) (" mi)") ) } spids: [1341] ) ] spids: [1341] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {($ VSub_Name "$count")} {(-ne)} {(0)} {(Lit_Other "]")} ) terminator: <Op_Semi ";"> ) ] action: [ (Sentence child: (C {(echo)} {($ VSub_Name "$direct")}) terminator: <Op_Semi ";"> ) ] spids: [-1 1379] ) ] spids: [-1 1385] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:count) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Name "$count")} {(Lit_Other "+")} {(1)} ) (C {(bc)}) ] negated: False ) ] ) left_token: <Left_CommandSub "$("> spids: [1389 1402] ) } spids: [1388] ) ] spids: [1388] ) ] spids: [-1 1335] ) ] spids: [-1 1405] ) ] spids: [1285 1408] ) spids: [1274 -1] ) (C {(echo)} {(DQ ("Welcome to ") ($ VSub_Name "$unformattedToLocation"))}) (C {(echo)} {(DQ ("==================================================="))}) (C {(echo)}) ] spids: [1239] ) spids: [1235 1238] ) (FuncDef name: getLocations body: (BraceGroup children: [ (C {(echo)} {(-n)} {(DQ ("Enter your starting location: "))}) (C {(read)} {(fromLocation)}) (C {(echo)} {(-n)} {(DQ ("Enter your destination: "))}) (C {(read)} {(toLocation)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:unformattedFromLocation) op: Equal rhs: {($ VSub_Name "$fromLocation")} spids: [1466] ) ] spids: [1466] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:unformattedToLocation) op: Equal rhs: {($ VSub_Name "$toLocation")} spids: [1470] ) ] spids: [1470] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:fromLocation) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Name "$fromLocation")}) (C {(sed)} {(s/) (SQ <",">) (/) (DQ ("+")) (/g)}) (C {(sed)} {(s/) (SQ <" ">) (/) (DQ ("+")) (/g)}) ] negated: False ) ] ) left_token: <Left_CommandSub "$("> spids: [1475 1508] ) } spids: [1474] ) ] spids: [1474] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:toLocation) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Name "$toLocation")}) (C {(sed)} {(s/) (SQ <",">) (/) (DQ ("+")) (/g)}) (C {(sed)} {(s/) (SQ <" ">) (/) (DQ ("+")) (/g)}) ] negated: False ) ] ) left_token: <Left_CommandSub "$("> spids: [1512 1545] ) } spids: [1511] ) ] spids: [1511] ) ] spids: [1435] ) spids: [1431 1434] ) (FuncDef name: checkImagemagick body: (BraceGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ ($ VSub_Name "$OSTYPE"))} right: {(DQ (linux)) (Lit_Other "*")} ) ) terminator: <Op_Semi ";"> ) ] action: [ (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children: [(C {(command)} {(-v)} {(display)})] negated: True ) terminator: <Op_Amp "&"> ) (Sentence child: (SimpleCommand redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(/dev/null)} spids: [1588] ) ] ) terminator: <Op_Semi ";"> ) ] action: [ (Sentence child: (C {(echo)} { (DQ ( "Error: you need to install imagemagick to use map features." ) ) } ) terminator: <Op_Amp "&"> ) (SimpleCommand redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(2)} spids:[1602])] ) (ControlFlow token: <ControlFlow_Return return> arg_word: {(1)} ) ] spids: [-1 1592] ) ] else_action: [(ControlFlow token:<ControlFlow_Return return> arg_word:{(0)})] spids: [1611 1619] ) ] spids: [-1 1574] ) ] else_action: [(ControlFlow token:<ControlFlow_Return return> arg_word:{(0)})] spids: [1622 1630] ) ] spids: [1554] ) spids: [1550 1553] ) (FuncDef name: getMapLocation body: (BraceGroup children: [ (C {(echo)} {(-n)} {(DQ ("Enter the city or address you want to generate a map for: "))}) (C {(read)} {(mapLocation)}) (C {(echo)} {(DQ ("Generating static map for ") ($ VSub_Name "$mapLocation"))}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:mapLocation) op: Equal rhs: {(Lit_Other "=") (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Name "$mapLocation")}) (C {(sed)} {(s/) (SQ <",">) (/) (DQ ("+")) (/g)}) (C {(sed)} {(s/) (SQ <" ">) (/) (DQ ("+")) (/g)}) ] negated: False ) ] ) left_token: <Left_CommandSub "$("> spids: [1667 1700] ) } spids: [1665] ) ] spids: [1665] ) ] spids: [1640] ) spids: [1636 1639] ) (FuncDef name: getStaticMap body: (BraceGroup children: [ (AndOr children: [ (C {(mkdir)} {(TildeSubPart prefix:"") (/temp)}) (ControlFlow token:<ControlFlow_Return return> arg_word:{(1)}) ] op_id: Op_DPipe ) (AndOr children: [ (SimpleCommand words: [ {(httpGet)} { (DQ ("https://www.mapquestapi.com/staticmap/v5/map?key=") ($ VSub_Name "$MAPQUEST_API_KEY") ("¢er=") ($ VSub_Number "$1") ("&zoom=15&type=hyb&size=600,400@2x") ) } ] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(TildeSubPart prefix:"") (/temp/mapImage.png)} spids: [1734] ) ] ) (ControlFlow token:<ControlFlow_Return return> arg_word:{(1)}) ] op_id: Op_DPipe ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ ($ VSub_Name "$OSTYPE"))} right: {(DQ (linux)) (Lit_Other "*")} ) ) terminator: <Op_Semi ";"> ) ] action: [ (AndOr children: [ (SimpleCommand words: [{(display)} {(TildeSubPart prefix:"") (/temp/mapImage.png)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(/dev/null)} spids: [1771] ) ] ) (ControlFlow token: <ControlFlow_Return return> arg_word: {(1)} ) ] op_id: Op_DPipe ) ] spids: [-1 1763] ) (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ ($ VSub_Name "$OSTYPE"))} right: {(DQ (darwin)) (Lit_Other "*")} ) ) terminator: <Op_Semi ";"> ) ] action: [ (AndOr children: [ (SimpleCommand words: [{(open)} {(TildeSubPart prefix:"") (/temp/mapImage.png)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(/dev/null)} spids: [1808] ) ] ) (ControlFlow token: <ControlFlow_Return return> arg_word: {(1)} ) ] op_id: Op_DPipe ) ] spids: [1782 1800] ) ] spids: [-1 1819] ) (AndOr children: [ (SimpleCommand words: [{(rm)} {(-rf)} {(TildeSubPart prefix:"") (/temp)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[1829])] ) (ControlFlow token:<ControlFlow_Return return> arg_word:{(1)}) ] op_id: Op_DPipe ) ] spids: [1709] ) spids: [1705 1708] ) (AndOr children:[(C {(getConfiguredClient)})(C {(exit)} {(1)})] op_id:Op_DPipe) (AndOr children:[(C {(checkInternet)})(C {(exit)} {(1)})] op_id:Op_DPipe) (While cond: [(Sentence child:(C {(getopts)} {(DQ (drmuvh))} {(opt)}) terminator:<Op_Semi ";">)] body: (DoGroup children: [ (Case to_match: {($ VSub_Name "$opt")} arms: [ (case_arm pat_list: [{(EscapedLiteralPart token:<Lit_EscapedChar "\\?">)}] action: [ (SimpleCommand words: [{(echo)} {(DQ ("Invalid option: -") ($ VSub_Name "$OPTARG"))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[1904])] ) (C {(exit)} {(1)}) ] spids: [1893 1894 1913 -1] ) (case_arm pat_list: [{(h)}] action: [(C {(usage)}) (C {(exit)} {(0)})] spids: [1916 1917 1928 -1] ) (case_arm pat_list: [{(d)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:directionsFlag) op: Equal rhs: {(DQ (1))} spids: [1935] ) ] spids: [1935] ) ] spids: [1931 1932 1941 -1] ) (case_arm pat_list: [{(m)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:staticMapFlag) op: Equal rhs: {(DQ (1))} spids: [1948] ) ] spids: [1948] ) ] spids: [1944 1945 1954 -1] ) (case_arm pat_list: [{(r)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:directionsMapFlag) op: Equal rhs: {(DQ (1))} spids: [1961] ) ] spids: [1961] ) ] spids: [1957 1958 1967 -1] ) (case_arm pat_list: [{(v)}] action: [ (C {(echo)} {(DQ ("Version ") ($ VSub_Name "$currentVersion"))}) (C {(exit)} {(0)}) ] spids: [1970 1971 1987 -1] ) (case_arm pat_list: [{(u)}] action: [(C {(update)}) (C {(exit)} {(0)})] spids: [1990 1991 2002 -1] ) (case_arm pat_list: [{(Lit_Other ":")}] action: [ (SimpleCommand words: [ {(echo)} {(DQ ("Option -") ($ VSub_Name "$OPTARG") (" requires an argument."))} ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[2017])] ) (C {(exit)} {(1)}) ] spids: [2005 2006 2026 -1] ) ] spids: [1886 1890 2029] ) ] spids: [1883 2031] ) ) (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)}) (C {(exit)} {(0)})] spids: [-1 2047] ) (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {($ VSub_Pound "$#")} right: {(DQ (1))} ) ) terminator: <Op_Semi ";"> ) ] action: [ (If arms: [ (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)}) (C {(exit)} {(0)})] spids: [-1 2089] ) (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: [2100 2115] ) ] spids: [-1 2126] ) ] spids: [2057 2072] ) ] spids: [-1 2128] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (LogicalAnd left: (BoolBinary op_id: BoolBinary_GlobDEqual left: {($ VSub_Name "$directionsFlag")} right: {(DQ (0))} ) right: (BoolBinary op_id: BoolBinary_GlobDEqual left: {($ VSub_Name "$staticMapFlag")} right: {(DQ (1))} ) ) ) terminator: <Op_Semi ";"> ) ] action: [ (AndOr children:[(C {(checkImagemagick)})(C {(exit)} {(1)})] op_id:Op_DPipe) (AndOr children:[(C {(getMapLocation)})(C {(exit)} {(1)})] op_id:Op_DPipe) (AndOr children: [(C {(getStaticMap)} {($ VSub_Name "$mapLocation")}) (C {(exit)} {(1)})] op_id: Op_DPipe ) ] spids: [-1 2155] ) (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {($ VSub_Name "$directionsFlag")} right: {(DQ (1))} ) ) terminator: <Op_Semi ";"> ) ] action: [ (AndOr children:[(C {(getLocations)})(C {(exit)} {(1)})] op_id:Op_DPipe) (AndOr children: [ (C {(getDirections)} {($ VSub_Name "$fromLocation")} {($ VSub_Name "$toLocation")}) (C {(exit)} {(1)}) ] op_id: Op_DPipe ) (AndOr children: [ (C {(printDirections)} {($ VSub_Name "$fromLocation")} {($ VSub_Name "$toLocation")}) (C {(exit)} {(1)}) ] op_id: Op_DPipe ) (AndOr children:[(C {(checkImagemagick)})(C {(exit)} {(1)})] op_id:Op_DPipe) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {($ VSub_Name "$directionsMapFlag")} right: {(DQ (1))} ) ) terminator: <Op_Semi ";"> ) ] action: [ (Sentence child: (AndOr children: [ (C {(getDirectionsMap)} {($ VSub_Name "$fromLocation")} {($ VSub_Name "$toLocation")} ) (C {(exit)} {(1)}) ] op_id: Op_DPipe ) terminator: <Op_Semi ";"> ) ] spids: [-1 2261] ) ] spids: [-1 2275] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobEqual left: {($ VSub_Name "$staticMapFlag")} right: {(DQ (1))} ) ) terminator: <Op_Semi ";"> ) ] action: [ (AndOr children: [ (C {(echo)} { (DQ ("Generating static map for ") ($ VSub_Name "$unformattedFromLocation") ) } ) (AndOr children: [ (C {(getStaticMap)} {($ VSub_Name "$fromLocation")}) (C {(exit)} {(1)}) ] op_id: Op_DPipe ) ] op_id: Op_DAmp ) (AndOr children: [ (C {(echo)} { (DQ ("Generating static map for ") ($ VSub_Name "$unformattedToLocation")) } ) (AndOr children: [ (C {(getStaticMap)} {($ VSub_Name "$toLocation")}) (C {(exit)} {(1)}) ] op_id: Op_DPipe ) ] op_id: Op_DAmp ) ] spids: [-1 2292] ) ] spids: [-1 2335] ) ] spids: [2186 2200] ) ] spids: [-1 2337] ) ] )