frontend: evaluate <config>/profile.bshell on startup
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
#include <bshell/parse/token.h>
|
#include <bshell/parse/token.h>
|
||||||
#include <bshell/verb.h>
|
#include <bshell/verb.h>
|
||||||
#include <fx/cmdline/cmd.h>
|
#include <fx/cmdline/cmd.h>
|
||||||
|
#include <fx/io/path.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@@ -83,6 +84,30 @@ static int bshell(
|
|||||||
frontend_init(&ctx, flags);
|
frontend_init(&ctx, flags);
|
||||||
enum bshell_status status = BSHELL_SUCCESS;
|
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(
|
size_t nr_input_files = fx_arglist_get_count(
|
||||||
opt,
|
opt,
|
||||||
FX_COMMAND_INVALID_ID,
|
FX_COMMAND_INVALID_ID,
|
||||||
|
|||||||
Reference in New Issue
Block a user