mirror of
https://github.com/nushell/nushell.git
synced 2025-08-15 19:27:52 +02:00
Refactor nu-cli/env* (#3041)
* Revert "History, more test coverage improvements, and refactorings. (#3217)"
This reverts commit 8fc8fc89aa
.
* Add tests
* Refactor .nu-env
* Change logic of Config write to logic of read()
* Fix reload always appends to old vars
* Fix reload always takes last_modified of global config
* Add reload_config in evaluation context
* Reload config after writing to it in cfg set / cfg set_into
* Add --no-history to cli options
* Use --no-history in tests
* Add comment about maybe_print_errors
* Get ctrl_exit var from context.global_config
* Use context.global_config in command "config"
* Add Readme in engine how env vars are now handled
* Update docs from autoenv command
* Move history_path from engine to nu_data
* Move load history out of if
* No let before return
* Add import for indexmap
This commit is contained in:
23
src/main.rs
23
src/main.rs
@ -16,6 +16,13 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
.hidden(true)
|
||||
.takes_value(true),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("no-history")
|
||||
.hidden(true)
|
||||
.long("no-history")
|
||||
.multiple(false)
|
||||
.takes_value(false),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("loglevel")
|
||||
.short("l")
|
||||
@ -36,7 +43,9 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
.hidden(true)
|
||||
.long("testbin")
|
||||
.value_name("TESTBIN")
|
||||
.possible_values(&["cococo", "iecho", "fail", "nonu", "chop", "repeater"])
|
||||
.possible_values(&[
|
||||
"echo_env", "cococo", "iecho", "fail", "nonu", "chop", "repeater",
|
||||
])
|
||||
.takes_value(true),
|
||||
)
|
||||
.arg(
|
||||
@ -64,13 +73,6 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
.multiple(false)
|
||||
.takes_value(false),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("no-history")
|
||||
.hidden(true)
|
||||
.long("no-history")
|
||||
.multiple(false)
|
||||
.takes_value(false),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("script")
|
||||
.help("the nu script to run")
|
||||
@ -86,6 +88,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
|
||||
if let Some(bin) = matches.value_of("testbin") {
|
||||
match bin {
|
||||
"echo_env" => binaries::echo_env(),
|
||||
"cococo" => binaries::cococo(),
|
||||
"iecho" => binaries::iecho(),
|
||||
"fail" => binaries::fail(),
|
||||
@ -163,10 +166,10 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
}
|
||||
|
||||
None => {
|
||||
let mut context = create_default_context(true)?;
|
||||
let context = create_default_context(true)?;
|
||||
|
||||
if !matches.is_present("skip-plugins") {
|
||||
let _ = nu_cli::register_plugins(&mut context);
|
||||
let _ = nu_cli::register_plugins(&context);
|
||||
}
|
||||
|
||||
#[cfg(feature = "rustyline-support")]
|
||||
|
Reference in New Issue
Block a user