2026-05-25 10:33:29 +01:00
|
|
|
#include <bshell/format.h>
|
2026-05-24 20:19:32 +01:00
|
|
|
#include <fx/type.h>
|
|
|
|
|
#include <fx/value-type.h>
|
|
|
|
|
|
2026-05-31 17:31:37 +01:00
|
|
|
#if BSHELL_INTERACTIVE == 1
|
|
|
|
|
#include <fx/term/print.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2026-05-24 20:19:32 +01:00
|
|
|
static void format_value_fallback(const fx_value *value, fx_stream *dest)
|
|
|
|
|
{
|
2026-05-30 21:08:39 +01:00
|
|
|
#if BSHELL_INTERACTIVE == 1
|
2026-05-24 20:19:32 +01:00
|
|
|
fx_printf("[yellow]");
|
2026-05-30 21:08:39 +01:00
|
|
|
#endif
|
|
|
|
|
|
2026-05-24 20:19:32 +01:00
|
|
|
fx_value_to_string(value, dest, NULL);
|
2026-05-30 21:08:39 +01:00
|
|
|
|
|
|
|
|
#if BSHELL_INTERACTIVE == 1
|
2026-05-24 20:19:32 +01:00
|
|
|
fx_printf("[reset]\n");
|
2026-05-30 21:08:39 +01:00
|
|
|
#endif
|
2026-05-24 20:19:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
enum bshell_status format_value_default(const fx_value *value, fx_stream *dest)
|
|
|
|
|
{
|
2026-06-13 13:46:29 +01:00
|
|
|
struct bshell_value_writer writer;
|
2026-06-20 15:10:15 +01:00
|
|
|
bshell_value_writer_init(&writer, 0, 0, dest);
|
2026-06-13 13:46:29 +01:00
|
|
|
bshell_value_writer_write(&writer, value);
|
|
|
|
|
bshell_value_writer_cleanup(&writer);
|
2026-05-24 20:19:32 +01:00
|
|
|
|
|
|
|
|
return BSHELL_SUCCESS;
|
|
|
|
|
}
|