mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-29 05:03:46 +08:00
Only use DATADIR in $fish_function_path if no-config is used
This only uses the functions fish ships with, but still doesn't allow any *customization*, which is the point of no-config. This makes it a lot more usable, given that the actual normal prompt and things are there. This still doesn't set any colors, because we don't run __fish_config_interactive because we don't read config.fish (any config.fish), because that would run the snippets.
This commit is contained in:
parent
848f7a0787
commit
5ddb1adac1
|
@ -282,6 +282,9 @@ void env_init(const struct config_paths_t *paths, bool do_uvars) {
|
||||||
vars.set_one(FISH_SYSCONFDIR_VAR, ENV_GLOBAL, paths->sysconf);
|
vars.set_one(FISH_SYSCONFDIR_VAR, ENV_GLOBAL, paths->sysconf);
|
||||||
vars.set_one(FISH_HELPDIR_VAR, ENV_GLOBAL, paths->doc);
|
vars.set_one(FISH_HELPDIR_VAR, ENV_GLOBAL, paths->doc);
|
||||||
vars.set_one(FISH_BIN_DIR, ENV_GLOBAL, paths->bin);
|
vars.set_one(FISH_BIN_DIR, ENV_GLOBAL, paths->bin);
|
||||||
|
wcstring scstr = paths->data;
|
||||||
|
scstr.append(L"/functions");
|
||||||
|
vars.set_one(L"fish_function_path", ENV_GLOBAL, scstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Some `su`s keep $USER when changing to root.
|
// Some `su`s keep $USER when changing to root.
|
||||||
|
|
|
@ -474,7 +474,7 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
struct config_paths_t paths;
|
struct config_paths_t paths;
|
||||||
// If we're not executing, there's no need to find the config.
|
// If we're not executing, there's no need to find the config.
|
||||||
if (!opts.no_exec && !opts.no_config) {
|
if (!opts.no_exec) {
|
||||||
paths = determine_config_directory_paths(argv[0]);
|
paths = determine_config_directory_paths(argv[0]);
|
||||||
}
|
}
|
||||||
if (!opts.no_exec) {
|
if (!opts.no_exec) {
|
||||||
|
|
16
tests/checks/no-config.fish
Normal file
16
tests/checks/no-config.fish
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
#RUN: %fish --no-config %s
|
||||||
|
|
||||||
|
functions | string match help
|
||||||
|
# CHECK: help
|
||||||
|
|
||||||
|
# Universal variables are disabled, we fall back to setting them as global
|
||||||
|
set -U
|
||||||
|
# CHECK:
|
||||||
|
set -U foo bar
|
||||||
|
set -S foo
|
||||||
|
# CHECK: $foo: set in global scope, unexported, with 1 elements
|
||||||
|
# CHECK: $foo[1]: |bar|
|
||||||
|
|
||||||
|
set -S fish_function_path fish_complete_path
|
||||||
|
# CHECK: $fish_function_path: set in global scope, unexported, with 1 elements
|
||||||
|
# CHECK: $fish_function_path[1]: |{{.*}}|
|
Loading…
Reference in New Issue
Block a user