-
Notifications
You must be signed in to change notification settings - Fork 5
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
Read Cargo.toml from target dir #18
Conversation
57b7ce6
to
badfad2
Compare
src/main.rs
Outdated
use structopt::StructOpt; | ||
|
||
fn main() -> Result<(), ExitFailure> { | ||
setup_panic!(); | ||
let args = Cli::from_args(); | ||
args.log(env!("CARGO_PKG_NAME"))?; | ||
|
||
let dir = args.dir()?; | ||
let dir: PathBuf = args.dir()?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this line necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most likely not. I thought I was doing type conversion from string to pathbuf, because I looked at the wrong property on cli.rs
. I'll remove this.
@bltavares this patch looks pretty good! -- ideally we could have some regression test for this too, but we don't have a test framework setup yet, so it might be a bit odd. Is this something you'd be okay with adding? |
@yoshuawuyts I wouldn't be able to setup the testing harness soon enough, but I could help with that in a near future, if that is ok for you. |
When running `crossgen` on a directory with a missing `Cargo.toml` it would panic with an error message. Debugging what happend, I've found it failed to find a `Cargo.toml` file, as it don't exist. To my surprise, when I've cloned the repo and tried to reproduce using `cargo run -- ~/path/to/my-dir`, there was no panic! This happened because the `Cargo.toml` was found on `crossgen` repo, not on my targe repo, as expected. This commit changes the location of the manifest file to use the directory parsed from the arguments. Signed-off-by: Bruno Tavares <[email protected]>
badfad2
to
7690cad
Compare
When running
crossgen
on a directory with a missingCargo.toml
itwould panic with an error message.
Debugging what happend, I've found it failed to find a
Cargo.toml
file, as it don't exist.To my surprise, when I've cloned the repo and tried to reproduce using
cargo run -- ~/path/to/my-dir
, there was no panic!This happened because the
Cargo.toml
was found oncrossgen
repo, not on my targe repo, as expected.This commit changes the location of the manifest file to use the directory parsed from the arguments.
Choose one: is this a 🐛 bug fix, a 🙋 feature, or a 🔦 documentation change?
🐛
Checklist
Context
Related issue while debugging: rust-cli/human-panic#30 (comment) and #16
Semver Changes