-
-
Notifications
You must be signed in to change notification settings - Fork 913
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 (and rewrite) dx init
/dx new
#2822
Conversation
Temporary messed up new subcommand. BREAKING CHANGE: changed order and names of CLI arguments/options
Added a note describing the purpose of those tests as I don't think their names are clear enough. And I don't want to create test with a paragraph in its name.
I also added the |
Current implementation of |
Another notes:
|
0d33c40
to
357e05f
Compare
Switched from assert_cmd to escargot because binary isn't being created. See https://docs.rs/assert_cmd/2.0.16/assert_cmd/cargo/#limitations.
357e05f
to
4d29fc6
Compare
I found that I was surprised that the tests failed after I initially thought that I'm done. But apparently I was not the first one: assert-rs/assert_cmd#131. So because of this limitation I used The tests still pass without any changes, so that's cool. :) Do we need some sort of "workspace" Also, I updated the |
Oh no... It's still not in the stable version (for some platforms?). |
I also think that renaming |
Thanks! Will take a look tomorrow - might be able to get it into the release. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, all looks good, thank you!
Oh, wow, OK. Great, but what about questions from #2822 (comment) and #2822 (comment)? |
Eventually, sure, plus a whole slew of other tests for the CLI. But for now it's not a big deal - the code here isn't too crazy to make it worth not shipping it in 0.6.
We could but it doesn't seem terribly important to do that either. |
Alright, and the last question from the #2822 (comment). I guess slightly more up-to-date random crates isn't an issue either? I thought that this could add some potential problems, but maybe it's fine since all the current tests are passing.
Then I'll rename it later. Because even I was slightly confused when searching for the correct file. Had to look for |
Fixes issue in #2788 (comment). I have found few semantic breakages and bugs, but upon trying to fix stuff and dig deeper to get the whole image of what the current state of
init
/new
subcommands is trying to do, I stumbled upon even more bugs and performance issues (callingMetadataCommand
from incorrect CWD causes a 2 s slowdown!). Here is my monologue with a little bit more context.Here I am cooking a new version of those subcommands. The workspace change will be mostly untouched as I'm not familiar with it, and it doesn't overlap with the problem at hand.
The first commit contains a ton of commented code, which most likely breaks the
new
command (at least in some way). But I fully rewrote (refactored + added a few things) theinit
command. Had to get an absolute path without resolving symbolic links, so I used apath-absolutize
crate (for free). Second commit adds one dev dependency for running and testing commands (includingdx
), it's pretty small. I rarely wrote tests before, but these once look very nice. I think I balanced abstraction and clarity pretty well.One thought I now have (since my testing strategy has changed from the beginning) is to put
init
subcommmand tests to its own file instead of the main one.Notes (to not forget):
branch
,tag
,revision
options from cargo-generate. Should this be a separate PR or it can be included here? It by itself probably will be very small.