-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jakub Bukaj
committed
Nov 24, 2014
1 parent
672af89
commit 0c25226
Showing
5 changed files
with
124 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
use cargo::ops; | ||
use cargo::core::{MultiShell}; | ||
use cargo::util::{CliResult, CliError}; | ||
|
||
#[deriving(Decodable)] | ||
struct Options { | ||
flag_host: Option<String>, | ||
flag_verbose: bool, | ||
arg_query: String | ||
} | ||
|
||
pub const USAGE: &'static str = " | ||
Search packages in crates.io | ||
Usage: | ||
cargo search [options] <query> | ||
Options: | ||
-h, --help Print this message | ||
--host HOST Host of a registry to search in | ||
-v, --verbose Use verbose output | ||
"; | ||
|
||
pub fn execute(options: Options, shell: &mut MultiShell) -> CliResult<Option<()>> { | ||
shell.set_verbose(options.flag_verbose); | ||
let Options { | ||
flag_host: host, | ||
arg_query: query, | ||
.. | ||
} = options; | ||
|
||
ops::search(query.as_slice(), shell, host) | ||
.map(|_| None) | ||
.map_err(|err| CliError::from_boxed(err, 101)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0c25226
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.
saw approval from alexcrichton
at https://github.com/jakub-/cargo/commit/0c25226b35447a51918d5a17ba62a36b109757fe
0c25226
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.
merging jakub-/cargo/cargo-search = 0c25226 into auto-cargo
0c25226
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.
jakub-/cargo/cargo-search = 0c25226 merged ok, testing candidate = de5bc1e
0c25226
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.
all tests pass:
success: http://buildbot.rust-lang.org/builders/cargo-win-32/builds/571
success: http://buildbot.rust-lang.org/builders/cargo-win-64/builds/220
success: http://buildbot.rust-lang.org/builders/cargo-linux-32/builds/707
success: http://buildbot.rust-lang.org/builders/cargo-linux-64/builds/699
success: http://buildbot.rust-lang.org/builders/cargo-mac-32/builds/703
success: http://buildbot.rust-lang.org/builders/cargo-mac-64/builds/702
0c25226
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.
fast-forwarding master to auto-cargo = de5bc1e