Giter Club home page Giter Club logo

Comments (6)

regexident avatar regexident commented on May 29, 2024

I have a project making use of a cargo workspace, but only the main crate is revealed when I issue a cargo modules command.

Very good point. I haven't had a need for workspaces myself yet, thus didn't think of it when building cargo modules.

How would you expect the output to look? Something like this?

foo : crate
├── bar : public
╎   └── tests : private @ #[cfg(test)]
╎
└── baz : crate
    └── blee : public
        └── tests : private @ #[cfg(test)]

It might further more make sense to switch from public/private to pub mod/mod, as now crates can appear deeply nested within the tree (sub-crate of sub-crate of …). 🤔

foo : crate
├── bar : pub mod
╎   └── tests : mod @ #[cfg(test)]
╎
└── baz : crate
    └── blee : pub mod
        └── tests : mod @ #[cfg(test)]

While public/private is nicer on the eyes pub mod/mod is a better fit for Rust's own semantics/keywords.

Further more I would probably want to keep this feature behind a --workspace option, so that one can still choose to only print the root crate's modules.

Great tool, thank you!

Glad you like it!

from cargo-modules.

hongxuchen avatar hongxuchen commented on May 29, 2024

I have a project which contains several crates. Rather than providing one single crate modules info, running cargo modules in the project root directory emits an error:

Error: Failed to parse JSON response.
UnexpectedEndOfJson

But it works fine when using it inside each crate.

from cargo-modules.

U007D avatar U007D commented on May 29, 2024

@regexident Sorry, somehow I missed your initial reply.

Yes, the output you outlined with the (Rust-specific visibility) syntax looks good to me.

from cargo-modules.

regexident avatar regexident commented on May 29, 2024

@U007D no worries.

I’m somewhat busy right now but will tackle this as soon as I find some spare time. :)

from cargo-modules.

kvark avatar kvark commented on May 29, 2024

More then 2 years passed, wow!
This is very much needed. All of the non-trivial projecs use workspaces these days.
For example, running it within any folder in https://github.com/servo/webrender gives me:

direct-composition : crate
 ├── com : private
 └── egl : private

... which is of no use, because the direct-composition crate is one I'm least interested in. I'll try to work around this, but having proper support would be valuable! To clarify, I don't have a strong idea whether you need to analyze the workspace as a whole (that would step into cargo-deps territory to some extent). Having it on a single crate would be good enough for us today.

@regexident how is your situation looking now? Would you be able to

from cargo-modules.

regexident avatar regexident commented on May 29, 2024

This should now be fixed with #66 having been merged. 🎉 😃
(The release still needs a it more work. If you're feeling lucky you can install from source and give it a try, though.)

from cargo-modules.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.