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

Fix history list --cwd errors #278

Merged
merged 5 commits into from
Mar 13, 2022
Merged

Fix history list --cwd errors #278

merged 5 commits into from
Mar 13, 2022

Conversation

lmburns
Copy link
Contributor

@lmburns lmburns commented Mar 10, 2022

Before the fix

$ atuin history list --cwd

Error: error returned from database: near "/": syntax error

Caused by:
    near "/": syntax error

Location:
    atuin-client/src/database.rs:316:19
  1. The query into the database was not quoting the path. This fixes that issue.
  2. Unused dependencies are removed:
atuin
    - fork

atuin-client
    - fern
    - humantime
    - indicatif

atuin-common
    - eyre
    - rmp-serde

atuin-sever
    - chrono-english
    - directories
    - fern
    - fork
    - indicatif
    - parse_duration
    - rmp-serde
    - unicode-width
    - urlencoding
  1. I fixed the zsh plugin by standardizing it according to zdharma. The reference can be found in the file. It results in the following:
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
0="${${(M)0:#/*}:-$PWD/$0}"

The $commands array is also loaded with zmodload in case the user doesn't have it loaded for whatever reason

@conradludgate
Copy link
Collaborator

Do you mind splitting out the zsh plugin change into a separate PR? I'm gonna need some extra time to digest that.

@conradludgate
Copy link
Collaborator

Hmm. Looking at the history queries, we really should move to using compile-time checked queries (or at least ones with proper parameter support).

I'll tentatively accept this for now though (once clippy is happy and when the zsh changes are moved out)

@lmburns
Copy link
Contributor Author

lmburns commented Mar 11, 2022

I'll take them out. Here is some documentation for you to checkout. The only use for it is to make sure that the correct file is sourced and that the $commands array is correctly loaded. It is loaded by default, but some people may not have it for whatever reason

Documentation

zmodload
ZSH_ARGZERO
%N
Parameter expansion: ${(%):-...}
zsh/parameter module
zinit repo
zsh plugin standard
GitHub search showing several other examples using this

The complexity of the command is explained in the link mentioned above saying "plugin standard".

@lmburns
Copy link
Contributor Author

lmburns commented Mar 13, 2022

Clippy lints should be fixed now. I don't know why they weren't already done because they were all in files that I did not modify. It must've been merged last time before completing the clippy lints.

This should be able to be merged now.

@conradludgate
Copy link
Collaborator

Thanks for this, just the formatting to go 😅.

cargo fmt --all

Should do the trick so you don't need to do it manually

@lmburns
Copy link
Contributor Author

lmburns commented Mar 13, 2022

Maybe a github-workflow could be used to prevent this from happening?

Something similar to this or this. Or pre-commit could be used, but that would require everyone having this program.

It would prevent a commit from every happening without passing these checks.

@conradludgate
Copy link
Collaborator

Seems there's still formatting issues, do you have some custom formatting rules set up globally?

@lmburns
Copy link
Contributor Author

lmburns commented Mar 13, 2022

I don't have a rustfmt.toml in the directory, but I'm guessing that it may have read it from my home directory

Copy link
Collaborator

@conradludgate conradludgate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ellie, thoughts?

@ellie ellie merged commit 7f58741 into atuinsh:main Mar 13, 2022
@ellie
Copy link
Member

ellie commented Mar 13, 2022

LGTM! Thanks for the work here 💖

@lmburns lmburns deleted the history-list-fix branch March 13, 2022 20:28
ellie added a commit that referenced this pull request Apr 12, 2022
f861893 Update to clap 3.1.x (#289)
e8f7aac Add compact mode (#288)
1e04c4c Add rust-version to Cargo.toml (#287)
222e52b Update Dockerfile
fae118a Improve fuzzy search (#279)
7cde55a Add code of conduct (#281)
d270798 Update config-rs (#280)
3248883 Update README.md
7f58741 Fix `history list --cwd` errors (#278)
e117b62 Update fish bindings. (#265)
4223ac6 Restore bash 4.2 compatibility, only add hook once (#271)
7651f89 Add support for blesh  (#267)
c2dd332 fix: get install.sh working on UbuntuWSL (#260)
84403a3 Bump reqwest from 0.11.7 to 0.11.9 (#261)
5005cf7 Bump serde_json from 1.0.73 to 1.0.75 (#262)
7fa3e1c Do not crash if the history timestamp is in the future (#250)
8d21506 use sqlite grouping rather than subquery (#181)
d36ff13 Replace dpkg with apt (#248)
@ellie ellie mentioned this pull request Apr 12, 2022
ellie added a commit that referenced this pull request Apr 12, 2022
f861893 Update to clap 3.1.x (#289)
e8f7aac Add compact mode (#288)
1e04c4c Add rust-version to Cargo.toml (#287)
222e52b Update Dockerfile
fae118a Improve fuzzy search (#279)
7cde55a Add code of conduct (#281)
d270798 Update config-rs (#280)
3248883 Update README.md
7f58741 Fix `history list --cwd` errors (#278)
e117b62 Update fish bindings. (#265)
4223ac6 Restore bash 4.2 compatibility, only add hook once (#271)
7651f89 Add support for blesh  (#267)
c2dd332 fix: get install.sh working on UbuntuWSL (#260)
84403a3 Bump reqwest from 0.11.7 to 0.11.9 (#261)
5005cf7 Bump serde_json from 1.0.73 to 1.0.75 (#262)
7fa3e1c Do not crash if the history timestamp is in the future (#250)
8d21506 use sqlite grouping rather than subquery (#181)
d36ff13 Replace dpkg with apt (#248)
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.

3 participants