(CommandList children: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:ATLAS_API_URL) op:Equal rhs:{(SQ )} spids:[82])] spids: [82] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:ATLAS_UPLOAD_URL) op: Equal rhs: {(SQ <'https://app.vagrantup.com'>)} spids: [86] ) ] spids: [86] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:DESCRIPTION) op: Equal rhs: {(DQ ('FreeBSD Snapshot Build'))} spids: [91] ) ] spids: [91] ) (FuncDef name: usage body: (BraceGroup children: [ (C {(echo)} {(DQ (${ VSub_Number 0) (' usage:'))}) (C {(echo)} { (DQ ( "-b box-name -d 'box description' -f box-to-upload -k api-key -p provider -u user -v version" ) ) } ) (ControlFlow token:<ControlFlow_Return return> arg_word:{(1)}) ] spids: [101] ) spids: [97 100] ) (FuncDef name: main body: (BraceGroup children: [ (WhileUntil keyword: <KW_While while> cond: [ (Sentence child: (C {(getopts)} {(DQ ('b:d:f:k:p:u:v:'))} {(arg)}) terminator: <Op_Semi ';'> ) ] body: (DoGroup children: [ (Case to_match: {(DQ (${ VSub_Name arg))} arms: [ (case_arm pat_list: [{(b)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:BOX) op: Equal rhs: {(DQ (${ VSub_Name OPTARG))} spids: [165] ) ] spids: [165] ) ] spids: [161 162 173 16777215] ) (case_arm pat_list: [{(d)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:DESCRIPTION) op: Equal rhs: {(DQ (${ VSub_Name OPTARG))} spids: [180] ) ] spids: [180] ) ] spids: [176 177 188 16777215] ) (case_arm pat_list: [{(f)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:FILE) op: Equal rhs: {(DQ (${ VSub_Name OPTARG))} spids: [195] ) ] spids: [195] ) ] spids: [191 192 203 16777215] ) (case_arm pat_list: [{(k)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:KEY) op: Equal rhs: {(DQ (${ VSub_Name OPTARG))} spids: [210] ) ] spids: [210] ) ] spids: [206 207 218 16777215] ) (case_arm pat_list: [{(p)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:PROVIDER) op: Equal rhs: {(DQ (${ VSub_Name OPTARG))} spids: [225] ) ] spids: [225] ) ] spids: [221 222 233 16777215] ) (case_arm pat_list: [{(u)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:USERNAME) op: Equal rhs: {(DQ (${ VSub_Name OPTARG))} spids: [240] ) ] spids: [240] ) ] spids: [236 237 248 16777215] ) (case_arm pat_list: [{(v)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:VERSION) op: Equal rhs: {(DQ (${ VSub_Name OPTARG))} spids: [255] ) ] spids: [255] ) ] spids: [251 252 263 16777215] ) (case_arm pat_list: [{(Lit_Other '*')}] spids: [266 267 270 16777215] ) ] spids: [150 158 273] ) ] spids: [147 276] ) ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(-z)} {(DQ (${ VSub_Name BOX))} {(-o)} {(-z)} {(DQ (${ VSub_Name FILE))} {(-o)} {(-z)} {(DQ (${ VSub_Name KEY))} {(-o)} {(-z)} {(DQ (${ VSub_Name PROVIDER))} {(-o)} {(-z)} {(DQ (${ VSub_Name USERNAME))} {(-o)} {(-z)} {(DQ (${ VSub_Name VERSION))} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (AndOr ops: [Op_DPipe] children: [ (C {(usage)}) (ControlFlow token: <ControlFlow_Exit exit> arg_word: {(0)} ) ] ) ] spids: [16777215 356] ) ] spids: [16777215 368] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:BOXRESULT) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(/usr/local/bin/curl)} {(-s)} { (DQ (${ VSub_Name ATLAS_UPLOAD_URL) (/api/v1/box/) (${ VSub_Name USERNAME) (/) (${ VSub_Name BOX) ('?access_token=') (${ VSub_Name KEY) ) } ) ] ) left_token: <Left_CommandSub '$('> spids: [377 399] ) } spids: [376] ) ] spids: [376] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {($ VSub_QMark '$?')} {(KW_Bang '!') (Lit_Other '=')} {(0)} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (C {(echo)} {(DQ ('Failed to connect to the API'))}) (Sentence child: (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(2)}) terminator: <Op_Semi ';'> ) ] spids: [16777215 416] ) ] spids: [16777215 432] ) (Pipeline children: [ (C {(echo)} {($ VSub_Name '$BOXRESULT')}) (SimpleCommand words: [ {(grep)} { (DQ (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (name) (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (':') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (${ VSub_Name BOX) (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ) } ] redirects: [(Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(/dev/null)})] ) ] negated: F ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {($ VSub_QMark '$?')} {(KW_Bang '!') (Lit_Other '=')} {(0)} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (C {(echo)} {(DQ ('Creating box: ') (${ VSub_Name BOX))}) (SimpleCommand words: [ {(/usr/local/bin/curl)} {(-s)} {(${ VSub_Name ATLAS_UPLOAD_URL) (/api/v1/boxes)} {(-X)} {(POST)} {(-d)} {(DQ ('box[name]=') (${ VSub_Name BOX))} {(-d)} {(DQ ('access_token=') (${ VSub_Name KEY))} ] redirects: [(Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(/dev/null)})] ) (SimpleCommand words: [ {(/usr/local/bin/curl)} {(-s)} {(${ VSub_Name ATLAS_UPLOAD_URL) (/api/v1/box/) (${ VSub_Name USERNAME) (/) (${ VSub_Name BOX) } {(-X)} {(PUT)} {(-d)} {(DQ ('box[is_private]=false'))} {(-d)} {(DQ ('access_token=') (${ VSub_Name KEY))} ] redirects: [(Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(/dev/null)})] ) (SimpleCommand words: [ {(/usr/local/bin/curl)} {(-s)} {(${ VSub_Name ATLAS_UPLOAD_URL) (/api/v1/box/) (${ VSub_Name USERNAME) (/) (${ VSub_Name BOX) } {(-X)} {(PUT)} {(-d)} {(DQ ("box[description]='") (${ VSub_Name DESCRIPTION) ("'"))} {(-d)} {(DQ ('access_token=') (${ VSub_Name KEY))} ] redirects: [(Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(/dev/null)})] ) ] spids: [16777215 474] ) ] else_action: [(C {(echo)} {(DQ ('Box already exists'))})] spids: [607 617] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:VERSIONRESULT) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(/usr/local/bin/curl)} {(-s)} { (DQ (${ VSub_Name ATLAS_UPLOAD_URL) (/api/v1/box/) (${ VSub_Name USERNAME) (/) (${ VSub_Name BOX) (/version/) (${ VSub_Name VERSION) ('?access_token=') (${ VSub_Name KEY) ) } ) ] ) left_token: <Left_CommandSub '$('> spids: [626 652] ) } spids: [625] ) ] spids: [625] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {($ VSub_QMark '$?')} {(KW_Bang '!') (Lit_Other '=')} {(0)} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (C {(echo)} {(DQ ('Failed to connect to the API'))}) (Sentence child: (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(2)}) terminator: <Op_Semi ';'> ) ] spids: [16777215 669] ) ] spids: [16777215 685] ) (Pipeline children: [ (C {(echo)} {($ VSub_Name '$VERSIONRESULT')}) (SimpleCommand words: [{(grep)} {(DQ (version/) (${ VSub_Name VERSION))}] redirects: [(Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(/dev/null)})] ) ] negated: F ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {($ VSub_QMark '$?')} {(KW_Bang '!') (Lit_Other '=')} {(0)} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (C {(echo)} {(DQ ('Creating version: ') (${ VSub_Name VERSION))}) (SimpleCommand words: [ {(/usr/local/bin/curl)} {(-s)} {(${ VSub_Name ATLAS_UPLOAD_URL) (/api/v1/box/) (${ VSub_Name USERNAME) (/) (${ VSub_Name BOX) (/versions) } {(-X)} {(POST)} {(-d)} {(DQ ('version[version]=') (${ VSub_Name VERSION))} {(-d)} {(DQ ('access_token=') (${ VSub_Name KEY))} ] redirects: [(Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(/dev/null)})] ) (SimpleCommand words: [ {(/usr/local/bin/curl)} {(-s)} {(${ VSub_Name ATLAS_UPLOAD_URL) (/api/v1/box/) (${ VSub_Name USERNAME) (/) (${ VSub_Name BOX) (/version/) (${ VSub_Name VERSION) } {(-X)} {(PUT)} {(-d)} {(DQ ('version[description]=') (${ VSub_Name DESCRIPTION))} {(-d)} {(DQ ('access_token=') (${ VSub_Name KEY))} ] redirects: [(Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(/dev/null)})] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:VERSIONRESULT) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(/usr/local/bin/curl)} {(-s)} { (DQ (${ VSub_Name ATLAS_UPLOAD_URL) (/api/v1/box/) (${ VSub_Name USERNAME) (/) (${ VSub_Name BOX) (/version/) (${ VSub_Name VERSION) ('?access_token=') (${ VSub_Name KEY) ) } ) ] ) left_token: <Left_CommandSub '$('> spids: [827 853] ) } spids: [826] ) ] spids: [826] ) (Pipeline children: [ (C {(echo)} {($ VSub_Name '$VERSIONRESULT')}) (SimpleCommand words: [{(grep)} {(DQ (version/) (${ VSub_Name VERSION))}] redirects: [(Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(/dev/null)})] ) ] negated: F ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {($ VSub_QMark '$?')} {(KW_Bang '!') (Lit_Other '=')} {(0)} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (C {(echo)} {(DQ ('Failed to create version'))}) (ControlFlow token: <ControlFlow_Exit exit> arg_word: {(2)} ) ] spids: [16777215 890] ) ] spids: [16777215 905] ) ] spids: [16777215 722] ) ] else_action: [(C {(echo)} {(DQ ('Version already exists'))})] spids: [908 918] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:PROVIDERRESULT) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(/usr/local/bin/curl)} {(-s)} { (DQ (${ VSub_Name ATLAS_UPLOAD_URL) (/api/v1/box/) (${ VSub_Name USERNAME) (/) (${ VSub_Name BOX) (/version/) (${ VSub_Name VERSION) (/provider/) (${ VSub_Name PROVIDER) ('?access_token=') (${ VSub_Name KEY) ) } ) ] ) left_token: <Left_CommandSub '$('> spids: [927 957] ) } spids: [926] ) ] spids: [926] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {($ VSub_QMark '$?')} {(KW_Bang '!') (Lit_Other '=')} {(0)} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (C {(echo)} {(DQ ('Failed to connect to the API'))}) (Sentence child: (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(2)}) terminator: <Op_Semi ';'> ) ] spids: [16777215 974] ) ] spids: [16777215 990] ) (Pipeline children: [ (C {(echo)} {($ VSub_Name '$PROVIDERRESULT')}) (SimpleCommand words: [{(grep)} {(DQ (provider/) (${ VSub_Name PROVIDER))}] redirects: [(Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(/dev/null)})] ) ] negated: F ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {($ VSub_QMark '$?')} {(KW_Bang '!') (Lit_Other '=')} {(0)} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (C {(echo)} {(DQ ('Creating provider: ') (${ VSub_Name PROVIDER))}) (SimpleCommand words: [ {(/usr/local/bin/curl)} {(-s)} {(${ VSub_Name ATLAS_UPLOAD_URL) (/api/v1/box/) (${ VSub_Name USERNAME) (/) (${ VSub_Name BOX) (/version/) (${ VSub_Name VERSION) (/providers) } {(-X)} {(POST)} {(-d)} {(DQ ('provider[name]=') (${ VSub_Name PROVIDER))} {(-d)} {(DQ ('access_token=') (${ VSub_Name KEY))} ] redirects: [(Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(/dev/null)})] ) ] spids: [16777215 1027] ) ] else_action: [(C {(echo)} {(DQ ('Provider already exists'))})] spids: [1088 1098] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:TOKENRESULT) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(/usr/local/bin/curl)} {(-s)} { (DQ (${ VSub_Name ATLAS_UPLOAD_URL) (/api/v1/box/) (${ VSub_Name USERNAME) (/) (${ VSub_Name BOX) (/version/) (${ VSub_Name VERSION) (/provider/) (${ VSub_Name PROVIDER) ('/upload?access_token=') (${ VSub_Name KEY) ) } ) ] ) left_token: <Left_CommandSub '$('> spids: [1107 1137] ) } spids: [1106] ) ] spids: [1106] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {($ VSub_QMark '$?')} {(KW_Bang '!') (Lit_Other '=')} {(0)} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (C {(echo)} {(DQ ('Failed to get the token from the API'))}) (Sentence child: (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(2)}) terminator: <Op_Semi ';'> ) ] spids: [16777215 1154] ) ] spids: [16777215 1170] ) (Pipeline children: [ (C {(echo)} {(${ VSub_Name TOKENRESULT)}) (SimpleCommand words: [{(grep)} {(-E)} {(DQ (upload_path))}] redirects: [(Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(/dev/null)})] ) ] negated: F ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {($ VSub_QMark '$?')} {(KW_Bang '!') (Lit_Other '=')} {(0)} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (C {(echo)} {(DQ ('No token found from the API'))}) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(2)}) ] spids: [16777215 1208] ) ] else_action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:TOKEN) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Name '$TOKENRESULT')}) (C {(sed)} {(-e)} {(SQ <'s/.*token":"//'>)} {(-e)} {(SQ <'s/.*upload_path":"//'>)} {(-e)} {(SQ <'s/}$//g'>)} {(-e)} {(SQ <'s/"//g'>)} ) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> spids: [1227 1259] ) } spids: [1226] ) ] spids: [1226] ) (C {(echo)} {(DQ ('Uploading to Atlas'))}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:UPLOADRESULT) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(/usr/local/bin/curl)} {(-s)} {(-X)} {(PUT)} {(--upload-file)} {(${ VSub_Name FILE)} {(DQ (${ VSub_Name TOKEN))} ) ] ) left_token: <Left_CommandSub '$('> spids: [1270 1290] ) } spids: [1269] ) ] spids: [1269] ) (C {(echo)} {(DQ (Validating))}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:VALIDRESULT) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(/usr/local/bin/curl)} {(-s)} { (DQ (${ VSub_Name ATLAS_UPLOAD_URL) (/api/v1/box/) (${ VSub_Name USERNAME) (/) (${ VSub_Name BOX) (/version/) (${ VSub_Name VERSION) (/provider/) (${ VSub_Name PROVIDER) ('?access_token=') (${ VSub_Name KEY) ) } ) ] ) left_token: <Left_CommandSub '$('> spids: [1306 1336] ) } spids: [1305] ) ] spids: [1305] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:HOSTED_TOKEN) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Name '$VALIDRESULT')}) (C {(sed)} {(-e)} {(SQ <'s/.*"hosted"://'>)} {(-e)} {(SQ <'s/,.*$//'>)} ) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> spids: [1340 1360] ) } spids: [1339] ) ] spids: [1339] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(KW_Bang '!')} {(-z)} {(${ VSub_Name TOKEN)} {(-a)} {(DQ (${ VSub_Name HOSTED_TOKEN))} {(KW_Bang '!') (Lit_Other '=')} {(DQ (true))} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (C {(echo)} {(DQ ('Upload failed, try again.'))}) (ControlFlow token: <ControlFlow_Exit exit> arg_word: {(2)} ) ] spids: [16777215 1393] ) ] spids: [16777215 1408] ) (C {(echo)} { (DQ ('Releasing ') (${ VSub_Name VERSION) (' of ') (${ VSub_Name BOX) (' in Atlas')) } ) (SimpleCommand words: [ {(/usr/local/bin/curl)} {(-s)} {(${ VSub_Name ATLAS_UPLOAD_URL) (/api/v1/box/) (${ VSub_Name USERNAME) (/) (${ VSub_Name BOX) (/version/) (${ VSub_Name VERSION) (/release) } {(-X)} {(PUT)} {(-d)} {(DQ ('access_token=') (${ VSub_Name KEY))} ] redirects: [(Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(/dev/null)})] ) ] spids: [1223 1470] ) ] spids: [133] ) spids: [128 132] ) (C {(main)} {(DQ ($ VSub_At '$@'))}) ] )