-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Showing
32 changed files
with
656 additions
and
525 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,26 @@ | ||
use command_prelude::*; | ||
|
||
use cargo::core::{GitReference, SourceId, Source}; | ||
use cargo::sources::GitSource; | ||
use cargo::util::ToUrl; | ||
|
||
pub fn cli() -> App { | ||
subcommand("git-checkout") | ||
.about("Checkout a copy of a Git repository") | ||
.arg(Arg::with_name("url").long("url").value_name("URL").required(true)) | ||
.arg(Arg::with_name("reference").long("reference").value_name("REF").required(true)) | ||
} | ||
|
||
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult { | ||
let url = args.value_of("url").unwrap().to_url()?; | ||
let reference = args.value_of("reference").unwrap(); | ||
|
||
let reference = GitReference::Branch(reference.to_string()); | ||
let source_id = SourceId::for_git(&url, reference)?; | ||
|
||
let mut source = GitSource::new(&source_id, config)?; | ||
|
||
source.update()?; | ||
|
||
Ok(()) | ||
} |
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 |
---|---|---|
@@ -1,8 +1,17 @@ | ||
use command_prelude::*; | ||
|
||
use cargo::ops; | ||
|
||
pub fn cli() -> App { | ||
subcommand("init") | ||
.about("Create a new cargo package in an existing directory") | ||
.arg(Arg::with_name("path").default_value(".")) | ||
.arg_new_opts() | ||
} | ||
|
||
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult { | ||
let opts = args.new_options()?; | ||
ops::init(&opts, config)?; | ||
config.shell().status("Created", format!("{} project", opts.kind))?; | ||
Ok(()) | ||
} |
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 |
---|---|---|
@@ -1,7 +1,29 @@ | ||
use command_prelude::*; | ||
|
||
use cargo::print_json; | ||
|
||
pub fn cli() -> App { | ||
subcommand("locate-project") | ||
.about("Checkout a copy of a Git repository") | ||
.arg_manifest_path() | ||
} | ||
|
||
#[derive(Serialize)] | ||
pub struct ProjectLocation { | ||
root: String | ||
} | ||
|
||
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult { | ||
let root = args.root_manifest(config)?; | ||
|
||
let root = root.to_str() | ||
.ok_or_else(|| format_err!("your project path contains characters \ | ||
not representable in Unicode")) | ||
.map_err(|e| CliError::new(e, 1))? | ||
.to_string(); | ||
|
||
let location = ProjectLocation { root }; | ||
|
||
print_json(&location); | ||
Ok(()) | ||
} |
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
Oops, something went wrong.