sigmaSd / IRust

Cross Platform Rust Repl
https://crates.io/crates/irust
MIT License
609 stars 34 forks source link

Unclear documentation on importing local crates #128

Closed rex-remind101 closed 8 months ago

rex-remind101 commented 10 months ago

Thank you for irust, but I had some trouble with local crates

The README says this: ":add => add dependencies also it accepts most cargo add arguments, for example you can import local dependencies with :add --path path_to_crate"

So I ran irust from the root directory of my rust project workspace, where there's a subdirectory crates with all my local crates, and I tried all of these options (with crate folder as my-crate and crate name as my_crate):

All of which had the following output:

Adding dep [-]
 Building dep [-]
 Checking dep [-]
Ok!

Yet the symbol for the crate could not be found except for the case of :add --path ./crates/my-crate where it finally worked. This could be more clearly documented.

sigmaSd commented 10 months ago

Thanks for trying it out

I expect --path crate (without ./) to work, it doesn't so its a bug.

I have some suspicions on why is that : before cargo add was integrated into cargo, --path flag didn't exist so I had to do some hacks to decide if a string is a local or a remote crate, but now with --path those hacks are not needed and are in the way.

sigmaSd commented 10 months ago

Adding dep [-] Building dep [-] Checking dep [-] Ok!

I recently added a commit, that actually shows the errors of cargo-add (not yet released) I committed now another change that remove old hacks and use a more robust way to invoke cargo-add

Can you test the latest commit ?

sigmaSd commented 10 months ago

I created a new release with theses changes, maybe its easier to test now

dynnamitt commented 10 months ago

tested using:

cargo install --git https://github.com/sigmaSd/IRust irust

much better now with error-messages, thanks

sigmaSd commented 8 months ago

I'm going to close the issue, since I think its fixed now