museun / cargo-whatfeatures Goto Github PK
View Code? Open in Web Editor NEWa simple cargo plugin to get a list of features for a specific crate
License: Apache License 2.0
a simple cargo plugin to get a list of features for a specific crate
License: Apache License 2.0
for example
whatfeatures rand
rand/0.7.0
default: std
std: rand_core/std, alloc, getrandom
stdweb: getrandom_package/stdweb
serde1
getrandom: getrandom_package, rand_core/getrandom
small_rng: rand_pcg
nightly: simd_support
simd_support: packed_simd
alloc: rand_core/alloc
wasm-bindgen: getrandom_package/wasm-bindgen
rand -> std -> rand_core/std
list the features of the dep. rand_core
and highlight the feature std
master [$] druid ❯ cargo whatfeatures .
workspace for .
├─ book_examples = 0.1.0
│ └─ no features
├─ druid = 0.6.0
│ └─ features
│ ├─ no default features
│ ├─ svg
│ └─ x11
├─ druid-derive = 0.3.1
│ └─ no features
└─ druid-shell = 0.6.0
└─ features
├─ no default features
└─ x11
This has access to an internal PathBuf
. So we can just get the last component instead of .
whatfeatures -d -n tokio-net
tokio-net/0.2.0-alpha.6
normal
crossbeam-utils = ^0.6.0
futures-core-preview = = 0.3.0-alpha.19
futures-util-preview = = 0.3.0-alpha.19
lazy_static = ^1.0.2
mio = ^0.6.14
num_cpus = ^1.8.0
parking_lot = ^0.9
slab = ^0.4.0
tokio-codec = = 0.2.0-alpha.6
tokio-executor = = 0.2.0-alpha.6
- features: blocking
tokio-io = = 0.2.0-alpha.6
tokio-sync = = 0.2.0-alpha.6
tracing = ^0.1.5 if cfg(test)
- features: log
optional
bytes = ^0.4
crossbeam-queue = ^0.1.2 if cfg(unix)
futures-sink-preview = = 0.3.0-alpha.19
iovec = ^0.1
libc = ^0.2.42 if cfg(unix)
mio-named-pipes = ^0.1 if cfg(windows)
mio-uds = ^0.6.5 if cfg(unix)
signal-hook-registry = ~1 if cfg(unix)
tracing = ^0.1.5
winapi = ^0.3 if cfg(windows)
things like = = 0.2.0-alpha.6
should probably changed (the double equal signs)
First of all: thanks, I really like using your project!
I'm quite sure this is not a bug in whatfeatures
, but I'm not entirely sure how this works:
serde
you need to enable the feature chrono = { version = "0.4", features = ["serde"] }
cargo whatfeatures chrono
and I don't see serde
Is this some sort of feature that is not being "exposed" and that's why whatfeatures
can't pick it up? Or is there something it could do to pick that up? I'd be open to try a PR if you could point me in the right direction.
cargo whatfeatures C:\dev\forks\rust-analyzer\ -d
ra_arena/0.1.0
features
├─ no default features
├─ cpu_profiler
├─ jemalloc
│ └─ ra_prof/jemalloc
└─ wasm
optional dependencies
├─ for cfg(not(target_env = "msvc"))
│ ├─ jemalloc-ctl = ^0.3.3
│ └─ jemallocator = ^0.3.2
└─ backtrace = ^0.3.44
required dependencies
├─ normal
│ ├─ for cfg(windows)
│ │ └─ winapi = ^0.3.8
│ ├─ anyhow = ^1.0.26
│ ├─ anyhow = ^1.0.26
│ ├─ anyhow = ^1.0.26
│ ├─ anymap = ^0.12.1
│ ├─ arrayvec = ^0.5.1
│ ├─ arrayvec = ^0.5.1
│ ├─ arrayvec = ^0.5.1
│ ├─ cargo_metadata = ^0.10.0
│ ├─ cargo_metadata = ^0.10.0
│ ├─ chalk-ir = *
│ ├─ chalk-solve = *
│ ├─ crossbeam-channel = ^0.4.0
│ ├─ crossbeam-channel = ^0.4.0
│ ├─ crossbeam-channel = ^0.4.0
│ ├─ difference = ^2.0.0
│ ├─ drop_bomb = ^0.1.4
│ ├─ drop_bomb = ^0.1.4
│ ├─ either = ^1.5.3
│ ├─ either = ^1.5.3
│ ├─ either = ^1.5.3
│ ├─ either = ^1.5.3
│ ├─ either = ^1.5.3
│ ├─ either = ^1.5.3
│ ├─ ena = ^0.14.0
│ ├─ env_logger = ^0.7.1
│ ├─ fst = ^0.4
│ ├─ globset = ^0.4.4
│ ├─ goblin = ^0.2.1
│ ├─ home = ^0.5.3
│ ├─ indexmap = ^1.3.2
│ ├─ itertools = ^0.9.0
│ ├─ itertools = ^0.9.0
│ ├─ itertools = ^0.9.0
│ ├─ itertools = ^0.9.0
│ ├─ itertools = ^0.9.0
│ ├─ itertools = ^0.9.0
│ ├─ itertools = ^0.9.0
│ ├─ jod-thread = ^0.1.1
│ ├─ jod-thread = ^0.1.1
│ ├─ jod-thread = ^0.1.0
│ ├─ libloading = ^0.6.0
│ ├─ log = ^0.4.8
│ ├─ log = ^0.4.8
│ ├─ log = ^0.4.8
│ ├─ log = ^0.4.8
│ ├─ log = ^0.4.8
│ ├─ log = ^0.4.8
│ ├─ log = ^0.4.8
│ ├─ log = ^0.4.8
│ ├─ log = ^0.4.8
│ ├─ log = ^0.4.8
│ ├─ log = ^0.4.8
│ ├─ lsp-server = ^0.3.1
│ ├─ lsp-types = ^0.74.0 (has enabled features)
│ │ └─ proposed
│ ├─ memmap = ^0.7
│ ├─ once_cell = ^1.3.1
│ ├─ once_cell = ^1.3.1
│ ├─ once_cell = ^1.3.1
│ ├─ once_cell = ^1.3.1
│ ├─ parking_lot = ^0.10.0
│ ├─ pico-args = ^0.3.1
│ ├─ pico-args = ^0.3.1
│ ├─ proc-macro2 = ^1.0.8
│ ├─ quote = ^1.0.2
│ ├─ ra_arena = *
│ ├─ ra_arena = *
│ ├─ ra_arena = *
│ ├─ ra_arena = *
│ ├─ ra_arena = *
│ ├─ ra_assists = *
│ ├─ ra_cfg = *
│ ├─ ra_cfg = *
│ ├─ ra_cfg = *
│ ├─ ra_cfg = *
│ ├─ ra_cfg = *
│ ├─ ra_cfg = *
│ ├─ ra_db = *
│ ├─ ra_db = *
│ ├─ ra_db = *
│ ├─ ra_db = *
│ ├─ ra_db = *
│ ├─ ra_db = *
│ ├─ ra_db = *
│ ├─ ra_db = *
│ ├─ ra_db = *
│ ├─ ra_flycheck = *
│ ├─ ra_fmt = *
│ ├─ ra_fmt = *
│ ├─ ra_hir = * (renamed to hir)
│ ├─ ra_hir = * (renamed to hir)
│ ├─ ra_hir = * (renamed to hir)
│ ├─ ra_hir = * (renamed to hir)
│ ├─ ra_hir_def = * (renamed to hir_def)
│ ├─ ra_hir_def = * (renamed to hir_def)
│ ├─ ra_hir_def = * (renamed to hir_def)
│ ├─ ra_hir_expand = * (renamed to hir_expand)
│ ├─ ra_hir_expand = * (renamed to hir_expand)
│ ├─ ra_hir_expand = * (renamed to hir_expand)
│ ├─ ra_hir_ty = * (renamed to hir_ty)
│ ├─ ra_hir_ty = * (renamed to hir_ty)
│ ├─ ra_ide = *
│ ├─ ra_ide_db = *
│ ├─ ra_ide_db = *
│ ├─ ra_mbe = * (renamed to mbe)
│ ├─ ra_mbe = * (renamed to mbe)
│ ├─ ra_mbe = *
│ ├─ ra_parser = *
│ ├─ ra_parser = *
│ ├─ ra_parser = *
│ ├─ ra_proc_macro = *
│ ├─ ra_proc_macro = *
│ ├─ ra_proc_macro_srv = *
│ ├─ ra_prof = *
│ ├─ ra_prof = *
│ ├─ ra_prof = *
│ ├─ ra_prof = *
│ ├─ ra_prof = *
│ ├─ ra_prof = *
│ ├─ ra_prof = *
│ ├─ ra_prof = *
│ ├─ ra_prof = *
│ ├─ ra_project_model = *
│ ├─ ra_syntax = *
│ ├─ ra_syntax = *
│ ├─ ra_syntax = *
│ ├─ ra_syntax = *
│ ├─ ra_syntax = *
│ ├─ ra_syntax = *
│ ├─ ra_syntax = *
│ ├─ ra_syntax = *
│ ├─ ra_syntax = *
│ ├─ ra_syntax = *
│ ├─ ra_syntax = *
│ ├─ ra_syntax = *
│ ├─ ra_text_edit = *
│ ├─ ra_text_edit = *
│ ├─ ra_text_edit = *
│ ├─ ra_text_edit = *
│ ├─ ra_text_edit = *
│ ├─ ra_toolchain = *
│ ├─ ra_toolchain = *
│ ├─ ra_tt = * (renamed to tt)
│ ├─ ra_tt = * (renamed to tt)
│ ├─ ra_tt = * (renamed to tt)
│ ├─ ra_tt = * (renamed to tt)
│ ├─ ra_tt = *
│ ├─ ra_tt = *
│ ├─ ra_tt = *
│ ├─ ra_vfs = ^0.6.0
│ ├─ rand = ^0.7.3 (has enabled features)
│ │ └─ small_rng
│ ├─ rand = ^0.7.3 (has enabled features)
│ │ └─ small_rng
│ ├─ rayon = ^1.3.0
│ ├─ relative-path = ^1.0.0
│ ├─ relative-path = ^1.0.0
│ ├─ relative-path = ^1.0.0
│ ├─ rowan = ^0.10.0
│ ├─ rustc-ap-rustc_lexer = ^661.0.0 (renamed to rustc_lexer)
│ ├─ rustc-hash = ^1.1.0
│ ├─ rustc-hash = ^1.1.0
│ ├─ rustc-hash = ^1.1.0
│ ├─ rustc-hash = ^1.1.0
│ ├─ rustc-hash = ^1.1.0
│ ├─ rustc-hash = ^1.1.0
│ ├─ rustc-hash = ^1.1.0
│ ├─ rustc-hash = ^1.1.0
│ ├─ rustc-hash = ^1.1.0
│ ├─ rustc-hash = ^1.1.0
│ ├─ rustc-hash = ^1.1.0
│ ├─ rustc-hash = ^1.1.0
│ ├─ rustc-hash = ^1.1.0
│ ├─ salsa = ^0.14.1
│ ├─ scoped-tls = ^1
│ ├─ serde = ^1.0.106 (has enabled features)
│ │ └─ derive
│ ├─ serde = ^1.0 (has enabled features)
│ │ └─ derive
│ ├─ serde = ^1.0.106 (has enabled features)
│ │ └─ derive
│ ├─ serde = ^1.0.106 (has enabled features)
│ │ └─ derive
│ ├─ serde_json = ^1.0.48
│ ├─ serde_json = ^1.0.48
│ ├─ serde_json = ^1.0
│ ├─ serde_json = ^1.0.48
│ ├─ serde_json = ^1.0.48
│ ├─ smallvec = ^1.2.0
│ ├─ smallvec = ^1.2.0
│ ├─ smol_str = ^0.1.15 (has enabled features)
│ │ └─ serde
│ ├─ smol_str = ^0.1.15 (has enabled features)
│ │ └─ serde
│ ├─ stdx = *
│ ├─ stdx = *
│ ├─ stdx = *
│ ├─ stdx = *
│ ├─ stdx = *
│ ├─ stdx = *
│ ├─ superslice = ^1.0.0
│ ├─ test_utils = *
│ ├─ test_utils = *
│ ├─ test_utils = *
│ ├─ test_utils = *
│ ├─ test_utils = *
│ ├─ test_utils = *
│ ├─ test_utils = *
│ ├─ test_utils = *
│ ├─ text-size = ^1.0.0
│ ├─ text-size = ^1.0.0
│ ├─ threadpool = ^1.7.1
│ └─ walkdir = ^2.3.1
├─ development
│ ├─ cargo_metadata = ^0.10.0
│ ├─ difference = ^2.0.0
│ ├─ insta = ^0.16.0
│ ├─ insta = ^0.16.0
│ ├─ insta = ^0.16.0
│ ├─ insta = ^0.16.0
│ ├─ ra_mbe = * (renamed to mbe)
│ ├─ ra_mbe = * (renamed to mbe)
│ ├─ ra_tt = * (renamed to tt)
│ ├─ serde_derive = ^1.0.106
│ ├─ tempfile = ^3.1.0
│ ├─ test_utils = *
│ ├─ test_utils = *
│ ├─ test_utils = *
│ └─ walkdir = ^2.3.1
└─ no build dependencies
chrono doesn't have an explicit feature for serde
whatfeatures chrono
chrono/0.4.7
default: clock
clock: time
whatfeatures chrono -d
chrono/0.4.7
features
default: clock
clock: time
dependencies
normal
libc = ^0.2
num-integer = ^0.1.36
num-traits = ^0.2
optional
rustc-serialize = ^0.3.20
serde = ^1
time = ^0.1.39
dev
bincode = ^0.8.0
doc-comment = ^0.3
num-iter = ^0.1.35
serde_derive = ^1
serde_json = ^1
instead its an optional dep. see Cargo.toml
amethyst/0.11.1
has these features:
default: animation, audio, locale, network, renderer
animation: amethyst_animation
audio: amethyst_audio
empty: amethyst_rendy/empty
float64: amethyst_core/float64
gltf: amethyst_gltf, amethyst_animation
json: amethyst_assets/json
locale: amethyst_locale
metal: amethyst_rendy/metal
network: amethyst_network
nightly: amethyst_animation/nightly, amethyst_assets/nightly, amethyst_audio/nightly, amethyst_config/nightly, amethyst_core/nightly, amethyst_controls/nightly, amethyst_network/nightly, amethyst_rendy/nightly, amethyst_input/nightly, amethyst_ui/nightly, amethyst_utils/nightly
no-slow-safety-checks: amethyst_rendy/no-slow-safety-checks
profiler: thread_profiler, thread_profiler/thread_profiler, amethyst_animation/profiler, amethyst_assets/profiler, amethyst_audio/profiler, amethyst_config/profiler, amethyst_core/profiler, amethyst_controls/profiler, amethyst_input/profiler, amethyst_locale/profiler, amethyst_rendy/profiler, amethyst_ui/profiler, amethyst_utils/profiler
renderer: amethyst_rendy
saveload: amethyst_core/saveload
sdl_controller: amethyst_input/sdl_controller
server: locale, network
shader-compiler: amethyst_rendy/shader-compiler
test-support: amethyst_rendy/test-support, amethyst_window/test-support
vulkan: amethyst_rendy/vulkan
The wrapping is somewhat distracting, when following lines, so it aligning them in columns may be an option.
whatfeatures -s -n -l futures-preview
error: The following required arguments were not provided:
--deps
USAGE:
whatfeatures.exe <crate> --color <bool> --deps --list --no-features --short
For more information try --help
-n
without -d
shouldn't be an error if both -s
and -l
are present
such as:
-f true --deps
can be faster in the future. right now it blocks when they could probably be done with a pipeline
example:
whatfeatures futures -d
futures/0.1.28
features
default: use_std, with-deprecated
nightly
use_std
with-deprecated
dependencies
using cargo_metadata can provide most of the information we need
either depend on cargo, or shell out to cargo locate-project
+ cargo read-manifest
to determine the workspace path and whether we're local
decisions:
Cargo uses the following to specify the Cargo.toml path and the pkgid
. We should do the same.
-p, --package <SPEC> Argument to get the package ID specifier for
--manifest-path <PATH> Path to Cargo.toml
for example
whatfeatures rand
rand/0.7.0
default: std
std: rand_core/std, alloc, getrandom
stdweb: getrandom_package/stdweb
serde1
getrandom: getrandom_package, rand_core/getrandom
small_rng: rand_pcg
nightly: simd_support
simd_support: packed_simd
alloc: rand_core/alloc
wasm-bindgen: getrandom_package/wasm-bindgen
would be:
default
std
...
getrandom
getrandom_package
$ cargo whatfeatures futures
futures/0.3.1
default: std, async-await, executor
alloc: futures-core/alloc, futures-task/alloc, futures-sink/alloc,
futures-channel/alloc, futures-util/alloc
async-await: futures-util/async-await, futures-util/async-await-macro
bilock: futures-util/bilock
cfg-target-has-atomic: futures-core/cfg-target-has-atomic,
futures-task/cfg-target-has-atomic,
futures-channel/cfg-target-has-atomic,
futures-util/cfg-target-has-atomic
compat: std, futures-util/compat
executor: std, futures-executor/std
io-compat: compat, futures-util/io-compat
read-initializer: futures-io/read-initializer, futures-util/read-initializer
std: alloc, futures-core/std, futures-task/std, futures-io/std, futures-sink/std,
futures-util/std, futures-util/io, futures-util/channel
thread-pool: executor, futures-executor/thread-pool
unstable: futures-core/unstable, futures-task/unstable, futures-channel/unstable,
futures-io/unstable, futures-util/unstable
this is rather hard to read. perhaps use columns across the entire output, or utilize some vertical space.
whatfeatures winapi --list | wc -l
2627
The Command/Args stuff should probably be tested.
The output for both text and json should also be tested. perhaps trybuild
will be applicable here
whatfeatures chrono -d
chrono/0.4.9
features
default: clock
clock: time
wasmbind: wasm-bindgen, js-sys
dependencies
normal
libc = ^0.2
num-integer = ^0.1.36
num-traits = ^0.2
optional
js-sys = ^0.3 if cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))
rustc-serialize = ^0.3.20
serde = ^1
time = ^0.1.39
wasm-bindgen = ^0.2 if cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))
dev
bincode = ^0.8.0
doc-comment = ^0.3
num-iter = ^0.1.35
serde_derive = ^1
serde_json = ^1
wasm-bindgen-test = ^0.2 if cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))
it should split the attributes to fit within the BoundingBox
cargo install cargo-whatfeatures
should be valid, but cargo install whatfeatures
is required.
having uniformity with other cargo tools is probably a good idea
cargo whatfeatures syn
syn/1.0.31
features
├─ default
│ ├─ clone-impls
│ ├─ derive
│ ├─ parsing
│ ├─ printing
│ └─ proc-macro
├─ clone-impls
├─ derive
├─ extra-traits
├─ fold
├─ full
├─ parsing
├─ printing
├─ proc-macro
├─ test
├─ visit
└─ visit-mut
It would be nice if it put a (D) or (*) or something beside the list of features at the bottom. This would make spotting which aren't enabled by default easier.
example:
the curl crate has its version 0.5.0
is yanked, so this should list (currently) 0.4.22
instead
example:
whatfeatures tui -d
tui/0.6.2
features
default: termion
curses: easycurses, pancurses
dependencies
normal
bitflags = ^1.0
cassowary = ^0.3
crossterm = ^0.9
easycurses = ^0.12.2
either = ^1.5
itertools = ^0.8
log = ^0.4
pancurses = ^0.16.1
rustbox = ^0.11
termion = ^1.5
unicode-segmentation = ^1.2
unicode-width = ^0.1
dev
failure = ^0.1
rand = ^0.6
stderrlog = ^0.4
structopt = ^0.2
[dependencies]
bitflags = "1.0"
cassowary = "0.3"
itertools = "0.8"
log = "0.4"
either = "1.5"
unicode-segmentation = "1.2"
unicode-width = "0.1"
termion = { version = "1.5", optional = true }
rustbox = { version = "0.11", optional = true }
crossterm = { version = "^0.9", optional = true }
easycurses = { version = "0.12.2", optional = true }
pancurses = { version = "0.16.1", optional = true, features = ["win32a"] }
[dev-dependencies]
stderrlog = "0.4"
rand = "0.6"
failure = "0.1"
structopt = "0.2"
also, deps should show the features for the deps themselves.
The current color usage is, lets say, less than ideal.
I'm thinking about removing the json support to make the output
visitor simpler.
If anyone relies on this, I would like to know before I rip it out.
Currently there are a few formatting bugs/quirks that are difficult to fix because of how the 'output' state is produced/perserved. Because json needs to be well formed, I have this weird begin/middle/end finite automata that makes calculating total width/height/columns a bit tedious.
I also want to move to cargo-metadata
to be in line with other cargo tools, it has a rigid model for how/when json should be rendered. If I do decide to keep the json output, its format will change. I'll try to come up with something like json-schema (or json5 or even ndjson) to have a well-formed output.
perhaps --short
should always show the 'updated N time ago'
--verbose should also show the license at the very least.
Currently the logging does nothing
I get annoyed of doing
> cargo whatfeatures -d .
Error: cannot find a crate matching '.'. maybe the latest version was yanked?
> cargo whatfeatures -d --manifest-path .
If the <crate>
is path-like (maybe a valid dir, or a valid path to a Cargo.toml
) it should imply --manifest-path
.
from no-color.org:
All command-line software which outputs text with ANSI color added should check for the presence of a NO_COLOR environment variable that, when present (regardless of its value), prevents the addition of ANSI color.
Also, come up with a better default theme. The current one is a bit too much unicorn-vomit.
This looks interesting:
This would be used for classifying the target platforms (x86-64-windows-msvc etc).
See #25 for another thing that needs to be wrapped
Like dependencies, features could be aligned to the colon.
[
{
"name": "curl",
"version": "0.3.0"
},
{
"id": 87603,
"version_id": 27715
// ...
it should be an object:
{
"crate" : { "name" : "curl", "version" : "0.3.0" },
"deps" : [ { .. } ]
}
see #5
whatfeatures foo --list --only-version --json
should be
{
"name" : "foo",
"versions": [ "0.1.0", .. ]
}
instead of what it is now.
(this can be apply to a lot of the output.)
cargo whatfeatures -d .
cargo-whatfeatures/0.8.2
no features
required dependencies
├─ normal
│ ├─ anyhow = ^1.0.31
│ ├─ attohttpc = ^0.13.0 (has enabled features)
│ ├─ cargo_metadata = ^0.10.0
│ ├─ crate_version_parse = ^0.2.0
│ ├─ directories-next = ^1.0.1
│ ├─ flate2 = ^1.0.14
│ ├─ home = ^0.5.3
│ ├─ pico-args = ^0.3.1
│ ├─ serde = ^1.0.111 (has enabled features)
│ ├─ tar = ^0.4.28
│ └─ yansi = ^0.5.0
├─ no development dependencies
└─ no build dependencies
no optional dependencies
the 'no .. deps' messages could be behind -v
whatfeatures -d ctrlc_fnonce
ctrlc_fnonce/0.1.0
features
no default features
dependencies
normal
optional
ctrlc = ^3.1
{
"name": "ctrlc_fnonce",
"version": "0.1.0",
"yanked": false,
"features": {},
"dependencies": {
"normal": [
{
"ctrlc": {
"req": "^3.1",
"optional": false,
"default_features": true,
"features": [],
"target": null
}
}
]
}
}
it seems to be inverted.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.