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 eg. pkgx +rust like pkgx^1 does #1090

Merged
merged 2 commits into from
Jan 24, 2025
Merged

Allow eg. pkgx +rust like pkgx^1 does #1090

merged 2 commits into from
Jan 24, 2025

Conversation

mxcl
Copy link
Member

@mxcl mxcl commented Jan 24, 2025

No description provided.

@mxcl mxcl requested a review from jhheider January 24, 2025 21:11
@mxcl
Copy link
Member Author

mxcl commented Jan 24, 2025

This leaves old .db files lying around but whatever.

I chose to rename so as to avoid a DB query every time pkgx runs just to determine if we need to upgrade. Maybe this is retarded. Maybe it's genius. Who knows?

@mxcl mxcl force-pushed the plus-display-names branch from 04e0eb4 to ec6927d Compare January 24, 2025 21:12
@mxcl
Copy link
Member Author

mxcl commented Jan 24, 2025

hmm it's just lucky (and probs wrong) that the display-name for rust is rust rather than Rust. Should make this case insensitive for the alias look up.

@@ -41,7 +41,7 @@ async fn main() -> Result<(), Box<dyn Error>> {

let cache_dir = config.pantry_dir.parent().unwrap();
std::fs::create_dir_all(cache_dir)?;
let mut conn = Connection::open(cache_dir.join("pantry.db"))?;
let mut conn = Connection::open(cache_dir.join("pantry.2.db"))?;
Copy link
Contributor

Choose a reason for hiding this comment

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

i sense migrations coming. there's a fair few tools in rust for that. and a few in pkgx, like goose.

Copy link
Member Author

Choose a reason for hiding this comment

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

we would certainly be more proper to be able to update the db incrementally and with migrations. That’s work I am not interested in RN tho for sure.

Comment on lines +128 to +132
let mut rv = Vec::new();
let mut rows = stmt.query(params![symbol])?;
while let Some(row) = rows.next()? {
rv.push(row.get(0)?);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

just for style reasons, this is:

Ok(
    stmt
    .query(params![symbol])?
    .map(|row| row.get(0).expect("Query returned malformed data."))
    .collect::<Vec<String>
)

assuming the borrow checker doesn't think you're dropping bits.

Copy link
Member Author

Choose a reason for hiding this comment

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

Doesn't compile and I am not enough of a rust guru yet to fix

Copy link
Contributor

Choose a reason for hiding this comment

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

if you haven't, give pkgx bacon -j clippy a try ;)

Copy link
Member Author

Choose a reason for hiding this comment

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

I have not, though I have been there numerous times lately since it is the latest addition to the pantry. I guess I don't see how it would help me here.

Copy link
Contributor

Choose a reason for hiding this comment

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

not here specifically, but the feedback is rapid and, to my mind, better organized than rust-analyzer+vscode (it also works no matter what base directory you're in, which rust-analyzer struggles with).

@mxcl mxcl force-pushed the plus-display-names branch from ec6927d to c54c9f4 Compare January 24, 2025 21:19
@mxcl mxcl force-pushed the plus-display-names branch from c54c9f4 to 33ed021 Compare January 24, 2025 21:24
@mxcl mxcl force-pushed the plus-display-names branch from 33ed021 to f5ae8e6 Compare January 24, 2025 21:27
@mxcl mxcl merged commit 99a11b0 into main Jan 24, 2025
12 checks passed
@mxcl mxcl deleted the plus-display-names branch January 24, 2025 21:33
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