31 lines
655 B
C
31 lines
655 B
C
#include <bshell/format.h>
|
|
#include <fx/type.h>
|
|
#include <fx/value-type.h>
|
|
|
|
#if BSHELL_INTERACTIVE == 1
|
|
#include <fx/term/print.h>
|
|
#endif
|
|
|
|
static void format_value_fallback(const fx_value *value, fx_stream *dest)
|
|
{
|
|
#if BSHELL_INTERACTIVE == 1
|
|
fx_printf("[yellow]");
|
|
#endif
|
|
|
|
fx_value_to_string(value, dest, NULL);
|
|
|
|
#if BSHELL_INTERACTIVE == 1
|
|
fx_printf("[reset]\n");
|
|
#endif
|
|
}
|
|
|
|
enum bshell_status format_value_default(const fx_value *value, fx_stream *dest)
|
|
{
|
|
struct bshell_value_writer writer;
|
|
bshell_value_writer_init(&writer, 0, 0, dest);
|
|
bshell_value_writer_write(&writer, value);
|
|
bshell_value_writer_cleanup(&writer);
|
|
|
|
return BSHELL_SUCCESS;
|
|
}
|