mirror of
https://github.com/nushell/nushell.git
synced 2025-07-01 15:11:52 +02:00
Add the history import command (again) (#14083)
# Description This is mainly https://github.com/nushell/nushell/pull/13450 (which got reverted). Additionally: - always clear IDs on import, disallow specifying IDs when piping - added extra tests - create backup of the history # User-Facing Changes New command: `history import` # Tests + Formatting Added mostly integration tests and a few smaller unit tests.
This commit is contained in:
@ -234,7 +234,7 @@ macro_rules! nu_with_plugins {
|
||||
}
|
||||
|
||||
use crate::{Outcome, NATIVE_PATH_ENV_VAR};
|
||||
use nu_path::{AbsolutePath, AbsolutePathBuf, Path};
|
||||
use nu_path::{AbsolutePath, AbsolutePathBuf, Path, PathBuf};
|
||||
use std::{
|
||||
ffi::OsStr,
|
||||
process::{Command, Stdio},
|
||||
@ -248,6 +248,10 @@ pub struct NuOpts {
|
||||
pub envs: Option<Vec<(String, String)>>,
|
||||
pub collapse_output: Option<bool>,
|
||||
pub use_ir: Option<bool>,
|
||||
// Note: At the time this was added, passing in a file path was more convenient. However,
|
||||
// passing in file contents seems like a better API - consider this when adding new uses of
|
||||
// this field.
|
||||
pub env_config: Option<PathBuf>,
|
||||
}
|
||||
|
||||
pub fn nu_run_test(opts: NuOpts, commands: impl AsRef<str>, with_std: bool) -> Outcome {
|
||||
@ -278,8 +282,14 @@ pub fn nu_run_test(opts: NuOpts, commands: impl AsRef<str>, with_std: bool) -> O
|
||||
command.envs(envs);
|
||||
}
|
||||
|
||||
// Ensure that the user's config doesn't interfere with the tests
|
||||
command.arg("--no-config-file");
|
||||
match opts.env_config {
|
||||
Some(path) => command.arg("--env-config").arg(path),
|
||||
// TODO: This seems unnecessary: the code that runs for integration tests
|
||||
// (run_commands) loads startup configs only if they are specified via flags explicitly or
|
||||
// the shell is started as logging shell (which it is not in this case).
|
||||
None => command.arg("--no-config-file"),
|
||||
};
|
||||
|
||||
if !with_std {
|
||||
command.arg("--no-std-lib");
|
||||
}
|
||||
|
Reference in New Issue
Block a user