mirror of
https://github.com/nushell/nushell.git
synced 2025-07-01 07:00:37 +02:00
Revert "Allow NU_LIBS_DIR and friends to be const" (#8501)
Reverts nushell/nushell#8310 In anticipation that we may want to revert this PR. I'm starting the process because of this issue. This stopped working ``` let-env NU_LIB_DIRS = [ ($nu.config-path | path dirname | path join 'scripts') 'C:\Users\username\source\repos\forks\nu_scripts' ($nu.config-path | path dirname) ] ``` You have to do this now instead. ``` const NU_LIB_DIRS = [ 'C:\Users\username\AppData\Roaming\nushell\scripts' 'C:\Users\username\source\repos\forks\nu_scripts' 'C:\Users\username\AppData\Roaming\nushell' ] ``` In talking with @kubouch, he was saying that the `let-env` version should keep working. Hopefully it's a small change.
This commit is contained in:
@ -1,5 +1,3 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::Expression;
|
||||
@ -21,7 +19,7 @@ pub struct Call {
|
||||
pub redirect_stdout: bool,
|
||||
pub redirect_stderr: bool,
|
||||
/// this field is used by the parser to pass additional command-specific information
|
||||
pub parser_info: HashMap<String, Expression>,
|
||||
pub parser_info: Vec<Expression>,
|
||||
}
|
||||
|
||||
impl Call {
|
||||
@ -32,7 +30,7 @@ impl Call {
|
||||
arguments: vec![],
|
||||
redirect_stdout: true,
|
||||
redirect_stderr: false,
|
||||
parser_info: HashMap::new(),
|
||||
parser_info: vec![],
|
||||
}
|
||||
}
|
||||
|
||||
@ -72,6 +70,10 @@ impl Call {
|
||||
self.arguments.push(Argument::Positional(positional));
|
||||
}
|
||||
|
||||
pub fn add_parser_info(&mut self, info: Expression) {
|
||||
self.parser_info.push(info);
|
||||
}
|
||||
|
||||
pub fn add_unknown(&mut self, unknown: Expression) {
|
||||
self.arguments.push(Argument::Unknown(unknown));
|
||||
}
|
||||
@ -104,12 +106,8 @@ impl Call {
|
||||
self.positional_iter().count()
|
||||
}
|
||||
|
||||
pub fn get_parser_info(&self, name: &str) -> Option<&Expression> {
|
||||
self.parser_info.get(name)
|
||||
}
|
||||
|
||||
pub fn set_parser_info(&mut self, name: String, val: Expression) -> Option<Expression> {
|
||||
self.parser_info.insert(name, val)
|
||||
pub fn parser_info_nth(&self, i: usize) -> Option<&Expression> {
|
||||
self.parser_info.get(i)
|
||||
}
|
||||
|
||||
pub fn has_flag(&self, flag_name: &str) -> bool {
|
||||
|
Reference in New Issue
Block a user