Skip to content

Commit

Permalink
Auto merge of #3149 - cardoe:fix-pkgid-cmd, r=alexcrichton
Browse files Browse the repository at this point in the history
pkgid cmd: fix help msg with multiple packages

When there are multiple versions of a package that match a given spec
the command tells you to re-run it with the `-p` argument which does not
exist. The command appears to work without it properly.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
  • Loading branch information
bors authored Oct 18, 2016
2 parents 305621d + 1e7893c commit 02fed69
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/bin/pkgid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub struct Options {
flag_manifest_path: Option<String>,
flag_frozen: bool,
flag_locked: bool,
flag_package: Option<String>,
arg_spec: Option<String>,
}

Expand All @@ -22,6 +23,7 @@ Usage:
Options:
-h, --help Print this message
-p SPEC, --package SPEC Argument to get the package id specifier for
--manifest-path PATH Path to the manifest to the package to clean
-v, --verbose ... Use verbose output
-q, --quiet No output printed to stdout
Expand Down Expand Up @@ -60,7 +62,14 @@ pub fn execute(options: Options,
let root = try!(find_root_manifest_for_wd(options.flag_manifest_path.clone(), config.cwd()));
let ws = try!(Workspace::new(&root, config));

let spec = options.arg_spec.as_ref().map(|s| &s[..]);
let spec = if options.arg_spec.is_some() {
options.arg_spec
} else if options.flag_package.is_some() {
options.flag_package
} else {
None
};
let spec = spec.as_ref().map(|s| &s[..]);
let spec = try!(ops::pkgid(&ws, spec));
println!("{}", spec);
Ok(None)
Expand Down

0 comments on commit 02fed69

Please sign in to comment.