Skip to content

A collection of utility functions and command line interfaces for cargo-xtask

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

gifnksm/cli-xtask

cli-xtask

Maintenance: passively-maintained License: MIT OR Apache-2.0 crates.io docs.rs Rust: ^1.77.0 GitHub Actions: CI Codecov

A collection of utility functions and command line interfaces for cargo-xtask.

This crate provides the following utilities:

Usage

First, create an xtask crate following the instructions on the cargo-xtask website.

Then, run the following command to add cli-xtask to the dependencies.

  • For bin crates:

    cargo add -p xtask cli-xtask --features main,bin-crate

    If you want to use extra tools such as cargo-sync-rdme and cargo-udeps, add the bin-crate-extra feature.

    cargo add -p xtask cli-xtask --features main,bin-crate,bin-crate-extra
  • For lib crates:

    cargo add -p xtask cli-xtask --features main,lib-crate

    If you want to use extra tools such as cargo-sync-rdme and cargo-udeps, add the lib-crate-extra feature.

    cargo add -p xtask cli-xtask --features main,lib-crate,lib-crate-extra

Finally, edit xtask/src/main.rs as follows

use cli_xtask::{Result, Xtask};

fn main() -> Result<()> {
    <Xtask>::main()
}

Now you can run various workflows with cargo xtask.

Customizing

If you want to remove the subcommands that are not useful for your project, you can remove them by disabling the corresponding cargo features. See the Feature flags section for more information.

If you want to add the subcommands that are not included in this crate, you can add them by creating a new data structure that implements the clap::Subcommand and Run. See the documentation of Xtask for more information.

Feature flags

By using the features flags of cli-xtask, you can enable only the features and commands you need. By default, all features are disabled.

The following section contains a list of available features:

CLI features

  • main - Enables [Xtask::main] function and [Xtask::main_with_config] function that are the premade entry point for the CLI.
  • error-handler - Enables functions for error handling in error_handler module.
  • logger - Enables functions for logging in logger module.

Subcommand features

There are two types of features that enable subcommands:

  • Combined features - features that enable several useful subcommands at once, depending on the type of crate
  • Separated features - features that enable each subcommand separately

Combined features

  • bin-crate:- Enables useful subcommands for bin crates.
  • lib-crate - Enables useful subcommands for lib crates.
  • bin-crate-extra - Enables the additional subcommands useful for bin crates.
  • lib-crate-extra - Enables the additional subcommands useful for lib crates.

The {bin,lib}-crate feature requires only the standard Rust tools that can be installed with rustup. The {bin,lib}-crate-extra feature may require third-party tools.

Separated features

The following features require only the standard Rust tools:

The following features require third-party tools:

Other features

  • archive - Enables archive module which provides the functionality to create the archive file for distribution.

Minimum supported Rust version (MSRV)

The minimum supported Rust version is Rust 1.77.0. At least the last 3 versions of stable Rust are supported at any given time.

While a crate is a pre-release status (0.x.x) it may have its MSRV bumped in a patch release. Once a crate has reached 1.x, any MSRV bump will be accompanied by a new minor version.

License

This project is licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

See CONTRIBUTING.md.

About

A collection of utility functions and command line interfaces for cargo-xtask

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages