rust-practice / cargo-leet

Program to make working on leetcode problems locally more convenient
Apache License 2.0
5 stars 3 forks source link

Document expected structure of project in readme #86

Closed c-git closed 2 months ago

c-git commented 5 months ago

It was observed https://github.com/rust-practice/cargo-leet/pull/84 that right now the expected package structure expected by the tool is not documented in the readme.

Antosser commented 4 months ago

@c-git

Given the discussion in the conversation of this PR we need to decide how we want to handle this. One other other option I was thinking about is we have a config file in the user's home directory which tracks the most recent problems they worked on and we could get the most recent one from there. I can help with implementation if this seems daunting.

That said the easiest option is to have the user specify the problem but I'm concerned about the UX of that option. I feel auto complete may actually make specifying the file not that hard but they would have to think about what the problem number or name is and this might just end up being harder than just doing the copy and paste themselves.

I still think that one project per solution is the ultimate solution to this problem. Here's why:

Implementing this would require a major rewrite, but I'm willing to do it. If we'll do that, we'll just delay #84 after until the change.

And I wouldn't worry about the migration process for the users.

response().await

c-git commented 4 months ago

This issue is only for documentation not really a proposal to change the structure but we can discuss it here.

I acknowledge that the feature in PR https://github.com/rust-practice/cargo-leet/pull/84 becomes less useful if there are multiple solutions in the same folder.

Do you not keep your old solutions? I think that is the assumption that is causing the mismatch. I keep my old solutions for reference and there are 3 other ppl using it and they all use it the same way as me (keeping their past solutions).

Having multiple solutions in the same project/package will require the user to enter the wanted solution every single time.

Yeah that's true and I'm not sure there is any way to get around it as some people do want to keep their previous solutions.

Caching isn't a good option since if it's there people including me will want to use it, but can't since it's unreliable and the name of a previously used solution might still be stored inside. That means that everybody will manually enter the wanted solution on the first run, so why can't they just up arrows in their shell? This makes this option useless.

I agree it is complicated and may not be reliable. I think we can rule out this option then.

Leetcode only allows one file per solution, not even allowing external dependencies. And having multiple completely unrelated Rust files in the same directory is very confusing.

Yes that's correct but they do allow a fixed set of dependencies and we need to also depend on the library version of this crate to do the tests. And to set the rust version. The other files are all related to leetcode that is the common connection.

Implementing this would require a major rewrite, but I'm willing to do it.

Not sure what you mean by this in that sentence.

Pretty much nobody uses the program right now.

I don't use it often but I do use it. And while the others are not active they also use it.

It is as simple as copy/pasting.

You mean for the migration to separate projects for each solutions?

Why would anyone want to rerun old Leetcode code? It's for learning.

Yes I return to the old ones as references for things I've done before and to see how I did them and to improve on them over time. If you look at my repo you'll see that from time to time I'll do a problem I've done before and modify it to incorporate things I've learned since I'd done it the first time.

c-git commented 2 months ago

I think we need to deal with all the commands in the program which now include New added in https://github.com/rust-practice/cargo-leet/pull/89 and as such I don't think this separate ticket is needed anymore as users are able to see the expected structure somewhat from https://github.com/rust-practice/cargo-leet-template . Thus closing this as I don't think it being open adds any value.