build: add support for disabling native command support

This commit is contained in:
2026-07-19 13:34:09 +01:00
parent 422416e99b
commit f189643cf4
7 changed files with 52 additions and 8 deletions
+12 -1
View File
@@ -7,7 +7,6 @@
#include <bshell/status.h>
#include <fx/collections/array.h>
#include <fx/collections/hashtable.h>
#include <fx/diagnostics/process.h>
#include <fx/io/path.h>
#include <fx/reflection/assembly.h>
#include <fx/reflection/function.h>
@@ -15,6 +14,10 @@
#include <fx/string.h>
#include <fx/vector.h>
#if BSHELL_ENABLE_NATIVE_COMMANDS == 1
#include <fx/diagnostics/process.h>
#endif
#if BSHELL_INTERACTIVE == 1
#include <fx/term/print.h>
#endif
@@ -107,6 +110,7 @@ static bshell_command *resolve_cmdlet(
static const fx_string *get_path(void)
{
#if BSHELL_ENABLE_NATIVE_COMMANDS == 1
fx_process *self = fx_process_get_self();
if (!self) {
return NULL;
@@ -125,8 +129,12 @@ static const fx_string *get_path(void)
const fx_string *path = NULL;
fx_value_get_object(path_v, (fx_object **)&path);
return path;
#else
return NULL;
#endif
}
#if BSHELL_ENABLE_NATIVE_COMMANDS == 1
static bshell_command *resolve_native_command_local(
struct bshell_cmdcall_p *cmdcall,
struct bshell_runtime *rt,
@@ -188,6 +196,7 @@ static bshell_command *resolve_native_command(
fx_iterator_unref(it);
return result;
}
#endif
static enum bshell_status resolve_call_target(
struct bshell_cmdcall_p *cmdcall,
@@ -206,11 +215,13 @@ static enum bshell_status resolve_call_target(
return BSHELL_SUCCESS;
}
#if BSHELL_ENABLE_NATIVE_COMMANDS == 1
if ((cmdcall->cmd_target
= resolve_native_command(cmdcall, rt, cmd_name_s))) {
cmdcall->cmd_type = CMDCALL_NATIVE;
return BSHELL_SUCCESS;
}
#endif
const char *cmd_name_cstr = fx_string_get_cstr(cmd_name_s);
#if BSHELL_INTERACTIVE == 1