#cargo #features #tui #manager #crates #command-line-tool #cli

app cargo-features-manager

A tui tool to enable/disable & prune dependency features

21 releases (8 breaking)

0.9.0 Oct 24, 2024
0.8.3 Jul 29, 2024
0.7.0 Mar 30, 2024
0.4.0 Dec 15, 2023
0.3.3 Jul 28, 2023

#87 in Command line utilities

Download history 114/week @ 2024-07-22 277/week @ 2024-07-29 19/week @ 2024-08-05 23/week @ 2024-08-12 12/week @ 2024-08-19 15/week @ 2024-08-26 23/week @ 2024-09-02 9/week @ 2024-09-09 14/week @ 2024-09-16 59/week @ 2024-09-23 22/week @ 2024-09-30 32/week @ 2024-10-07 178/week @ 2024-10-14 227/week @ 2024-10-21 51/week @ 2024-10-28 75/week @ 2024-11-04

533 downloads per month

MIT license

77KB
2K SLoC

Cargo Features Manger

A TUI-like cli tool to manage the features of your rust-projects dependencies.

You can view all available features and easily toggle (enable & disable) them with one button click. All of your changes will directly be reflected in your Cargo.toml file.


install

cargo install cargo-features-manager


usage

To start the tool run cargo features in your project root dir.

This will open the dependency-selector:

dependencySelector

Now you can select the dependency for which you want to change the enabled features.

Selecting a dependency will open the feature-selector:

featureSelector

When using cargo features -d <dependency name> it will directly open the corresponding feature-selector.

navigation

to move up

to move down

Space | Enter | to select

ESC | to move back

dependency selector

Dependency which do not have any features are marked grey.
Dev-Dependency are marked with 🧪.
Build-Dependency are marked with 🛠️.
Workspace-Dependency are marked with 🗃️️.

dependencySelector

feature selector

All default features are marked Green.

greenMark

When hovering above a feature it shows other features which the selected feature requires.

featureDependency

Features marked with 📦 mean that they require an optional dependency.

featurePackageDependency

Features which an active feature requires are marked grey.

greyFeature

Features marked with 🗃️️ are enabled by the workspace dependency and can only be disabled by the workspace dependency

workspaceFeatures

search mode

At any point you can start typing like normal. This will start using your input as a search query.


prune

You can run prune with cargo features prune

this will disable all features which are not required to compile.

false positives

Some features may not cause the compilation to fail but still remove functionality. To limit the extent of such cases we keep a file including all known false positives. These features will not be disabled by cargo features prune and instead be display gray letting you know that you should consider if you really need the feature.

If you know of any other features that fall under this category fell free to open an Issue or PR!

If your project requires additional features to be always kept. You can add a section to your Cargo.toml named cargo-features-manager.keep in there you can define which features will be kept.

# Cargo.toml

# for individial packages
[cargo-features-manager.keep]
clap = ["default"]
color-eyre = ["capture-spantrace", "track-caller"]

# for the whole workspace
[workspace.cargo-features-manager.keep]
clap = ["default"]
color-eyre = ["capture-spantrace", "track-caller"]

Dependencies

~8–17MB
~236K SLoC