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

feat(cmds): #11 support running any cargo cmd(s) #18

Merged
merged 1 commit into from
Aug 24, 2015

Conversation

compressed
Copy link
Contributor

Add support for running arbitrary cargo commands.
For example:

cargo watch "test ex_ —release"

will run cargo test ex_ —release.

Also supports multiple arguments:

cargo watch build test

will run cargo build followed by cargo test.

I've been using this for the last few days and haven't run into any issues.

Let me know any changes and I'll incorporate.

@passcod
Copy link
Member

passcod commented Aug 20, 2015

I'd prefer to have either the syntax cargo watch "command" or cargo watch --command "command". Both, maybe. Adding a _sub-_sub-command makes no sense at all here.

The cargo watch "command" syntax could then allow invocations like:

$ cargo watch run
$ cargo watch build
$ cargo watch test bench
$ cargo watch "test ex_ --etc"

as what was proposed originally in #11.

With this feature, it also makes no sense to have the --build, --doc, --test, --bench options handled anymore, so you can remove those.

Finally, add yourself to the Cargo.toml :)

@@ -54,3 +54,17 @@ pub fn run(cmd: &str) {
Err(e) => println!("Failed to execute 'cargo {}': {}", cmd, e)
};
}

/// Runs cargo by passing through a set of multiple commands and displays the output.
pub fn run_raw(cmds: &str) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given above comment above obsoleting the --<action> options, run_raw could simply replace run. Simply add a check (in compile.rs) that if cmd is empty or only whitespace, replace it with build test.

@passcod
Copy link
Member

passcod commented Aug 20, 2015

Given above comments, this will be a breaking change, bringing us to v3.

@compressed
Copy link
Contributor Author

Thanks for the comments! I agree that makes sense. I'll incorporate those changes.

@compressed compressed changed the title feat(raw): #11 support running any cargo command(s) feat(cmds): #11 support running any cargo cmd(s) Aug 21, 2015
@compressed
Copy link
Contributor Author

I've updated the PR, much simpler logic now!

Add support for running arbitrary cargo commands.
For example, `cargo watch "test ex_ —release"` will run `cargo test
ex_ —release`.

Also supports multiple arguments:
`cargo watch "build --release" "test test_"` will run `cargo build --release` followed by
`cargo test test_`.

If no arguments are given, default stays as-is: cargo build and cargo test.

[breaking-change]
passcod added a commit that referenced this pull request Aug 24, 2015
Support running any cargo command

Closes #11.
@passcod passcod merged commit 3371844 into watchexec:master Aug 24, 2015
@passcod
Copy link
Member

passcod commented Aug 24, 2015

Sorry for the wait, holidays :)

@compressed
Copy link
Contributor Author

No worries, thanks!

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

Successfully merging this pull request may close these issues.

None yet

2 participants