forked from extern/nushell
Fix config {nu,env}
to open $nu.{config,env}-file
(#8792)
# Description fixed #8755 Now, command `config {nu,env}` opens default file `.config/nushell/{config,env}.nu`. This behavior is inappropriate when `nu` is launched with option `--config` or `--env-config`. This PR changes the file that the command opens to `$nu.{config,env}-file`. # User-Facing Changes `config {nu,env}` opens `$nu.{config,env}-file`.
This commit is contained in:
parent
4fda6d7eaa
commit
a3ea0c304a
11
crates/nu-command/src/env/config/config_env.rs
vendored
11
crates/nu-command/src/env/config/config_env.rs
vendored
@ -42,21 +42,18 @@ impl Command for ConfigEnv {
|
||||
input: PipelineData,
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
let env_vars_str = env_to_strings(engine_state, stack)?;
|
||||
let mut config_path = match nu_path::config_dir() {
|
||||
Some(path) => path,
|
||||
let nu_config = match engine_state.get_config_path("env-path") {
|
||||
Some(path) => path.clone(),
|
||||
None => {
|
||||
return Err(ShellError::GenericError(
|
||||
"Could not find nu env path".to_string(),
|
||||
"Could not find nu env path".to_string(),
|
||||
"Could not find $nu.env-path".to_string(),
|
||||
"Could not find $nu.env-path".to_string(),
|
||||
None,
|
||||
None,
|
||||
Vec::new(),
|
||||
));
|
||||
}
|
||||
};
|
||||
config_path.push("nushell");
|
||||
let mut nu_config = config_path.clone();
|
||||
nu_config.push("env.nu");
|
||||
|
||||
let (item, config_args) = get_editor(engine_state, stack, call.head)?;
|
||||
|
||||
|
11
crates/nu-command/src/env/config/config_nu.rs
vendored
11
crates/nu-command/src/env/config/config_nu.rs
vendored
@ -42,21 +42,18 @@ impl Command for ConfigNu {
|
||||
input: PipelineData,
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
let env_vars_str = env_to_strings(engine_state, stack)?;
|
||||
let mut config_path = match nu_path::config_dir() {
|
||||
Some(path) => path,
|
||||
let nu_config = match engine_state.get_config_path("config-path") {
|
||||
Some(path) => path.clone(),
|
||||
None => {
|
||||
return Err(ShellError::GenericError(
|
||||
"Could not find nu config path".to_string(),
|
||||
"Could not find nu config path".to_string(),
|
||||
"Could not find $nu.config-path".to_string(),
|
||||
"Could not find $nu.config-path".to_string(),
|
||||
None,
|
||||
None,
|
||||
Vec::new(),
|
||||
));
|
||||
}
|
||||
};
|
||||
config_path.push("nushell");
|
||||
let mut nu_config = config_path.clone();
|
||||
nu_config.push("config.nu");
|
||||
|
||||
let (item, config_args) = get_editor(engine_state, stack, call.head)?;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user