mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 03:54:58 +02:00
* Added loginshell config file #4620 * added sample login.nu * added environment variable loginshell-path
This commit is contained in:
@ -11,6 +11,7 @@ use std::path::PathBuf;
|
||||
pub(crate) const NUSHELL_FOLDER: &str = "nushell";
|
||||
const CONFIG_FILE: &str = "config.nu";
|
||||
const ENV_FILE: &str = "env.nu";
|
||||
const LOGINSHELL_FILE: &str = "login.nu";
|
||||
const HISTORY_FILE: &str = "history.txt";
|
||||
|
||||
pub(crate) fn read_config_file(
|
||||
@ -104,6 +105,26 @@ pub(crate) fn read_config_file(
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn read_loginshell_file(
|
||||
engine_state: &mut EngineState,
|
||||
stack: &mut Stack,
|
||||
is_perf_true: bool,
|
||||
) {
|
||||
// read and execute loginshell file if exists
|
||||
if let Some(mut config_path) = nu_path::config_dir() {
|
||||
config_path.push(NUSHELL_FOLDER);
|
||||
config_path.push(LOGINSHELL_FILE);
|
||||
|
||||
if config_path.exists() {
|
||||
eval_config_contents(config_path, engine_state, stack);
|
||||
}
|
||||
}
|
||||
|
||||
if is_perf_true {
|
||||
info!("read_loginshell_file {}:{}:{}", file!(), line!(), column!());
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn create_history_path() -> Option<PathBuf> {
|
||||
nu_path::config_dir().and_then(|mut history_path| {
|
||||
history_path.push(NUSHELL_FOLDER);
|
||||
|
Reference in New Issue
Block a user