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

feat: use directories project data dir #2

Merged
merged 2 commits into from
Oct 5, 2020
Merged

feat: use directories project data dir #2

merged 2 commits into from
Oct 5, 2020

Conversation

conradludgate
Copy link
Collaborator

There's a bit to this PR.

First, add a --db flag to set the db file, otherwise it defaults to a sensible data dir (on linux, it uses $HOME/.local/share/shync/history.db, different to the $HOME/.history.db file you were originally using)

Second, I ran cargo fmt to make the formatting consistent

Third, I changed some of the function arguments to take more sensible types. AsRef<Path> allows for a much more friendlier usage, allowing &str, String, Path, PathBuf etc.

Copy link
Member

@ellie ellie left a comment

Choose a reason for hiding this comment

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

🚀

Comment on lines +27 to +31
if create {
if let Some(dir) = path.parent() {
std::fs::create_dir_all(dir)?;
}
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Turns out the setup_db function below doesn't create the dir, so this is necessary.

Copy link
Member

Choose a reason for hiding this comment

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

makes sense

@ellie ellie merged commit 4628530 into atuinsh:main Oct 5, 2020
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