Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow history searching via session id #562

Merged
merged 3 commits into from
Apr 18, 2023

Conversation

fdncred
Copy link
Collaborator

@fdncred fdncred commented Mar 27, 2023

This PR attempts to allow reedline to have the ability to search the entire history, OR search only based on the current history session id. To demonstration this functionality, I've added a few commands to the demo example.

  1. history - This shows the entire history regardless of session (not new but here to contrast the next command)
  2. history session - This shows the history only with the current history session id
  3. history sessionid - This shows the current history session id or None
  4. toggle history_session - This shows the ability to start off without a history session, create one, and then start to show only the history items with the current history session id. It also shows the opposite. You can toggle the history session searching off.

I've only tested this with the sqlite_backed history. More testing is required.
I haven't added any new tests. It may be a good idea to add some but I'm not quite sure how.

If we end up landing this, it should be considered a breaking change since some API functions have changed.

@sholderbach
Copy link
Member

Thanks for moving our built-in history facilities forward.

All that feature-gated code we already have in different places is really unfortunate. The same applies to the testing that either tests one implementation or the other depending on the provided feature flag. We have some tests that should really behave the same accross histories but other things shouldn't hold us back from providing the best experience based on the particular version. Maybe we need to move some of those tests to a more dependency-injection style.

@fdncred fdncred merged commit 61c6409 into nushell:main Apr 18, 2023
@fdncred fdncred deleted the allow_searching_via_session branch April 18, 2023 12:13
fdncred added a commit to nushell/nushell that referenced this pull request Apr 18, 2023
# Description
This PR fixes the breaking changes to the reedline API due to
nushell/reedline#562. It does not implement any
new features but just gets nushell back to compiling again.

# User-Facing Changes
<!-- List of all changes that impact the user experience here. This
helps us keep track of breaking changes. -->

# Tests + Formatting
<!--
Don't forget to add tests that cover your changes.

Make sure you've run and fixed any issues with these commands:

- `cargo fmt --all -- --check` to check standard code formatting (`cargo
fmt --all` applies these changes)
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A
clippy::needless_collect` to check that you're using the standard code
style
- `cargo test --workspace` to check that all tests pass
- `cargo run -- crates/nu-std/tests/run.nu` to run the tests for the
standard library

> **Note**
> from `nushell` you can also use the `toolkit` as follows
> ```bash
> use toolkit.nu # or use an `env_change` hook to activate it
automatically
> toolkit check pr
> ```
-->

# After Submitting
<!-- If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants