(command.CommandList children: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (command.DBracket expr: (bool_expr.Unary op_id: Id.BoolUnary_z child: {(DQ ($ Id.VSub_DollarName '$BALLS_DB_CREDENTIALS'))} ) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:BALLS_DB_CREDENTIALS) op: assign_op.Equal rhs: {(SQ )} spids: [16] ) ] ) ] ) (command.AndOr ops: [Id.Op_DAmp] children: [ (command.DBracket expr: (bool_expr.Unary op_id:Id.BoolUnary_z child:{(DQ ($ Id.VSub_DollarName '$BALLS_DB'))}) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:BALLS_DB) op: assign_op.Equal rhs: {(SQ <balls>)} spids: [32] ) ] ) ] ) (command.ShFunction name: 'balls::model::impl' body: (command.BraceGroup children: [ (command.Sentence child: (C {<local>} {<Id.Lit_VarLike 'model='> (DQ ($ Id.VSub_Number '$1'))}) terminator: <Id.Op_Semi _> ) (C {<shift>}) (command.Sentence child: (C {<local>} {<Id.Lit_VarLike 'mode='> (DQ ($ Id.VSub_Number '$1'))}) terminator: <Id.Op_Semi _> ) (C {<shift>}) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {<exists>} {(DQ ($ Id.VSub_DollarName '$model') <.> ($ Id.VSub_DollarName '$mode'))} ) terminator: <Id.Op_Semi _> ) ] action: [ (C {(DQ ($ Id.VSub_DollarName '$model') <.> ($ Id.VSub_DollarName '$mode'))} {(DQ ($ Id.VSub_At '$@'))} ) ] spids: [75 86] ) (if_arm cond: [ (command.Sentence child: (C {<exists>} {(DQ ($ Id.VSub_DollarName '$model') <'::'> ($ Id.VSub_DollarName '$mode'))} ) terminator: <Id.Op_Semi _> ) ] action: [ (command.WhileUntil keyword: <Id.KW_While while> cond: [(command.Sentence child:(C {<read>} {<line>}) terminator:<Id.Op_Semi _>)] body: (command.DoGroup children: [ (C {<balls> <Id.Lit_Other ':'> <Id.Lit_Other ':'> <model.with>} {(DQ ($ Id.VSub_DollarName '$line'))} {(DQ ($ Id.VSub_DollarName '$model') <'::'> ($ Id.VSub_DollarName '$mode'))} ) ] ) ) ] spids: [100 111] ) (if_arm cond: [ (command.Sentence child: (command.Pipeline children: [ (C {<balls> <Id.Lit_Other ':'> <Id.Lit_Other ':'> <model.fields>}) (C {<matches>} { (DQ <'^'> ($ Id.VSub_DollarName '$mode') (word_part.EscapedLiteral token: <Id.Lit_EscapedChar '\\$'> ) ) } ) ] negated: F ) terminator: <Id.Op_Semi _> ) ] action: [ (C {<balls> <Id.Lit_Other ':'> <Id.Lit_Other ':'> <model.field>} {(DQ ($ Id.VSub_DollarName '$mode'))} ) ] spids: [143 161] ) (if_arm cond: [ (command.Sentence child: (C {<exists>} {(DQ <'balls::model.'> ($ Id.VSub_DollarName '$mode'))}) terminator: <Id.Op_Semi _> ) ] action: [ (C {(DQ <'balls::model.'> ($ Id.VSub_DollarName '$mode'))} {(DQ ($ Id.VSub_At '$@'))} ) ] spids: [174 184] ) ] else_action: [ (C {<stderr>} { (DQ <"oh no! couldn't find "> (word_part.EscapedLiteral token: <Id.Lit_EscapedChar '\\`'> ) ($ Id.VSub_DollarName '$model') <.> ($ Id.VSub_DollarName '$mode') (word_part.EscapedLiteral token: <Id.Lit_EscapedChar '\\`'> ) <.> ) } ) ] ) ] ) ) (command.ShFunction name: 'balls::model.with' body: (command.BraceGroup children: [ (command.Sentence child: (C {<local>} {<Id.Lit_VarLike '__data='> (DQ ($ Id.VSub_Number '$1'))}) terminator: <Id.Op_Semi _> ) (C {<shift>}) (command.Sentence child: (C {<local>} {<Id.Lit_VarLike '__callback='> (DQ ($ Id.VSub_Number '$1'))}) terminator: <Id.Op_Semi _> ) (C {<shift>}) (command.ForEach iter_name: __field iter_words: [ { (command_sub left_token: <Id.Left_DollarParen '$('> command_list: (command.CommandList children: [(C {<balls> <Id.Lit_Other ':'> <Id.Lit_Other ':'> <model.fields>})] ) ) } ] do_arg_iter: F body: (command.DoGroup children: [ (C {<local>} {(DQ ($ Id.VSub_DollarName '$__field')) <Id.Lit_Equals '='> (DQ (command_sub left_token: <Id.Left_DollarParen '$('> command_list: (command.CommandList children: [ (command.Simple words: [ {<balls> <Id.Lit_Other ':'> <Id.Lit_Other ':'> <model.field>} {(DQ ($ Id.VSub_DollarName '$__field'))} ] redirects: [ (redir.Redir op: <Id.Redir_TLess '<<<'> fd: -1 arg_word: { (DQ ($ Id.VSub_DollarName '$__data') <Id.Lit_Other '\\'> <n> ) } ) ] ) ] ) ) ) } ) (C {<local>} {(DQ ($ Id.VSub_DollarName '$__field')) <Id.Lit_Equals '='> (DQ (command_sub left_token: <Id.Left_DollarParen '$('> command_list: (command.CommandList children: [ (command.Simple words: [ {<balls> <Id.Lit_Other ':'> <Id.Lit_Other ':'> <model.field>} {(DQ ($ Id.VSub_DollarName '$__field'))} ] redirects: [ (redir.Redir op: <Id.Redir_TLess '<<<'> fd: -1 arg_word: { (DQ ($ Id.VSub_DollarName '$__data') <Id.Lit_Other '\\'> <n> ) } ) ] ) ] ) ) ) } ) ] ) ) (C {(DQ ($ Id.VSub_DollarName '$__callback'))} {(DQ ($ Id.VSub_At '$@'))}) ] ) ) (command.ShFunction name: 'balls::model' body: (command.BraceGroup children: [ (C {<alias>} {(DQ ($ Id.VSub_Number '$1')) <Id.Lit_Equals '='> (DQ <'balls::model::impl '> ($ Id.VSub_Number '$1')) } ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:BALLS_LAST_MODEL) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Number '$1'))} spids: [357] ) ] ) ] ) ) (command.ShFunction name: 'balls::model.find' body: (command.BraceGroup children: [ (command.Sentence child: (C {<local>} {<Id.Lit_VarLike 'query='> (DQ ($ Id.VSub_Number '$1'))}) terminator: <Id.Op_Semi _> ) (C {<shift>}) (command.ForEach iter_name: param iter_words: [{(DQ ($ Id.VSub_At '$@'))}] do_arg_iter: F body: (command.DoGroup children: [ (C {<db_safe>} {<param>}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:query) op: assign_op.Equal rhs: { (DQ (braced_var_sub token: <Id.VSub_Name query> suffix_op: (suffix_op.PatSub pat: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\?'>)} replace: {($ Id.VSub_DollarName '$param')} replace_mode: Id.Undefined_Tok ) ) ) } spids: [405] ) ] ) ] ) ) (C {<balls> <Id.Lit_Other ':'> <Id.Lit_Other ':'> <model.execute>} { (DQ <'SELECT * from '> (command_sub left_token: <Id.Left_DollarParen '$('> command_list: (command.CommandList children: [ (C {<balls> <Id.Lit_Other ':'> <Id.Lit_Other ':'> <model.table_name>}) ] ) ) <' WHERE '> ($ Id.VSub_DollarName '$query') ) } ) ] ) ) (command.ShFunction name: 'balls::model.fetch_fields' body: (command.BraceGroup children: [ (command.Pipeline children: [ (C {<balls> <Id.Lit_Other ':'> <Id.Lit_Other ':'> <model.execute>} { (DQ <'SHOW COLUMNS IN '> (command_sub left_token: <Id.Left_DollarParen '$('> command_list: (command.CommandList children: [ (C {<balls> <Id.Lit_Other ':'> <Id.Lit_Other ':'> <model.table_name>}) ] ) ) ) } ) (C {<cut>} {<-f1>}) ] negated: F ) ] ) ) (command.ShFunction name: 'balls::model.fields' body: (command.BraceGroup children: [ (C {<local>} {<Id.Lit_VarLike 'fields_var='> (DQ ($ Id.VSub_DollarName '$model')) <_FIELDS>} ) (C {<echo>} {(DQ (braced_var_sub token:<Id.VSub_Name fields_var> prefix_op:(Id.VSub_Bang)))}) ] ) ) (command.ShFunction name: 'balls::model.field_map' body: (command.BraceGroup children: [ (command.Pipeline children: [ (C {<balls> <Id.Lit_Other ':'> <Id.Lit_Other ':'> <model.fields>}) (C {<nl>} {<-nrz>} {<-ba>}) ] negated: F ) ] ) ) (command.ShFunction name: 'balls::model.column_number_for' body: (command.BraceGroup children: [ (C {<local>} {<Id.Lit_VarLike 'field='> (DQ ($ Id.VSub_Number '$1'))}) (command.Pipeline children: [ (C {<balls> <Id.Lit_Other ':'> <Id.Lit_Other ':'> <model.field_map>}) (C {<grep>} { (DQ ($ Id.VSub_DollarName '$field') (word_part.EscapedLiteral token: <Id.Lit_EscapedChar '\\$'> ) ) } ) (C {<cut>} {<-f1>}) ] negated: F ) ] ) ) (command.ShFunction name: 'balls::model.field_at' body: (command.BraceGroup children: [ (C {<local>} {<Id.Lit_VarLike 'idx='> (DQ ($ Id.VSub_Number '$1'))}) (command.Pipeline children: [ (C {<balls> <Id.Lit_Other ':'> <Id.Lit_Other ':'> <model.field_map>}) (C {<grep>} {(DQ <'^0*'> ($ Id.VSub_DollarName '$idx'))}) (C {<cut>} {<-f2->}) ] negated: F ) ] ) ) (command.ShFunction name: 'balls::model.field' body: (command.BraceGroup children: [ (C {<local>} {<Id.Lit_VarLike 'idx='> (DQ (command_sub left_token: <Id.Left_DollarParen '$('> command_list: (command.CommandList children: [ (C {<balls> <Id.Lit_Other ':'> <Id.Lit_Other ':'> <model.column_number_for>} {(DQ ($ Id.VSub_Number '$1'))} ) ] ) ) ) } ) (C {<cut>} {<-f> (DQ ($ Id.VSub_DollarName '$idx'))}) ] ) ) (command.ShFunction name: 'balls::model.table_name' body: (command.BraceGroup children: [ (C {<local>} {<Id.Lit_VarLike 'table_name_var='> (DQ (${ Id.VSub_Name model) <_table_name>)}) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Unary op_id: Id.BoolUnary_n child: {(DQ ($ Id.VSub_Number '$1'))} ) ) terminator: <Id.Op_Semi _> ) ] action: [ (C {<export>} {(DQ ($ Id.VSub_DollarName '$table_name_var')) <Id.Lit_Equals '='> (DQ ($ Id.VSub_Number '$1')) } ) ] spids: [675 688] ) (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Unary op_id: Id.BoolUnary_n child: { (DQ (braced_var_sub token: <Id.VSub_Name table_name_var> prefix_op: (Id.VSub_Bang) ) ) } ) ) terminator: <Id.Op_Semi _> ) ] action: [ (C {<echo>} { (DQ (braced_var_sub token: <Id.VSub_Name table_name_var> prefix_op: (Id.VSub_Bang) ) ) } ) ] spids: [702 718] ) ] else_action: [ (command.Pipeline children: [ (C {<echo>} {(DQ ($ Id.VSub_DollarName '$model'))}) (C {<tr>} {(SQ <'[A-Z]'>)} {(SQ <'[a-z]'>)}) ] negated: F ) ] ) ] ) ) (command.ShFunction name: 'balls::model.execute' body: (command.BraceGroup children: [ (command.Pipeline children: [ (C {<mysql>} {($ Id.VSub_DollarName '$BALLS_DB_CREDENTIALS')} {(DQ ($ Id.VSub_DollarName '$BALLS_DB'))} {<-e>} {(DQ ($ Id.VSub_At '$@'))} ) (C {<tail>} {<-n> <Id.Lit_Other '+'> <2>}) (C {<sed>} {(SQ <s/NULL//g>)}) ] negated: F ) ] ) ) (command.ShFunction name: 'balls::model::load' body: (command.BraceGroup children: [ (command.Sentence child: (C {<local>} {<Id.Lit_VarLike 'file='> (DQ ($ Id.VSub_Number '$1'))}) terminator: <Id.Op_Semi _> ) (C {<shift>}) (C {<.>} {(DQ ($ Id.VSub_DollarName '$file'))}) (C {<local>} {<Id.Lit_VarLike 'model_name='> (DQ ($ Id.VSub_DollarName '$BALLS_LAST_MODEL'))} ) (C {<local>} {<Id.Lit_VarLike 'fields_var='> (DQ ($ Id.VSub_DollarName '$model_name')) <_FIELDS>} ) (C {<export>} {(DQ ($ Id.VSub_DollarName '$fields_var')) <Id.Lit_Equals '='> (DQ (command_sub left_token: <Id.Left_DollarParen '$('> command_list: (command.CommandList children: [ (C {<balls> <Id.Lit_Other ':'> <Id.Lit_Other ':'> <model> <Id.Lit_Other ':'> <Id.Lit_Other ':'> <impl> } {(DQ ($ Id.VSub_DollarName '$model_name'))} {<fetch_fields>} ) ] ) ) ) } ) ] ) ) ] )