Giter Site home page Giter Site logo

Comments (5)

kangalio avatar kangalio commented on May 24, 2024 1

Thank you! The new version immediately compiled successfully.

However, with the new version, I'm struggling to invoke it correctly. No matter what command I use after cargo modules, it always prints the same error message:

error: Found argument 'modules' which wasn't expected, or isn't valid in this context

USAGE:
    cargo-modules <SUBCOMMAND>

For more information try --help

This errors stays the same, no matter if I try cargo modules --help, cargo modules graph, or cargo modules. I also tried cargo-modules, but this command doesn't exist.

Is there something I can do to fix this argument parsing error? (Or should an issue be opened about this?)

from cargo-modules.

regexident avatar regexident commented on May 24, 2024 1

Should be fixed with 0.5.0-beta.2 (I yanked 0.5.0-beta.1).

from cargo-modules.

regexident avatar regexident commented on May 24, 2024

Hey @kangalioo and thanks for the report!

This, among many other bugs, should be fixed with 0.5.0-beta.1, which you can install via:

cargo install cargo-modules --version "0.5.0-beta.1"

from cargo-modules.

regexident avatar regexident commented on May 24, 2024

Oh, I can vaguely remember a bug like this, which was fixed years ago. 🤔
Looks like my recent major refactoring reintroduced it.

It basically boils down to cargo passing modules as an argument to cargo-modules, rather than dropping it:

$ cargo-modules generate graph …

std::env::args => ["/path/to/cargo-modules", "generate", "graph",]

$ cargo modules generate graph …

std::env::args => ["/path/to/cargo-modules", "modules", "generate", "graph",]

We basically have two options to fix this:

  1. Pass a cleaned-up args vector (dropping the "modules") to clap/structopt.

    Feels a bit hack-ish, but would work.

  2. Add a modules umbrella root-command to structopt.

    This would probably mess with the output produced by --help, which is no good.

  3. Add a positional hidden dummy argument.

    This is how it would be done in pure clap (we use structopt though):

    .arg(Arg::with_name("dummy")
        .hidden(true)
        .possible_value("modules"))

Option 3), the dummy argument would probably be the least invasive one.

from cargo-modules.

kangalio avatar kangalio commented on May 24, 2024

It works, thank you!

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.