nushell/tests
Piotr Kufel bcb7ef48b6
Reduce duplication in history path construction (#13475)
# 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
2024-10-11 07:51:50 -05:00
..
assets/nu_json Remove old nushell/merge engine-q 2022-02-07 14:54:06 -05:00
const_ Make assignment and const consistent with let/mut (#13385) 2024-07-30 18:55:22 -05:00
eval Fix try: Add set_last_error() to prepare_error_handler() for IR eval (#13838) 2024-09-13 00:07:22 -07:00
fixtures Expand multiple dots in path in completions (#13725) 2024-09-09 14:39:18 -04:00
hooks Fix hooks on 0.92.0 (#12383) 2024-04-04 09:25:54 +02:00
modules Enable reloading changes to a submodule (#13170) 2024-06-25 18:33:37 -07:00
overlays Avoid taking unnecessary ownership of intermediates (#12740) 2024-05-04 00:53:15 +00:00
parsing Avoid taking unnecessary ownership of intermediates (#12740) 2024-05-04 00:53:15 +00:00
path Avoid taking unnecessary ownership of intermediates (#12740) 2024-05-04 00:53:15 +00:00
plugin_persistence Allow plugins to report their own version and store it in the registry (#12883) 2024-06-21 06:27:09 -05:00
plugins Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
repl Reduce duplication in history path construction (#13475) 2024-10-11 07:51:50 -05:00
scope Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
shell Improves startup time when using std-lib (#13842) 2024-10-03 06:28:22 -05:00
main.rs Merged tests to produce a single binary (#12826) 2024-05-13 13:37:53 +00:00