frontend: evaluate <config>/profile.bshell on startup

This commit is contained in:
2026-06-15 17:41:41 +01:00
parent b8a5bd7338
commit 907e0c1832
+25
View File
@@ -9,6 +9,7 @@
#include <bshell/parse/token.h>
#include <bshell/verb.h>
#include <fx/cmdline/cmd.h>
#include <fx/io/path.h>
#include <stdio.h>
enum {
@@ -83,6 +84,30 @@ static int bshell(
frontend_init(&ctx, flags);
enum bshell_status status = BSHELL_SUCCESS;
fx_path *config_base_dir = fx_path_get_system(FX_PATH_CONFIG);
fx_path *profile_path = fx_path_join_list(
3,
&FX_VALUE_OBJECT(config_base_dir),
&FX_CSTR("bshell"),
&FX_CSTR("profile.bshell"));
fx_path_unref(config_base_dir);
if (fx_path_is_file(profile_path)) {
status = frontend_eval_file(
&ctx,
NULL,
fx_path_get_cstr(profile_path));
if (status != BSHELL_SUCCESS) {
fprintf(stderr,
"%s: cannot evaluate '%s': %s\n",
exec_name,
fx_path_get_cstr(profile_path),
bshell_status_get_description(status));
}
}
fx_path_unref(profile_path);
size_t nr_input_files = fx_arglist_get_count(
opt,
FX_COMMAND_INVALID_ID,