forked from rust-lang/cargo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpublish.rs
More file actions
50 lines (46 loc) · 1.57 KB
/
publish.rs
File metadata and controls
50 lines (46 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
use crate::command_prelude::*;
use cargo::ops::{self, PublishOpts};
pub fn cli() -> App {
subcommand("publish")
.about("Upload a package to the registry")
.arg_index()
.arg(opt("token", "Token to use when uploading").value_name("TOKEN"))
.arg(opt(
"no-verify",
"Don't verify the contents by building them",
))
.arg(opt(
"allow-dirty",
"Allow dirty working directories to be packaged",
))
.arg_target_triple("Build for the target triple")
.arg_target_dir()
.arg_manifest_path()
.arg_features()
.arg_jobs()
.arg_dry_run("Perform all checks without uploading")
.arg(opt("registry", "Registry to publish to").value_name("REGISTRY"))
}
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
let registry = args.registry(config)?;
let ws = args.workspace(config)?;
let index = args.index(config)?;
ops::publish(
&ws,
&PublishOpts {
config,
token: args.value_of("token").map(|s| s.to_string()),
index,
verify: !args.is_present("no-verify"),
allow_dirty: args.is_present("allow-dirty"),
target: args.target(),
jobs: args.jobs()?,
dry_run: args.is_present("dry-run"),
registry,
features: args._values_of("features"),
all_features: args.is_present("all-features"),
no_default_features: args.is_present("no-default-features"),
},
)?;
Ok(())
}