]> git.proxmox.com Git - cargo.git/blob - src/bin/cargo/commands/package.rs
Auto merge of #9186 - weihanglo:issue-9054, r=alexcrichton
[cargo.git] / src / bin / cargo / commands / package.rs
1 use crate::command_prelude::*;
2
3 use cargo::ops::{self, PackageOpts};
4
5 pub fn cli() -> App {
6 subcommand("package")
7 .about("Assemble the local package into a distributable tarball")
8 .arg(opt("quiet", "No output printed to stdout").short("q"))
9 .arg(
10 opt(
11 "list",
12 "Print files included in a package without making one",
13 )
14 .short("l"),
15 )
16 .arg(opt(
17 "no-verify",
18 "Don't verify the contents by building them",
19 ))
20 .arg(opt(
21 "no-metadata",
22 "Ignore warnings about a lack of human-usable metadata",
23 ))
24 .arg(opt(
25 "allow-dirty",
26 "Allow dirty working directories to be packaged",
27 ))
28 .arg_target_triple("Build for the target triple")
29 .arg_target_dir()
30 .arg_features()
31 .arg_manifest_path()
32 .arg_jobs()
33 .after_help("Run `cargo help package` for more detailed information.\n")
34 }
35
36 pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
37 let ws = args.workspace(config)?;
38 ops::package(
39 &ws,
40 &PackageOpts {
41 config,
42 verify: !args.is_present("no-verify"),
43 list: args.is_present("list"),
44 check_metadata: !args.is_present("no-metadata"),
45 allow_dirty: args.is_present("allow-dirty"),
46 targets: args.targets(),
47 jobs: args.jobs()?,
48 cli_features: args.cli_features()?,
49 },
50 )?;
51 Ok(())
52 }