fx.cmdline: convert to new assembly build system
This commit is contained in:
+20
-8
@@ -1,7 +1,7 @@
|
||||
#include "command.h"
|
||||
|
||||
#include <fx/cmd.h>
|
||||
#include <fx/ds/string.h>
|
||||
#include <fx/string.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -54,7 +54,8 @@ fx_status fx_command_arg_set_name(struct fx_command_arg *arg, const char *name)
|
||||
}
|
||||
|
||||
fx_status fx_command_arg_set_description(
|
||||
struct fx_command_arg *arg, const char *description)
|
||||
struct fx_command_arg *arg,
|
||||
const char *description)
|
||||
{
|
||||
char *desc = fx_strdup(description);
|
||||
if (!desc) {
|
||||
@@ -71,14 +72,16 @@ fx_status fx_command_arg_set_description(
|
||||
}
|
||||
|
||||
fx_status fx_command_arg_set_nr_values(
|
||||
struct fx_command_arg *arg, enum fx_command_arg_value_count nr_values)
|
||||
struct fx_command_arg *arg,
|
||||
enum fx_command_arg_value_count nr_values)
|
||||
{
|
||||
arg->arg_nr_values = nr_values;
|
||||
return FX_SUCCESS;
|
||||
}
|
||||
|
||||
fx_status fx_command_arg_set_allowed_values(
|
||||
struct fx_command_arg *arg, const char **allowed_values)
|
||||
struct fx_command_arg *arg,
|
||||
const char **allowed_values)
|
||||
{
|
||||
size_t count;
|
||||
for (count = 0; allowed_values[count]; count++)
|
||||
@@ -102,7 +105,10 @@ fx_status fx_command_arg_set_allowed_values(
|
||||
return FX_SUCCESS;
|
||||
}
|
||||
|
||||
void z__fx_get_arg_usage_string(struct fx_command_arg *arg, bool colour, fx_string *out)
|
||||
void z__fx_get_arg_usage_string(
|
||||
struct fx_command_arg *arg,
|
||||
bool colour,
|
||||
fx_string *out)
|
||||
{
|
||||
bool optional = false, multi = false;
|
||||
switch (arg->arg_nr_values) {
|
||||
@@ -126,10 +132,14 @@ void z__fx_get_arg_usage_string(struct fx_command_arg *arg, bool colour, fx_stri
|
||||
|
||||
if (optional) {
|
||||
fx_string_append_cstrf(
|
||||
out, colour ? F_GREEN "[[%s]" : "[[%s]", arg->arg_name);
|
||||
out,
|
||||
colour ? F_GREEN "[[%s]" : "[[%s]",
|
||||
arg->arg_name);
|
||||
} else {
|
||||
fx_string_append_cstrf(
|
||||
out, colour ? F_GREEN "<%s>" : "<%s>", arg->arg_name);
|
||||
out,
|
||||
colour ? F_GREEN "<%s>" : "<%s>",
|
||||
arg->arg_name);
|
||||
}
|
||||
|
||||
for (int i = 1; i < arg->arg_nr_values; i++) {
|
||||
@@ -167,7 +177,9 @@ void z__fx_get_arg_description(struct fx_command_arg *arg, fx_string *out)
|
||||
}
|
||||
|
||||
fx_string_append_cstrf(
|
||||
out, " " F_GREEN "%s" F_RESET, arg->arg_allowed_values[i]);
|
||||
out,
|
||||
" " F_GREEN "%s" F_RESET,
|
||||
arg->arg_allowed_values[i]);
|
||||
}
|
||||
|
||||
fx_string_append_cstr(out, "]");
|
||||
|
||||
Reference in New Issue
Block a user