-
-
Notifications
You must be signed in to change notification settings - Fork 826
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
base: main
Are you sure you want to change the base?
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
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.