mirror of
https://github.com/nushell/nushell.git
synced 2025-04-09 21:28:55 +02:00
# Description Currently there is a bit of chaos regarding construction of history file paths. Various pieces of code across a number of crates reimplement the same/similar logic: - There is `get_history_path`, but it requires a directory parameter (it really just joins it with a file name). - Some places use a const for the directory parameter, others use a string literal - in all cases the value seems to be `"nushell"`. - Some places assume the `"nushell"` value, other plumb it down from close to the top of the call stack. - Some places use a constant for history file names while others assume it. This PR tries to make it so that the history/config path format is defined in a single places and so dependencies on it are easier to follow: - It removes `get_history_path` and adds a `file_path` method to `HistoryConfig` instead (an extra motivation being, this is a convenient place that can be used from all creates that need a history file path) - Adds a `nu_config_dir` function that returns the nushell configuration directory. - Updates existing code to rely on the above, effectively removing duplicate uses of `"nushell"` and `NUSHELL_FOLDER` and assumptions about file names associated with different history formats # User-Facing Changes None
18 lines
485 B
Rust
18 lines
485 B
Rust
#![doc = include_str!("../README.md")]
|
|
mod assert_path_eq;
|
|
mod components;
|
|
pub mod dots;
|
|
pub mod expansions;
|
|
pub mod form;
|
|
mod helpers;
|
|
mod path;
|
|
mod tilde;
|
|
mod trailing_slash;
|
|
|
|
pub use components::components;
|
|
pub use expansions::{canonicalize_with, expand_path_with, expand_to_real_path, locate_in_dirs};
|
|
pub use helpers::{cache_dir, data_dir, home_dir, nu_config_dir};
|
|
pub use path::*;
|
|
pub use tilde::expand_tilde;
|
|
pub use trailing_slash::{has_trailing_slash, strip_trailing_slash};
|