(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:configuredPython) op: assign_op.Equal rhs: {(DQ )} spids: [16] ) ] ) (C {(source)} {(word_part.TildeSub token:(Token id:Id.Lit_TildeLike val:'~' span_id:22)) (/.bash_profile)} ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:apiKey) op: assign_op.Equal rhs: {($ Id.VSub_DollarName '$TASTE_API_KEY')} spids: [28] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:info) op: assign_op.Equal rhs: {(DQ (0))} spids: [31] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:search) op: assign_op.Equal rhs: {(DQ (0))} spids: [39] ) ] ) (command.ShFunction name: getConfiguredClient body: (command.BraceGroup children: [ (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.Simple words: [{(command)} {(-v)} {(curl)}] redirects: [ (redir.Redir op: (Token id:Id.Redir_AndGreat val:'&>' span_id:66) fd: -1 arg_word: {(/dev/null)} ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:69) ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:configuredClient) op: assign_op.Equal rhs: {(DQ (curl))} spids: [74] ) ] ) ] spids: [58 71] ) (if_arm cond: [ (command.Sentence child: (command.Simple words: [{(command)} {(-v)} {(wget)}] redirects: [ (redir.Redir op: (Token id:Id.Redir_AndGreat val:'&>' span_id:88) fd: -1 arg_word: {(/dev/null)} ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:91) ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:configuredClient) op: assign_op.Equal rhs: {(DQ (wget))} spids: [96] ) ] ) ] spids: [80 93] ) (if_arm cond: [ (command.Sentence child: (command.Simple words: [{(command)} {(-v)} {(fetch)}] redirects: [ (redir.Redir op: (Token id:Id.Redir_AndGreat val:'&>' span_id:110) fd: -1 arg_word: {(/dev/null)} ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:113) ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:configuredClient) op: assign_op.Equal rhs: {(DQ (fetch))} spids: [118] ) ] ) ] spids: [102 115] ) ] else_action: [ (C {(echo)} {(DQ ('Error: This tool reqires either curl, wget, or fetch to be installed.'))} ) (command.ControlFlow token: (Token id:Id.ControlFlow_Return val:return span_id:134) arg_word: {(1)} ) ] ) ] ) ) (command.ShFunction name: getConfiguredPython body: (command.BraceGroup children: [ (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.Simple words: [{(command)} {(-v)} {(python2)}] redirects: [ (redir.Redir op: (Token id:Id.Redir_AndGreat val:'&>' span_id:159) fd: -1 arg_word: {(/dev/null)} ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:162) ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:configuredPython) op: assign_op.Equal rhs: {(DQ (python2))} spids: [167] ) ] ) ] spids: [151 164] ) (if_arm cond: [ (command.Sentence child: (command.Simple words: [{(command)} {(-v)} {(python)}] redirects: [ (redir.Redir op: (Token id:Id.Redir_AndGreat val:'&>' span_id:181) fd: -1 arg_word: {(/dev/null)} ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:184) ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:configuredPython) op: assign_op.Equal rhs: {(DQ (python))} spids: [189] ) ] ) ] spids: [173 186] ) ] else_action: [ (C {(echo)} {(DQ ('Error: This tool requires python 2 to be installed.'))}) (command.ControlFlow token: (Token id:Id.ControlFlow_Return val:return span_id:205) arg_word: {(1)} ) ] ) ] ) ) (command.ShFunction name: python body: (command.BraceGroup children: [ (command.Case to_match: {(DQ ($ Id.VSub_DollarName '$configuredPython'))} arms: [ (case_arm pat_list: [{(python2)}] action: [(C {(python2)} {(DQ ($ Id.VSub_At '$@'))})] spids: [232 233 240 -1] ) (case_arm pat_list: [{(python)}] action: [(C {(python)} {(DQ ($ Id.VSub_At '$@'))})] spids: [243 244 251 -1] ) ] ) ] ) ) (command.ShFunction name: httpGet body: (command.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: [278 279 292 -1] ) (case_arm pat_list: [{(wget)}] action: [(C {(wget)} {(-qO-)} {(DQ ($ Id.VSub_At '$@'))})] spids: [295 296 305 -1] ) (case_arm pat_list: [{(fetch)}] action: [(C {(fetch)} {(-o)} {(DQ (...))})] spids: [308 309 318 -1] ) ] ) ] ) ) (command.ShFunction name: checkInternet body: (command.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.Redir op: (Token id:Id.Redir_Great val:'>' span_id:354) fd: -1 arg_word: {(/dev/null)} ) (redir.Redir op: (Token id:Id.Redir_GreatAnd val:'2>&' span_id:358) fd: 2 arg_word: {(1)} ) ] ) ] negated: F ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(Id.Lit_LBracket '[')} {($ Id.VSub_QMark '$?')} {(-eq)} {(0)} {(Id.Lit_RBracket ']')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:376) ) ] action: [ (command.ControlFlow token: (Token id:Id.ControlFlow_Return val:return span_id:384) arg_word: {(0)} ) ] spids: [365 378] ) ] else_action: [ (command.Simple words: [{(echo)} {(DQ ('Error: no active internet connection'))}] redirects: [ (redir.Redir op: (Token id:Id.Redir_GreatAnd val:'>&' span_id:398) fd: -1 arg_word: {(2)} ) ] ) (command.ControlFlow token: (Token id:Id.ControlFlow_Return val:return span_id:405) arg_word: {(1)} ) ] ) ] ) ) (command.ShFunction name: update body: (command.BraceGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:repositoryName) op: assign_op.Equal rhs: {(DQ (Bash-Snippets))} spids: [434] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:githubUserName) op: assign_op.Equal rhs: {(DQ (alexanderepstein))} spids: [443] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:nameOfInstallFile) op: assign_op.Equal rhs: {(DQ (install.sh))} spids: [452] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:latestVersion) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:462) command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(httpGet)} {(https) (Id.Lit_Other ':') (//api.github.com/repos/) ($ Id.VSub_DollarName '$githubUserName') (/) ($ Id.VSub_DollarName '$repositoryName') (/tags) } ) (C {(grep)} {(-Eo)} { (SQ (Token id: Id.Lit_Chars val: '"name":.*?[^\\\\]",' span_id: 480 ) ) } ) (C {(head)} {(-1)}) (C {(grep)} {(-Eo)} {(DQ ('[0-9.]+'))}) ] negated: F ) ] ) ) } spids: [461] ) ] ) (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: (Token id:Id.Op_Semi val:';' span_id:544) ) ] action: [ (command.Simple words: [ {(echo)} {(DQ ('Error: update utility has not been configured correctly.'))} ] redirects: [ (redir.Redir op: (Token id:Id.Redir_GreatAnd val:'>&' span_id:554) fd: -1 arg_word: {(2)} ) ] ) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:558) arg_word: {(1)} ) ] spids: [505 545] ) (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: (Token id:Id.Op_Semi val:';' span_id:575) ) ] action: [ (command.Simple words: [{(echo)} {(DQ ('Error: no active internet connection'))}] redirects: [ (redir.Redir op: (Token id:Id.Redir_GreatAnd val:'>&' span_id:585) fd: -1 arg_word: {(2)} ) ] ) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:589) arg_word: {(1)} ) ] spids: [563 576] ) ] 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: (Token id:Id.Op_Semi val:';' span_id:612) ) ] 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: (Token id:Id.Op_Semi val:';' span_id:672) ) ] action: [ (command.AndOr ops: [Id.Op_DPipe] children: [ (C {(cd)} { (word_part.TildeSub token: (Token id:Id.Lit_TildeLike val:'~' span_id:678) ) } ) (command.BraceGroup children: [ (command.Sentence child: (C {(echo)} { (SQ (Token id: Id.Lit_Chars val: 'Update Failed' span_id: 687 ) ) } ) terminator: (Token id:Id.Op_Semi val:';' span_id:690) ) (command.Sentence child: (command.ControlFlow token: (Token id: Id.ControlFlow_Exit val: exit span_id: 692 ) arg_word: {(1)} ) terminator: (Token id:Id.Op_Semi val:';' span_id:696) ) ] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Unary op_id: Id.BoolUnary_d child: {(Id.Lit_TildeLike '~') (/) ($ Id.VSub_DollarName '$repositoryName') } ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:712) ) ] action: [ (command.Sentence child: (command.AndOr ops: [Id.Op_DPipe] children: [ (C {(rm)} {(-r)} {(-f)} {($ Id.VSub_DollarName '$repositoryName')} ) (command.BraceGroup children: [ (command.Sentence child: (C {(echo)} { (DQ ( 'Permissions Error: try running the update as sudo' ) ) } ) terminator: (Token id: Id.Op_Semi val: ';' span_id: 733 ) ) (command.Sentence child: (command.ControlFlow token: (Token id: Id.ControlFlow_Exit val: exit span_id: 735 ) arg_word: {(1)} ) terminator: (Token id: Id.Op_Semi val: ';' span_id: 738 ) ) ] ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:742) ) ] spids: [701 714] ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {(git)} {(clone)} { (DQ ('https://github.com/') ($ Id.VSub_DollarName '$githubUserName') (/) ($ Id.VSub_DollarName '$repositoryName') ) } ) (command.BraceGroup children: [ (command.Sentence child: (C {(echo)} {(DQ ("Couldn't download latest version"))}) terminator: (Token id:Id.Op_Semi val:';' span_id:768) ) (command.Sentence child: (command.ControlFlow token: (Token id: Id.ControlFlow_Exit val: exit span_id: 770 ) arg_word: {(1)} ) terminator: (Token id:Id.Op_Semi val:';' span_id:773) ) ] ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {(cd)} {($ Id.VSub_DollarName '$repositoryName')}) (command.BraceGroup children: [ (command.Sentence child: (C {(echo)} { (SQ (Token id: Id.Lit_Chars val: 'Update Failed' span_id: 789 ) ) } ) terminator: (Token id:Id.Op_Semi val:';' span_id:792) ) (command.Sentence child: (command.ControlFlow token: (Token id: Id.ControlFlow_Exit val: exit span_id: 794 ) arg_word: {(1)} ) terminator: (Token id:Id.Op_Semi val:';' span_id:798) ) ] ) ] ) (command.AndOr ops: [Id.Op_DPipe Id.Op_DPipe] children: [ (command.Simple words: [ {(git)} {(checkout)} {(DQ (v) ($ Id.VSub_DollarName '$latestVersion'))} ] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'2>' span_id:811) fd: 2 arg_word: {(/dev/null)} ) ] ) (command.Simple words: [ {(git)} {(checkout)} {(DQ ($ Id.VSub_DollarName '$latestVersion'))} ] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'2>' span_id:825) fd: 2 arg_word: {(/dev/null)} ) ] ) (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: (Token id:Id.ControlFlow_Exit val:exit span_id:859) arg_word: {(1)} ) ] ) (C {(cd)} {(..)}) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {(rm)} {(-r)} {(-f)} {($ Id.VSub_DollarName '$repositoryName')}) (command.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: (Token id:Id.Op_Semi val:';' span_id:888) ) (command.Sentence child: (command.ControlFlow token: (Token id: Id.ControlFlow_Exit val: exit span_id: 890 ) arg_word: {(1)} ) terminator: (Token id:Id.Op_Semi val:';' span_id:893) ) ] ) ] ) ] spids: [644 673] ) ] else_action: [ (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:901) arg_word: {(1)} ) ] ) ] spids: [597 614] ) ] else_action: [ (C {(echo)} { (DQ ($ Id.VSub_DollarName '$repositoryName') (' is already the latest version') ) } ) ] ) ] ) ] ) ) (command.ShFunction name: getSimilar body: (command.BraceGroup children: [ (C {(export)} {(Id.Lit_VarLike 'PYTHONIOENCODING=') (utf8)}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:media) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:949) command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(echo)} {(DQ ($ Id.VSub_At '$@'))}) (C {(tr)} {(DQ (' '))} {(Id.Lit_Other '+')}) ] negated: F ) ] ) ) } spids: [948] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:response) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:971) command_list: (command.CommandList children: [ (C {(httpGet)} { (DQ ('https://tastedive.com/api/similar?q=') ($ Id.VSub_DollarName '$media') ('&k=') ($ Id.VSub_DollarName '$apiKey') ('&info=') ($ Id.VSub_DollarName '$info') ) } ) ] ) ) } spids: [970] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:nameOne) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:990) command_list: (command.CommandList children: [ (command.AndOr ops: [Id.Op_DPipe] children: [ (command.Pipeline children: [ (C {(echo)} {($ Id.VSub_DollarName '$response')}) (command.Simple words: [ {(python)} {(-c)} { (DQ ( "import sys, json; print json.load(sys.stdin)['Similar']['Results'][0]['Name']" ) ) } ] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'2>' span_id:1005) fd: 2 arg_word: {(/dev/null)} ) ] ) ] negated: F ) (command.BraceGroup children: [ (command.Sentence child: (C {(echo)} {(DQ ('Error: Did you search a valid item?'))}) terminator: (Token id:Id.Op_Semi val:';' span_id:1018) ) (command.Sentence child: (command.ControlFlow token: (Token id: Id.ControlFlow_Return val: return span_id: 1020 ) arg_word: {(1)} ) terminator: (Token id:Id.Op_Semi val:';' span_id:1023) ) ] ) ] ) ] ) ) } spids: [989] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:typeOne) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:1031) command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(echo)} {($ Id.VSub_DollarName '$response')}) (command.Simple words: [ {(python)} {(-c)} { (DQ ( "import sys, json; print json.load(sys.stdin)['Similar']['Results'][0]['Type']" ) ) } ] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'2>' span_id:1046) fd: 2 arg_word: {(/dev/null)} ) ] ) ] negated: F ) ] ) ) } spids: [1030] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:nameTwo) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:1053) command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(echo)} {($ Id.VSub_DollarName '$response')}) (command.Simple words: [ {(python)} {(-c)} { (DQ ( "import sys, json; print json.load(sys.stdin)['Similar']['Results'][1]['Name']" ) ) } ] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'2>' span_id:1068) fd: 2 arg_word: {(/dev/null)} ) ] ) ] negated: F ) ] ) ) } spids: [1052] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:typeTwo) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:1075) command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(echo)} {($ Id.VSub_DollarName '$response')}) (command.Simple words: [ {(python)} {(-c)} { (DQ ( "import sys, json; print json.load(sys.stdin)['Similar']['Results'][1]['Type']" ) ) } ] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'2>' span_id:1090) fd: 2 arg_word: {(/dev/null)} ) ] ) ] negated: F ) ] ) ) } spids: [1074] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:nameThree) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:1097) command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(echo)} {($ Id.VSub_DollarName '$response')}) (command.Simple words: [ {(python)} {(-c)} { (DQ ( "import sys, json; print json.load(sys.stdin)['Similar']['Results'][2]['Name']" ) ) } ] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'2>' span_id:1112) fd: 2 arg_word: {(/dev/null)} ) ] ) ] negated: F ) ] ) ) } spids: [1096] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:typeThree) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:1119) command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(echo)} {($ Id.VSub_DollarName '$response')}) (command.Simple words: [ {(python)} {(-c)} { (DQ ( "import sys, json; print json.load(sys.stdin)['Similar']['Results'][2]['Type']" ) ) } ] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'2>' span_id:1134) fd: 2 arg_word: {(/dev/null)} ) ] ) ] negated: F ) ] ) ) } spids: [1118] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobDEqual left: {($ Id.VSub_DollarName '$info')} right: {(DQ (1))} ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:1153) ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:wikiOne) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:1161) command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(echo)} {($ Id.VSub_DollarName '$response')}) (command.Simple words: [ {(python)} {(-c)} { (DQ ( "import sys, json; print json.load(sys.stdin)['Similar']['Results'][0]['wTeaser']" ) ) } ] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'2>' span_id:1176) fd: 2 arg_word: {(/dev/null)} ) ] ) ] negated: F ) ] ) ) } spids: [1160] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:wikiTwo) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:1183) command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(echo)} {($ Id.VSub_DollarName '$response')}) (command.Simple words: [ {(python)} {(-c)} { (DQ ( "import sys, json; print json.load(sys.stdin)['Similar']['Results'][1]['wTeaser']" ) ) } ] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'2>' span_id:1198) fd: 2 arg_word: {(/dev/null)} ) ] ) ] negated: F ) ] ) ) } spids: [1182] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:wikiThree) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:1205) command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(echo)} {($ Id.VSub_DollarName '$response')}) (command.Simple words: [ {(python)} {(-c)} { (DQ ( "import sys, json; print json.load(sys.stdin)['Similar']['Results'][2]['wTeaser']" ) ) } ] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'2>' span_id:1220) fd: 2 arg_word: {(/dev/null)} ) ] ) ] negated: F ) ] ) ) } spids: [1204] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:youtube) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:1227) command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(echo)} {($ Id.VSub_DollarName '$response')}) (command.Simple words: [ {(python)} {(-c)} { (DQ ( "import sys, json; print json.load(sys.stdin)['Similar']['Results'][0]['yUrl']" ) ) } ] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'2>' span_id:1242) fd: 2 arg_word: {(/dev/null)} ) ] ) ] negated: F ) ] ) ) } spids: [1226] ) ] ) ] spids: [1140 1154] ) ] ) ] ) ) (command.ShFunction name: getInfo body: (command.BraceGroup children: [ (C {(export)} {(Id.Lit_VarLike 'PYTHONIOENCODING=') (utf8)}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:media) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:1273) command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(echo)} {(DQ ($ Id.VSub_At '$@'))}) (C {(tr)} {(DQ (' '))} {(Id.Lit_Other '+')}) ] negated: F ) ] ) ) } spids: [1272] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:response) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:1295) command_list: (command.CommandList children: [ (C {(httpGet)} { (DQ ('https://tastedive.com/api/similar?q=') ($ Id.VSub_DollarName '$media') ('&k=') ($ Id.VSub_DollarName '$apiKey') ('&info=') ($ Id.VSub_DollarName '$info') ) } ) ] ) ) } spids: [1294] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:name) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:1310) command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(echo)} {($ Id.VSub_DollarName '$response')}) (C {(python)} {(-c)} { (DQ ( "import sys, json; print json.load(sys.stdin)['Similar']['Info'][0]['Name']" ) ) } ) ] negated: F ) ] ) ) } spids: [1309] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:type) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:1328) command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(echo)} {($ Id.VSub_DollarName '$response')}) (C {(python)} {(-c)} { (DQ ( "import sys, json; print json.load(sys.stdin)['Similar']['Info'][0]['Type']" ) ) } ) ] negated: F ) ] ) ) } spids: [1327] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobDEqual left: {($ Id.VSub_DollarName '$info')} right: {(DQ (1))} ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:1358) ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:wiki) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:1364) command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(echo)} {($ Id.VSub_DollarName '$response')}) (C {(python)} {(-c)} { (DQ ( "import sys, json; print json.load(sys.stdin)['Similar']['Info'][0]['wTeaser']" ) ) } ) ] negated: F ) ] ) ) } spids: [1363] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:youtube) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:1382) command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(echo)} {($ Id.VSub_DollarName '$response')}) (C {(python)} {(-c)} { (DQ ( "import sys, json; print json.load(sys.stdin)['Similar']['Info'][0]['yUrl']" ) ) } ) ] negated: F ) ] ) ) } spids: [1381] ) ] ) ] spids: [1345 1360] ) ] else_action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:wiki) op: assign_op.Equal rhs: {(DQ (None))} spids: [1402] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:youtube) op: assign_op.Equal rhs: {(DQ (None))} spids: [1408] ) ] ) ] ) ] ) ) (command.ShFunction name: printResults body: (command.BraceGroup children: [ (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobDEqual left: {($ Id.VSub_DollarName '$info')} right: {(DQ (1))} ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:1439) ) ] action: [ (C {(echo)} {(DQ ('==================================='))}) (C {(echo)}) (C {(echo)} {($ Id.VSub_DollarName '$nameOne') (Id.Lit_Other ':')} {($ Id.VSub_DollarName '$typeOne')} ) (C {(echo)} {($ Id.VSub_DollarName '$wikiOne')}) (C {(echo)}) (C {(echo)}) (C {(echo)} {($ Id.VSub_DollarName '$nameTwo') (Id.Lit_Other ':')} {($ Id.VSub_DollarName '$typeTwo')} ) (C {(echo)} {($ Id.VSub_DollarName '$wikiTwo')}) (C {(echo)}) (C {(echo)}) (C {(echo)} {($ Id.VSub_DollarName '$nameThree') (Id.Lit_Other ':')} {($ Id.VSub_DollarName '$typeThree')} ) (C {(echo)} {($ Id.VSub_DollarName '$wikiThree')}) (C {(echo)}) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobNEqual left: {($ Id.VSub_DollarName '$youtube')} right: {(DQ (None))} ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:1520) ) ] action: [ (command.Sentence child: (C {(echo)} {($ Id.VSub_DollarName '$youtube')}) terminator: (Token id:Id.Op_Semi val:';' span_id:1526) ) ] spids: [1507 1521] ) ] ) (C {(echo)}) (C {(echo)} {(DQ ('==================================='))}) ] spids: [1426 1440] ) ] else_action: [ (C {(echo)} {(DQ ('==================================='))}) (C {(echo)} {($ Id.VSub_DollarName '$nameOne') (Id.Lit_Other ':')} {($ Id.VSub_DollarName '$typeOne')} ) (C {(echo)} {($ Id.VSub_DollarName '$nameTwo') (Id.Lit_Other ':')} {($ Id.VSub_DollarName '$typeTwo')} ) (C {(echo)} {($ Id.VSub_DollarName '$nameThree') (Id.Lit_Other ':')} {($ Id.VSub_DollarName '$typeThree')} ) (C {(echo)} {(DQ ('==================================='))}) ] ) ] ) ) (command.ShFunction name: printInfo body: (command.BraceGroup children: [ (C {(echo)} {(DQ ('==================================='))}) (C {(echo)}) (C {(echo)} {($ Id.VSub_DollarName '$name') (Id.Lit_Other ':')} {($ Id.VSub_DollarName '$type')} ) (C {(echo)} {($ Id.VSub_DollarName '$wiki')}) (C {(echo)}) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobNEqual left: {($ Id.VSub_DollarName '$youtube')} right: {(DQ (None))} ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:1632) ) ] action: [ (command.Sentence child: (C {(echo)} {($ Id.VSub_DollarName '$youtube')}) terminator: (Token id:Id.Op_Semi val:';' span_id:1638) ) ] spids: [1619 1633] ) ] ) (C {(echo)} {(DQ ('==================================='))}) ] ) ) (command.ShFunction name: usage body: (command.BraceGroup children: [ (C {(echo)} {(DQ (Taste))}) (C {(echo)} { (DQ ( 'Description: A recommendation engine that provides 3 similar items based on some input topic.' ) ) } ) (C {(echo)} {(DQ (' Taste also has the ability to provide information on the item of interest.'))} ) (C {(echo)} {(DQ (' Supports: shows, books, music, artists, movies, authors, games'))}) (C {(echo)} {(DQ ('Usage: taste [flag] [item]'))}) (C {(echo)} {(DQ (' -i Get more information on similar items'))}) (C {(echo)} {(DQ (' -s Get information on the item itself'))}) (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 (' taste -i Kendrick Lamar'))}) (C {(echo)} {(DQ (' taste Catcher in the Rye'))}) (C {(echo)} {(DQ (' taste -s Red Hot Chili Peppers'))}) ] ) ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobDEqual left: {($ Id.VSub_DollarName '$apiKey')} right: {(DQ )} ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:1771) ) ] action: [ (C {(echo)} {(DQ ('Error: API key not setup properly'))}) (C {(echo)} {(DQ ('To get an API key visit https://tastedive.com/account/api_access'))}) (C {(echo)} { (SQ (Token id: Id.Lit_Chars val: 'After getting the API key run the following command: export TASTE_API_KEY="yourAPIKeyGoesHere"' span_id: 1792 ) ) } ) (C {(echo)} { (DQ ( 'After following all the steps and issues still persist try adding export TASTE_API_KEY manually to your .bash_profile' ) ) } ) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:1803) arg_word: {(1)} ) ] spids: [1759 1772] ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {(getConfiguredPython)}) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:1813) arg_word: {(1)} ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {(getConfiguredClient)}) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:1821) arg_word: {(1)} ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {(checkInternet)}) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:1829) arg_word: {(1)} ) ] ) (command.WhileUntil keyword: (Token id:Id.KW_While val:while span_id:1835) cond: [ (command.Sentence child: (C {(getopts)} {(DQ (uvhis))} {(opt)}) terminator: (Token id:Id.Op_Semi val:';' span_id:1844) ) ] body: (command.DoGroup children: [ (command.Case to_match: {($ Id.VSub_DollarName '$opt')} arms: [ (case_arm pat_list: [ { (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\?' span_id:1856) ) } ] action: [ (command.Simple words: [{(echo)} {(DQ ('Invalid option: -') ($ Id.VSub_DollarName '$OPTARG'))}] redirects: [ (redir.Redir op: (Token id:Id.Redir_GreatAnd val:'>&' span_id:1867) fd: -1 arg_word: {(2)} ) ] ) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:1871) arg_word: {(1)} ) ] spids: [1856 1857 1876 -1] ) (case_arm pat_list: [{(h)}] action: [ (C {(usage)}) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:1886) arg_word: {(0)} ) ] spids: [1879 1880 1891 -1] ) (case_arm pat_list: [{(v)}] action: [ (C {(echo)} {(DQ ('Version ') ($ Id.VSub_DollarName '$currentVersion'))}) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:1906) arg_word: {(0)} ) ] spids: [1894 1895 1911 -1] ) (case_arm pat_list: [{(u)}] action: [ (C {(update)}) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:1921) arg_word: {(0)} ) ] spids: [1914 1915 1926 -1] ) (case_arm pat_list: [{(i)}] 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 '$search')} right: {(DQ (0))} ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:1946) ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:info) op: assign_op.Equal rhs: {(DQ (1))} spids: [1950] ) ] ) ] spids: [1933 1947] ) ] else_action: [ (C {(echo)} { (DQ ( 'Error: the options -i and -s are mutually exclusive (-s already uses -i)' ) ) } ) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:1966) arg_word: {(1)} ) ] ) ] spids: [1929 1930 1974 -1] ) (case_arm pat_list: [{(s)}] action: [ (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobNEqual left: {($ Id.VSub_DollarName '$info')} right: {(DQ (1))} ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:1994) ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:search) op: assign_op.Equal rhs: {(DQ (1))} spids: [1998] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:info) op: assign_op.Equal rhs: {(DQ (1))} spids: [2004] ) ] ) ] spids: [1981 1995] ) ] else_action: [ (C {(echo)} { (DQ ( 'Error: the options -i and -s are mutually exclusive (-s already uses -i)' ) ) } ) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:2020) arg_word: {(1)} ) ] ) ] spids: [1977 1978 2028 -1] ) (case_arm pat_list: [{(Id.Lit_Other ':')}] action: [ (command.Simple words: [ {(echo)} { (DQ ('Option -') ($ Id.VSub_DollarName '$OPTARG') (' requires an argument.')) } ] redirects: [ (redir.Redir op: (Token id:Id.Redir_GreatAnd val:'>&' span_id:2043) fd: -1 arg_word: {(2)} ) ] ) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:2047) arg_word: {(1)} ) ] spids: [2031 2032 2052 -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: {(0)} ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:2071) ) ] action: [(C {(usage)})] spids: [2060 2073] ) (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: (Token id:Id.Op_Semi val:';' span_id:2091) ) ] action: [(C {(update)})] spids: [2078 2092] ) (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: (Token id:Id.Op_Semi val:';' span_id:2110) ) ] action: [(C {(usage)})] spids: [2097 2111] ) ] 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 '$search')} right: {(DQ (0))} ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:2132) ) ] 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 '$info')} right: {(DQ (0))} ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:2149) ) ] action: [ (command.AndOr ops: [Id.Op_DPipe] children: [ (C {(getSimilar)} {(DQ ($ Id.VSub_At '$@'))}) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:2161) arg_word: {(1)} ) ] ) (C {(printResults)}) ] spids: [2136 2150] ) ] else_action: [ (command.AndOr ops: [Id.Op_DPipe] children: [ (C {(getSimilar)} { (DQ (braced_var_sub token: (Token id:Id.VSub_At val:'@' span_id:2179) suffix_op: (suffix_op.Slice begin: (arith_expr.ArithWord w:{(Id.Lit_Digits 2)}) ) ) ) } ) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:2187) arg_word: {(1)} ) ] ) (C {(printResults)}) ] ) ] spids: [2119 2133] ) ] else_action: [ (command.AndOr ops: [Id.Op_DPipe] children: [ (C {(getInfo)} { (DQ (braced_var_sub token: (Token id:Id.VSub_At val:'@' span_id:2205) suffix_op: (suffix_op.Slice begin:(arith_expr.ArithWord w:{(Id.Lit_Digits 2)})) ) ) } ) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:2213) arg_word: {(1)} ) ] ) (C {(printInfo)}) ] ) ] ) ] )