~jplatte/cargo-depgraph

632b15019059f65e95386fab379eae1022691573 — Jonas Platte 9 months ago 1dae821
Upgrdae clap to 3.0.0-beta.4
3 files changed, 177 insertions(+), 83 deletions(-)

M Cargo.lock
M Cargo.toml
M src/cli.rs
M Cargo.lock => Cargo.lock +105 -23
@@ 3,15 3,6 @@
version = 3

[[package]]
name = "ansi_term"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
dependencies = [
 "winapi",
]

[[package]]
name = "anyhow"
version = "1.0.38"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 83,20 74,36 @@ dependencies = [

[[package]]
name = "clap"
version = "2.33.3"
version = "3.0.0-beta.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002"
checksum = "fcd70aa5597dbc42f7217a543f9ef2768b2ef823ba29036072d30e1d88e98406"
dependencies = [
 "ansi_term",
 "atty",
 "bitflags",
 "clap_derive",
 "indexmap",
 "lazy_static",
 "os_str_bytes",
 "strsim",
 "termcolor",
 "textwrap",
 "unicode-width",
 "vec_map",
]

[[package]]
name = "clap_derive"
version = "3.0.0-beta.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b5bb0d655624a0b8770d1c178fb8ffcb1f91cc722cb08f451e3dc72465421ac"
dependencies = [
 "heck",
 "proc-macro-error",
 "proc-macro2",
 "quote",
 "syn",
]

[[package]]
name = "fixedbitset"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 109,6 116,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"

[[package]]
name = "heck"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c"
dependencies = [
 "unicode-segmentation",
]

[[package]]
name = "hermit-abi"
version = "0.1.17"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 134,12 150,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736"

[[package]]
name = "lazy_static"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"

[[package]]
name = "libc"
version = "0.2.82"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89203f3fba0a3795506acaad8ebce3c80c0af93f994d5a1d7a0b1eeb23271929"

[[package]]
name = "os_str_bytes"
version = "3.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6acbef58a60fe69ab50510a55bc8cdd4d6cf2283d27ad338f54cb52747a9cf2d"

[[package]]
name = "petgraph"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 150,19 178,43 @@ dependencies = [
]

[[package]]
name = "proc-macro-error"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
dependencies = [
 "proc-macro-error-attr",
 "proc-macro2",
 "quote",
 "syn",
 "version_check",
]

[[package]]
name = "proc-macro-error-attr"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
dependencies = [
 "proc-macro2",
 "quote",
 "version_check",
]

[[package]]
name = "proc-macro2"
version = "1.0.24"
version = "1.0.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71"
checksum = "5c7ed8b8c7b886ea3ed7dde405212185f423ab44682667c8c6dd14aa1d9f6612"
dependencies = [
 "unicode-xid",
]

[[package]]
name = "quote"
version = "1.0.8"
version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "991431c3519a3f36861882da93630ce66b52918dcf1b8e2fd66b397fc96f28df"
checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7"
dependencies = [
 "proc-macro2",
]


@@ 215,15 267,15 @@ dependencies = [

[[package]]
name = "strsim"
version = "0.8.0"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"

[[package]]
name = "syn"
version = "1.0.58"
version = "1.0.74"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc60a3d73ea6594cd712d830cc1f0390fd71542d8c8cd24e70cc54cdfd5e05d5"
checksum = "1873d832550d4588c3dbc20f01361ab00bfe741048f71e3fecf145a7cc18b29c"
dependencies = [
 "proc-macro2",
 "quote",


@@ 231,15 283,30 @@ dependencies = [
]

[[package]]
name = "termcolor"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4"
dependencies = [
 "winapi-util",
]

[[package]]
name = "textwrap"
version = "0.11.0"
version = "0.14.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
checksum = "0066c8d12af8b5acd21e00547c3797fde4e8677254a7ee429176ccebbe93dd80"
dependencies = [
 "unicode-width",
]

[[package]]
name = "unicode-segmentation"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b"

[[package]]
name = "unicode-width"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 258,6 325,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"

[[package]]
name = "version_check"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe"

[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 274,6 347,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"

[[package]]
name = "winapi-util"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
dependencies = [
 "winapi",
]

[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"

M Cargo.toml => Cargo.toml +1 -1
@@ 14,5 14,5 @@ exclude = [".gitignore", ".rustfmt.toml", "*.png"]
[dependencies]
anyhow = "1.0.38"
cargo_metadata = "0.14.0"
clap = "2.33.3"
clap = "3.0.0-beta.4"
petgraph = { version = "0.6.0", default-features = false, features = ["stable_graph"] }

M src/cli.rs => src/cli.rs +71 -59
@@ 1,4 1,4 @@
use clap::{App, AppSettings, Arg, SubCommand};
use clap::{App, AppSettings, Arg};

pub struct Config {
    pub build_deps: bool,


@@ 25,111 25,123 @@ pub fn parse_options() -> Config {
        .bin_name("cargo")
        .version(env!("CARGO_PKG_VERSION"))
        .subcommand(
            SubCommand::with_name("depgraph")
                .settings(&[AppSettings::DeriveDisplayOrder, AppSettings::UnifiedHelpMessage])
                .arg(Arg::with_name("all_deps").long("all-deps").help(
            App::new("depgraph")
                .setting(AppSettings::DeriveDisplayOrder)
                .setting(AppSettings::UnifiedHelpMessage)
                .arg(Arg::new("all_deps").long("all-deps").about(
                    "Include all dependencies in the graph \
                    (shorthand for --build-deps --dev-deps --target-deps)",
                     (shorthand for --build-deps --dev-deps --target-deps)",
                ))
                .arg(
                    Arg::with_name("build_deps")
                    Arg::new("build_deps")
                        .long("build-deps")
                        .help("Include build-dependencies in the graph"),
                        .about("Include build-dependencies in the graph"),
                )
                .arg(
                    Arg::with_name("dev_deps")
                    Arg::new("dev_deps")
                        .long("dev-deps")
                        .help("Include dev-dependencies in the graph"),
                        .about("Include dev-dependencies in the graph"),
                )
                .arg(
                    Arg::with_name("target_deps")
                    Arg::new("target_deps")
                        .long("target-deps")
                        .help("Include cfg() dependencies in the graph"),
                        .about("Include cfg() dependencies in the graph"),
                )
                .arg(Arg::with_name("dedup_transitive_deps").long("dedup-transitive-deps").help(
                .arg(Arg::new("dedup_transitive_deps").long("dedup-transitive-deps").about(
                    "Remove direct dependency edges where there's at \
                    least one transitive dependency of the same kind.",
                ))
                .arg(Arg::with_name("hide").long("hide").multiple(true).use_delimiter(true).help(
                    "Package name(s) to hide; can be given as a comma-separated list or as multiple
                    arguments\n\n\
                    In contrast to --exclude, hidden packages will still contribute in dependency
                    kind resolution.",
                     least one transitive dependency of the same kind.",
                ))
                .arg(
                    Arg::with_name("exclude")
                    Arg::new("hide")
                        .long("hide")
                        .multiple_occurrences(true)
                        .multiple_values(true)
                        .use_delimiter(true)
                        .about(
                            "Package name(s) to hide; can be given as a comma-separated list or \
                             as multiple arguments\n\n\
                             In contrast to --exclude, hidden packages will still contribute in \
                             dependency kind resolution.",
                        ),
                )
                .arg(
                    Arg::new("exclude")
                        .long("exclude")
                        .multiple(true)
                        .multiple_occurrences(true)
                        .multiple_values(true)
                        .use_delimiter(true)
                        .help(
                            "Package name(s) to ignore; can be given as a comma-separated list or
                            as multiple arguments\n\n\
                            In constrast to --hide, excluded packages will not contribute in
                            dependency kind resolution",
                        .about(
                            "Package name(s) to ignore; can be given as a comma-separated list or \
                             as multiple arguments\n\n\
                             In constrast to --hide, excluded packages will not contribute in \
                             dependency kind resolution",
                        ),
                )
                .arg(
                    Arg::new("focus")
                        .long("focus")
                        .multiple_occurrences(true)
                        .multiple_values(true)
                        .use_delimiter(true)
                        .about(
                            "Package name(s) to focus on: only the given packages, the workspace \
                             members that depend on them and any intermediate dependencies are \
                             going to be present in the output; can be given as a comma-separated \
                             list or as multiple arguments",
                        ),
                )
                .arg(Arg::with_name("focus").long("focus").multiple(true).use_delimiter(true).help(
                    "Package name(s) to focus on: only the given packages, the workspace members \
                    that depend on them and any intermediate dependencies are going to be present \
                    in the output; can be given as a comma-separated list or as multiple arguments",
                ))
                // Options to pass through to `cargo metadata`
                .arg(
                    Arg::with_name("features")
                    Arg::new("features")
                        .long("features")
                        .help("Space-separated list of features to activate")
                        .multiple(true)
                        .about("Space-separated list of features to activate")
                        .multiple_occurrences(true)
                        .multiple_values(true)
                        .number_of_values(1)
                        .value_name("FEATURES"),
                )
                .arg(
                    Arg::with_name("all_features")
                    Arg::new("all_features")
                        .long("all-features")
                        .help("Activate all available features"),
                        .about("Activate all available features"),
                )
                .arg(
                    Arg::with_name("no_default_features")
                    Arg::new("no_default_features")
                        .long("no-default-features")
                        .help("Do not activate the `default` feature"),
                        .about("Do not activate the `default` feature"),
                )
                .arg(
                    Arg::with_name("filter_platform")
                    Arg::new("filter_platform")
                        .long("filter-platform")
                        .help("Only include resolve dependencies matching the given target-triple")
                        .multiple(true)
                        .about("Only include resolve dependencies matching the given target-triple")
                        .multiple_occurrences(true)
                        .multiple_values(true)
                        .number_of_values(1)
                        .value_name("TRIPLE"),
                )
                .arg(
                    Arg::with_name("manifest_path")
                    Arg::new("manifest_path")
                        .long("manifest-path")
                        .help("Path to Cargo.toml")
                        .about("Path to Cargo.toml")
                        .value_name("PATH"),
                )
                .arg(
                    Arg::with_name("frozen")
                    Arg::new("frozen")
                        .long("frozen")
                        .help("Require Cargo.lock and cache are up to date"),
                )
                .arg(
                    Arg::with_name("locked")
                        .long("locked")
                        .help("Require Cargo.lock is up to date"),
                )
                .arg(
                    Arg::with_name("offline")
                        .long("offline")
                        .help("Run without accessing the network"),
                        .about("Require Cargo.lock and cache are up to date"),
                )
                .arg(Arg::new("locked").long("locked").about("Require Cargo.lock is up to date"))
                .arg(Arg::new("offline").long("offline").about("Run without accessing the network"))
                .arg(
                    Arg::with_name("unstable_flags")
                        .short("Z")
                        .help(
                    Arg::new("unstable_flags")
                        .short('Z')
                        .about(
                            "Unstable (nightly-only) flags to Cargo, see \
                            'cargo -Z help' for details",
                        )
                        .value_name("FLAG")
                        .multiple(true)
                        .multiple_occurrences(true)
                        .multiple_values(true)
                        .number_of_values(1),
                ),
        )