Skip to content
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

cargo make test-with-args -- --message-format=json doesn't work #470

Closed
masnagam opened this issue Oct 4, 2020 · 5 comments
Closed

cargo make test-with-args -- --message-format=json doesn't work #470

masnagam opened this issue Oct 4, 2020 · 5 comments
Assignees
Labels
Milestone

Comments

@masnagam
Copy link

masnagam commented Oct 4, 2020

Describe The Bug

Built-in test-with-args task seems not to work properly when passing options as arguments.

The same issue might occur in other built-in tasks which can take arguments.

Expected Behavior

cargo test --message-format=json should be executed as defined in rust.toml

To Reproduce

Run cargo make test-with-args -- --message-format=json.

Error Stack

[cargo-make] INFO - cargo make 0.32.6
[cargo-make] INFO - Build File: Makefile.toml
[cargo-make] INFO - Task: test-with-args
[cargo-make] INFO - Profile: development
[cargo-make] INFO - Running Task: workspace
error: Found argument '--message-format' which wasn't expected, or isn't valid in this context

USAGE:
    cargo make --allow-private --disable-check-for-updates --env <ENV>... --loglevel <LOG LEVEL> --no-on-error --profile <PROFILE>

For more information try --help
[cargo-make] ERROR - Error while executing command, exit code: 1
[cargo-make] WARN - Build Failed.

Verbose Logs

$ cargo make -v test-with-args -- --message-format=json
[cargo-make] INFO - cargo make 0.32.6
[cargo-make] VERBOSE - Written By Sagie Gur-Ari <sagiegurari@gmail.com>
[cargo-make] VERBOSE - Cli Args CliArgs {
    command: "cargo make",
    build_file: None,
    task: "test-with-args",
    profile: Some(
        "development",
    ),
    log_level: "verbose",
    disable_color: false,
    cwd: None,
    env: None,
    env_file: None,
    disable_workspace: false,
    disable_on_error: false,
    allow_private: false,
    skip_init_end_tasks: false,
    print_only: false,
    list_all_steps: false,
    diff_execution_plan: false,
    disable_check_for_updates: false,
    experimental: false,
    arguments: Some(
        [
            "--message-format=json",
        ],
    ),
    output_format: "default",
    output_file: None,
    print_time_summary: false,
}
...
+ cargo make --disable-check-for-updates --allow-private --no-on-error --loglevel=verbose --env CARGO_MAKE_CRATE_CURRENT_WORKSPACE_MEMBER=benches --profile development test-with-args --message-format=json
error: Found argument '--message-format' which wasn't expected, or isn't valid in this context

Maybe, -- must be inserted between test-with-args and --message-format=json when running a command internally.
-- in the original command is not contained in CliArgs::arguments because it's removed by clap.

@sagiegurari
Copy link
Owner

thanks a lot. this feels like a bug with workspaces and cli args in general.
I'll fix that

@sagiegurari sagiegurari added this to the 0.32.7 milestone Oct 4, 2020
@sagiegurari sagiegurari added the bug label Oct 4, 2020
@sagiegurari
Copy link
Owner

@masnagam i have pushed a fix (i hope) to branch 0.32.7
could you please verify it works well for you as well?

@masnagam
Copy link
Author

masnagam commented Oct 5, 2020

@sagiegurari
Thank you for taking the time for this issue.
I've confirmed that the fix works fine, using the following command:

cargo run --bin=cargo-make -- make test-with-args -- --message-format=json

@sagiegurari
Copy link
Owner

thanks a lot. I'll release it soon.

@sagiegurari
Copy link
Owner

This is now released. thanks a lot for opening the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants