strl1-xtaskops

Crates.iostrl1-xtaskops
lib.rsstrl1-xtaskops
version0.7.1
created_at2025-10-20 12:50:41.463177+00
updated_at2025-12-20 12:31:57.730976+00
descriptionGoodies for working with the xtask concept
homepage
repositoryhttps://github.com/strangelightstudios/strl1.git
max_upload_size
id1891870
size159,297
Paul Liljenberg (pr0xr)

documentation

README

xtaskops

[!CAUTION] The content of this repository is publicly accessible; do not add secret or sensitive information.

This is a Rust library that has a few goodies for working with the xtask concept.

Dependency

[dependencies]
xtaskops = "0.5.0"

For most recent version see crates.io

Usage

You should have the xtask concept already set up for your project.

Quick start

You can include everything from xtask in your project. In your xtask/main.rs:

fn main() -> Result<(), anyhow::Error> {
    xtaskops::tasks::main()
}

Configuration

xtaskops supports workspace-specific configuration via a .xtask.toml file. When you run any xtask command, it will automatically search for this file starting from the current directory and walking up the directory tree.

Creating a Configuration File

Copy the example configuration:

cp .xtask.example.toml .xtask.toml

Then customize it for your workspace:

# Workspace name
workspace_name = "my-project"

# Package names for different tasks
main_package = "my-cli"
controlplane_package = "my-server"

[aws]
region = "us-west-2"
account_id = "123456789012"
ecr_registry = "123456789012.dkr.ecr.us-west-2.amazonaws.com"
sso_start_url = "https://my-company.awsapps.com/start"
sso_region = "us-west-2"
sso_role_name = "AdministratorAccess"

Benefits

  • Simpler commands: Values from config are used as defaults, so you don't need to specify them every time
  • Team consistency: Share configuration across your team via version control
  • Environment flexibility: Can still override config values with CLI flags or environment variables

Example Usage

Without config, you would need:

cargo xtask dist --registry 123456789012.dkr.ecr.us-west-2.amazonaws.com --region us-west-2

With .xtask.toml, you can simply run:

cargo xtask dist

Ops

Low level convenience operations, for file system operations, user input and more.

use xtaskops::ops::{remove_dir, create_dir_all, cmd};

remove_dir("target")?;
create_dir_all("target")?;
// cmd! is from the `duct` library
cmd!("cargo", "watch", "-s", "cargo doc --no-deps").run()?;
Ok(())

Running Tasks

Run:

$ cargo xtask coverage

Recommended: alias cargo xtask to x:

# in your zshrc/shell rcfile
alias x="cargo xtask"

License

See LICENSE for further details.

Commit count: 0

cargo fmt