sigmaSd / IRust

Cross Platform Rust Repl

Home Page:https://crates.io/crates/irust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unclear documentation on importing local crates

rex-remind101 opened this issue · comments

commented

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

The README says this:
":add <dep_list> => 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):

  • :add --path my_crate
  • :add --path my-crate
  • :add --path ./my_crate
  • :add --path ./my-crate
  • :add --path ./crates/my_crate
  • :add --path ./crates/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.

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.

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 ?

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

tested using:

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

much better now with error-messages, thanks

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