cargo-whatfeatures 0.8.2

display features, versions and dependencies of crates
Documentation

cargo-whatfeatures

Documentation Crates

Table of Contents

Install

with cargo installed, simply do:

cargo install -f cargo-whatfeatures

Note -f will replace the previous installed version

Notes on color

if the NO_COLOR env-var has a value, all color will be disabled.

See https://no-color.org/

Usage

cargo-whatfeatures 0.8.0
the `whatfeatures` command

    USAGE:
        cargo whatfeatures [FLAGS] [OPTIONS] <crate>

    FLAGS:
        -h, --help
            Prints help information

        -V, --version
            Displays the program name and version

        -d, --deps
            Display dependencies for the crate
            This will list the required dependencies

        -n, --no-features
            Disable listing the features for the crate

        -l, --list
            List all versions for the crate.
            When using the `-y` option, yanked crates can be filtered.

        -s, --short
            Display only the name and latest version, such as foo/0.1.2

        -v, --verbose
            When this is enabled, all 'implied' features will be listed.
            Also, optional dependencies will be listed. Optional deps are technically features.

        -o, --offline
            Don't connect to the internet, limits the availities of this.
            If the crate is in either cargo's local registry, or whatfeatures' cache
            then this will work normally, otherwise it'll give you a nice error.

        --print-cache-dir
            Prints out the path to the cache directory

        --purge
            Purges the local cache. The command will automatically clean up after
            itself if it sees the crate in the cargo local registry. If its not
            in the cargo registry, it'll download the crate from crates.io and place
            it in its cache. This flag causes that cache to become invalidated.

            The cache is located at these locations:
            * Linux: $XDG_CACHE_HOME/museun/whatfeatures
            * Windows: %LOCALAPPDATA/museun/whatfeatures
            * macOS: $HOME/Library/Caches/museun/whatfeatures

    OPTIONS:
        -c, --color [always, auto, never]
            Attempts to use colors when printing as text [default: auto]
            *NOTE* When NO_COLOR is set to any value, all colors will be disabled

        -p, --pkgid <semver>
            A specific version to lookup. e.g. 0.7.1
            If this is not provided, then the latest crate is used.

        --manifest-path <PATH>
            A path to the Cargo.toml you want to read, locally.
            Use this to read from a local crate, rather than a remote one.

        -y, --show-yanked <exclude, include, only>
            Shows any yanked versions when using `--list`. [default: exclude].
            When 'exclude' is provided, only active releases versions will be listed
            When 'include' is provided, the listing will include yanked versions along with active releases.
            When 'only' is provided, only yanked versions will be listed

    ARGS:
        <crate>  The name of the remote crate to retrieve information for.
                 Using this means you want a 'remote' crate.
                 This is exclusive with -p, --pkgid and with --manifest-path.

This allows you to lookup a specific crate, at a specific version and get its default and optional features. It also allows listing the deps for the specified crate.

You can also use this on local crates.

Examples:

Features

list the features for the latest version

cargo whatfeatures serde

or

cargo whatfeatures -p serde

serde/1.0.110
features
├─ default
├─ alloc
├─ derive
├─ rc
├─ std
└─ unstable

list the features and optional deps for the latest version

cargo whatfeatures serde -v

Note this also list 'implied features' (ones that are enabled by other features).

serde/1.0.111
features
├─ default
│ └─ std
├─ alloc
├─ derive
│ └─ serde_derive
├─ rc
├─ std
└─ unstable
optional dependencies
└─ serde_derive = = 1.0.111 

list the features for a specific version

cargo whatfeatures -p twitchchat:0.10.2

twitchchat/0.10.2
features
├─ default
│ ├─ async
│ └─ tokio_native_tls
├─ async
├─ tokio_native_tls
└─ tokio_rustls

list the features for a local crate

cargo whatfeatures --manifest-path .

twitchchat/0.10.3
features
├─ default
│ ├─ async
│ └─ tokio_native_tls
├─ async
├─ tokio_native_tls
└─ tokio_rustls

Simple listing

get the latest version

cargo whatfeatures --short lock-api

lock_api/0.3.4

list all name and version pairs

cargo whatfeatures --list lock-api

lock-api/0.3.4
lock-api/0.3.3
lock-api/0.3.2
lock-api/0.3.1
lock-api/0.2.0
lock-api/0.1.5
lock-api/0.1.4
lock-api/0.1.3
lock-api/0.1.1
lock-api/0.1.0

list all name and version pairs, including yanked versions

cargo whatfeatures --list --show-yanked include lock-api

lock-api/0.3.4
lock-api/0.3.3
lock-api/0.3.2
lock-api/0.3.1
yanked: lock-api/0.3.0
lock-api/0.2.0
lock-api/0.1.5
lock-api/0.1.4
lock-api/0.1.3
yanked: lock-api/0.1.2
lock-api/0.1.1
lock-api/0.1.0

list all name and version pairs, only showing yanked versions

cargo whatfeatures --list --show-yanked only lock-api

yanked: lock-api/0.3.0
yanked: lock-api/0.1.2

Dependencies

list the deps for the latest version

Note use --no-features (-n) to not list the features

cargo whatfeatures curl --deps

curl/0.4.29
features
├─ default
│ └─ ssl
├─ force-system-lib-on-osx
├─ http2
├─ mesalink
├─ protocol-ftp
├─ spnego
├─ ssl
├─ static-curl
└─ static-ssl
required dependencies
├─ normal
│ ├─ for cfg(target_env = "msvc")
│ │ ├─ schannel = ^0.1.13 
│ │ └─ winapi = ^0.3 (has enabled features)
│ ├─ curl-sys = ^0.4.31 
│ ├─ libc = ^0.2.42 
│ └─ socket2 = ^0.3.7 
├─ development
│ ├─ mio = ^0.6 
│ └─ mio-extras = ^2.0.3 
└─ no build dependencies
optional dependencies
└─ for cfg(all(unix, not(target_os = "macos")))
   ├─ openssl-probe = ^0.1.2 
   └─ openssl-sys = ^0.9.43

list the deps for a specific version

note use -f false to not list the features

cargo whatfeatures -p curl:0.3.0 --deps

curl/0.3.0
no features
required dependencies
├─ normal
│ ├─ for cfg(all(unix, not(target_os = "macos")))
│ │ └─ openssl-sys = ^0.7.0 
│ ├─ curl-sys = ^0.2.0 
│ └─ libc = ^0.2 
├─ development
│ └─ mio = ^0.5 
└─ no build dependencies
no optional dependencies

list the deps for a local crate

cargo whatfeatures --manifest-path . -d -n

twitchchat/0.10.3
required dependencies
├─ normal
│ ├─ log = ^0.4 
│ ├─ parking_lot = ^0.10 
│ └─ static_assertions = ^1.1 
├─ development
│ ├─ doc-comment = ^0.3.3 
│ ├─ matches = ^0.1.8 
│ ├─ tokio = ^0.2.13 (has enabled features)
│ └─ tokio-test = ^0.2.0 
└─ no build dependencies
optional dependencies
├─ futures = ^0.3 
├─ native-tls = ^0.2 
├─ serde = ^1.0 (has enabled features)
├─ tokio = ^0.2 (has enabled features)
├─ tokio-rustls = ^0.13 
├─ tokio-tls = ^0.3 
└─ webpki-roots = ^0.19 

License

cargo-whatfeatures is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE and LICENSE-MIT for details.