Make verify-project able to verify the current working dir project
authorCarol (Nichols || Goulding) <carol.nichols@gmail.com>
Sat, 29 Aug 2015 17:26:06 +0000 (13:26 -0400)
committerCarol (Nichols || Goulding) <carol.nichols@gmail.com>
Tue, 1 Sep 2015 01:26:29 +0000 (21:26 -0400)
All other commands use the Cargo.toml in the current directory if
--manifest-path is not specified; this makes verify-project consistent.

src/bin/verify_project.rs

index b8d3f657c338ef8294fb59de1830bc49620e987e..86aa305a6814e8b1340b6359d96b635f1e5aafb8 100644 (file)
@@ -11,7 +11,7 @@ pub type Error = HashMap<String, String>;
 
 #[derive(RustcDecodable)]
 struct Flags {
-    flag_manifest_path: String,
+    flag_manifest_path: Option<String>,
     flag_verbose: bool,
     flag_quiet: bool,
     flag_color: Option<String>,
@@ -19,7 +19,7 @@ struct Flags {
 
 pub const USAGE: &'static str = "
 Usage:
-    cargo verify-project [options] --manifest-path PATH
+    cargo verify-project [options]
     cargo verify-project -h | --help
 
 Options:
@@ -35,7 +35,8 @@ pub fn execute(args: Flags, config: &Config) -> CliResult<Option<Error>> {
     try!(config.shell().set_color_config(args.flag_color.as_ref().map(|s| &s[..])));
 
     let mut contents = String::new();
-    let file = File::open(&args.flag_manifest_path);
+    let filename = args.flag_manifest_path.unwrap_or("Cargo.toml".into());
+    let file = File::open(&filename);
     match file.and_then(|mut f| f.read_to_string(&mut contents)) {
         Ok(_) => {},
         Err(e) => fail("invalid", &format!("error reading file: {}", e))