runtime: move value formatting functionality to a dedicated api
This commit is contained in:
@@ -353,10 +353,8 @@ static enum bshell_status eval_instruction(
|
||||
}
|
||||
|
||||
int end_of_data = 0;
|
||||
bool columns_initialised = false;
|
||||
fx_value record = FX_VALUE_EMPTY;
|
||||
struct bshell_table_ctx table_ctx;
|
||||
bshell_table_ctx_init(&table_ctx, fx_stdout);
|
||||
bshell_runtime_begin_output(rt);
|
||||
while (1) {
|
||||
bstatus = bshell_pipeline_pump_record(
|
||||
pipeline,
|
||||
@@ -371,22 +369,11 @@ static enum bshell_status eval_instruction(
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!columns_initialised) {
|
||||
const fx_type *ty
|
||||
= fx_type_get_by_id(record.v_type);
|
||||
bshell_table_ctx_prepare_columns_from_format(
|
||||
&table_ctx,
|
||||
ty,
|
||||
NULL);
|
||||
bshell_table_ctx_print_headers(&table_ctx);
|
||||
columns_initialised = true;
|
||||
}
|
||||
|
||||
bshell_table_ctx_print_record(&table_ctx, &record);
|
||||
bshell_runtime_output_value(rt, &record);
|
||||
fx_value_unset(&record);
|
||||
}
|
||||
|
||||
bshell_table_ctx_cleanup(&table_ctx);
|
||||
bshell_runtime_end_output(rt);
|
||||
bshell_pipeline_unref(pipeline);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user