@@ -14,16 +14,12 @@ use gitql_cli::printer::csv_printer::CSVPrinter;
1414use gitql_cli:: printer:: json_printer:: JSONPrinter ;
1515use gitql_cli:: printer:: table_printer:: TablePrinter ;
1616use gitql_core:: environment:: Environment ;
17- use gitql_core:: schema:: Schema ;
1817use gitql_engine:: data_provider:: DataProvider ;
1918use gitql_engine:: engine;
2019use gitql_parser:: diagnostic:: Diagnostic ;
2120use gitql_parser:: parser;
2221use gitql_parser:: tokenizer:: Tokenizer ;
23- use gitql_std:: aggregation:: aggregation_function_signatures;
24- use gitql_std:: aggregation:: aggregation_functions;
25- use schema:: tables_fields_names;
26- use schema:: tables_fields_types;
22+ use schema:: create_fileql_environment;
2723
2824mod arguments;
2925mod data_provider;
@@ -47,21 +43,8 @@ fn main() {
4743 reporter. report_diagnostic ( "" , Diagnostic :: error ( error. as_str ( ) ) ) ;
4844 return ;
4945 }
50- let schema = Schema {
51- tables_fields_names : tables_fields_names ( ) . to_owned ( ) ,
52- tables_fields_types : tables_fields_types ( ) . to_owned ( ) ,
53- } ;
54-
55- let std_signatures = functions:: fileql_std_signatures ( ) ;
56- let std_functions = functions:: fileql_std_functions ( ) ;
57-
58- let aggregation_signatures = aggregation_function_signatures ( ) ;
59- let aggregation_functions = aggregation_functions ( ) ;
60-
61- let mut env = Environment :: new ( schema) ;
62- env. with_standard_functions ( & std_signatures, std_functions) ;
63- env. with_aggregation_functions ( & aggregation_signatures, aggregation_functions) ;
6446
47+ let mut env = create_fileql_environment ( ) ;
6548 execute_fileql_query ( query, & arguments, files, & mut env, & mut reporter) ;
6649 }
6750 Command :: Help => {
@@ -84,20 +67,7 @@ fn launch_fileql_repl(arguments: Arguments) {
8467 return ;
8568 }
8669
87- let schema = Schema {
88- tables_fields_names : tables_fields_names ( ) . to_owned ( ) ,
89- tables_fields_types : tables_fields_types ( ) . to_owned ( ) ,
90- } ;
91-
92- let std_signatures = functions:: fileql_std_signatures ( ) ;
93- let std_functions = functions:: fileql_std_functions ( ) ;
94-
95- let aggregation_signatures = aggregation_function_signatures ( ) ;
96- let aggregation_functions = aggregation_functions ( ) ;
97-
98- let mut global_env = Environment :: new ( schema) ;
99- global_env. with_standard_functions ( & std_signatures, std_functions) ;
100- global_env. with_aggregation_functions ( & aggregation_signatures, aggregation_functions) ;
70+ let mut global_env = create_fileql_environment ( ) ;
10171
10272 let mut input = String :: new ( ) ;
10373
0 commit comments